From f959a09519eb4080385197b3dfba65a671edadad Mon Sep 17 00:00:00 2001 From: Slanterns Date: Fri, 28 Oct 2022 23:20:32 +0800 Subject: [PATCH 1/2] Add "at" --- posts/2022-10-28-gats-stabilization.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/posts/2022-10-28-gats-stabilization.md b/posts/2022-10-28-gats-stabilization.md index 62e2402f1..26342c6ab 100644 --- a/posts/2022-10-28-gats-stabilization.md +++ b/posts/2022-10-28-gats-stabilization.md @@ -67,7 +67,7 @@ fn main() { Here, imagine we wanted to have a `LendingIterator` where the items are overlapping slices of an array. We also have a function `print_items` that prints every item of a `LendingIterator`, as long as they implement `Debug`. This all seems innocent enough, but the above code doesn't compile — even though it should. Without going into details here, the `for<'a> I::Item<'a>: Debug` currently implies that `I::Item<'a>` must outlive `'static`. -This is not really a nice bug. And of all the ones we'll mention today, this will likely be the one that is most limiting, annoying, and tough to figure out. This pops up much more often with GATs, but can be found with code that doesn't use GATs at all. Unfortunately, fixing this requires some refactorings to the compiler that isn't a short-term project. It is on the horizon though. The good news is that, in the meantime, we are least working on improving the error message you get from this code. This is what it will look like in the upcoming stabilization: +This is not really a nice bug. And of all the ones we'll mention today, this will likely be the one that is most limiting, annoying, and tough to figure out. This pops up much more often with GATs, but can be found with code that doesn't use GATs at all. Unfortunately, fixing this requires some refactorings to the compiler that isn't a short-term project. It is on the horizon though. The good news is that, in the meantime, we are at least working on improving the error message you get from this code. This is what it will look like in the upcoming stabilization: ```rust error[E0597]: `array` does not live long enough @@ -274,4 +274,4 @@ To conclude things, all the various people involved in getting this stabilizatio [Iterator]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html [tracking issue]: https://github.com/rust-lang/rust/issues/44265 [stabilization pull request]: https://github.com/rust-lang/rust/pull/96709 -[chumsky_blog_post]: https://smallcultfollowing.com/babysteps/blog/2022/06/27/many-modes-a-gats-pattern/ \ No newline at end of file +[chumsky_blog_post]: https://smallcultfollowing.com/babysteps/blog/2022/06/27/many-modes-a-gats-pattern/ From 3296943f3b964898e3a37f1082671f09f0611a55 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 29 Oct 2022 14:50:25 -0400 Subject: [PATCH 2/2] Update posts/2022-10-28-gats-stabilization.md --- posts/2022-10-28-gats-stabilization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posts/2022-10-28-gats-stabilization.md b/posts/2022-10-28-gats-stabilization.md index 26342c6ab..bf8d8238c 100644 --- a/posts/2022-10-28-gats-stabilization.md +++ b/posts/2022-10-28-gats-stabilization.md @@ -67,7 +67,7 @@ fn main() { Here, imagine we wanted to have a `LendingIterator` where the items are overlapping slices of an array. We also have a function `print_items` that prints every item of a `LendingIterator`, as long as they implement `Debug`. This all seems innocent enough, but the above code doesn't compile — even though it should. Without going into details here, the `for<'a> I::Item<'a>: Debug` currently implies that `I::Item<'a>` must outlive `'static`. -This is not really a nice bug. And of all the ones we'll mention today, this will likely be the one that is most limiting, annoying, and tough to figure out. This pops up much more often with GATs, but can be found with code that doesn't use GATs at all. Unfortunately, fixing this requires some refactorings to the compiler that isn't a short-term project. It is on the horizon though. The good news is that, in the meantime, we are at least working on improving the error message you get from this code. This is what it will look like in the upcoming stabilization: +This is not really a nice bug. And of all the ones we'll mention today, this will likely be the one that is most limiting, annoying, and tough to figure out. This pops up much more often with GATs, but can be found with code that doesn't use GATs at all. Unfortunately, fixing this requires some refactorings to the compiler that isn't a short-term project. It is on the horizon though. The good news is that, in the meantime, we are working on improving the error message you get from this code. This is what it will look like in the upcoming stabilization: ```rust error[E0597]: `array` does not live long enough