From 3d7e9a7b27c735a8eb2fe05781bb7b4331572983 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 23 Sep 2022 00:49:25 +0000 Subject: Only record extra lifetime params for async trait fn with no body --- src/test/ui/async-await/issue-102138.rs | 46 ---------------------- .../issue-69401-trait-fn-no-body-ty-local.rs | 2 +- .../issue-69401-trait-fn-no-body-ty-local.stderr | 6 +-- 3 files changed, 4 insertions(+), 50 deletions(-) delete mode 100644 src/test/ui/async-await/issue-102138.rs (limited to 'src/test') diff --git a/src/test/ui/async-await/issue-102138.rs b/src/test/ui/async-await/issue-102138.rs deleted file mode 100644 index 91a14523c63..00000000000 --- a/src/test/ui/async-await/issue-102138.rs +++ /dev/null @@ -1,46 +0,0 @@ -// check-pass -// edition:2021 - -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::future::Future; - -async fn yield_now() {} - -trait AsyncIterator { - type Item; - async fn next(&mut self) -> Option; -} - -struct YieldingRange { - counter: u32, - stop: u32, -} - -impl AsyncIterator for YieldingRange { - type Item = u32; - - async fn next(&mut self) -> Option { - if self.counter == self.stop { - None - } else { - let c = self.counter; - self.counter += 1; - yield_now().await; - Some(c) - } - } -} - -async fn async_main() { - let mut x = YieldingRange { counter: 0, stop: 10 }; - - while let Some(v) = x.next().await { - println!("Hi: {v}"); - } -} - -fn main() { - let _ = async_main(); -} diff --git a/src/test/ui/resolve/issue-69401-trait-fn-no-body-ty-local.rs b/src/test/ui/resolve/issue-69401-trait-fn-no-body-ty-local.rs index 4ec4472cc9a..c377ecea94d 100644 --- a/src/test/ui/resolve/issue-69401-trait-fn-no-body-ty-local.rs +++ b/src/test/ui/resolve/issue-69401-trait-fn-no-body-ty-local.rs @@ -2,5 +2,5 @@ fn main() {} trait Foo { fn fn_with_type_named_same_as_local_in_param(b: b); - //~^ ERROR expected type, found local variable `b` + //~^ ERROR cannot find type `b` in this scope [E0412] } diff --git a/src/test/ui/resolve/issue-69401-trait-fn-no-body-ty-local.stderr b/src/test/ui/resolve/issue-69401-trait-fn-no-body-ty-local.stderr index c53028e9b2a..109409d2731 100644 --- a/src/test/ui/resolve/issue-69401-trait-fn-no-body-ty-local.stderr +++ b/src/test/ui/resolve/issue-69401-trait-fn-no-body-ty-local.stderr @@ -1,9 +1,9 @@ -error[E0573]: expected type, found local variable `b` +error[E0412]: cannot find type `b` in this scope --> $DIR/issue-69401-trait-fn-no-body-ty-local.rs:4:53 | LL | fn fn_with_type_named_same_as_local_in_param(b: b); - | ^ not a type + | ^ not found in this scope error: aborting due to previous error -For more information about this error, try `rustc --explain E0573`. +For more information about this error, try `rustc --explain E0412`. -- cgit 1.4.1-3-g733a5