From 2ef51035ece00dee6bcc1a2c8b9ed161a398ced5 Mon Sep 17 00:00:00 2001 From: Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> Date: Fri, 29 Apr 2022 11:23:15 +0200 Subject: [PATCH] Rollup merge of #96516 - oli-obk:impl_trait_inference_accidental_permitted, r=jackh726 Revert diagnostic duplication and accidental stabilization fixes #96460 this is an accidental stabilization that we should put into the beta. I believe it is low-risk, because it was literally what we had before #94081 The effect on tests is massive, but mostly deduplication of diagnostics and some minor span changes. --- compiler/rustc_typeck/src/check/check.rs | 6 +++ .../impl-trait-return-missing-constraint.rs | 1 - ...mpl-trait-return-missing-constraint.stderr | 25 +-------- src/test/ui/conservative_impl_trait.rs | 1 - src/test/ui/conservative_impl_trait.stderr | 14 +---- .../defaults/rp_impl_trait_fail.rs | 3 -- .../defaults/rp_impl_trait_fail.stderr | 50 ++--------------- src/test/ui/generator/issue-88653.rs | 3 -- src/test/ui/generator/issue-88653.stderr | 18 +------ .../type-mismatch-signature-deduction.rs | 1 - .../type-mismatch-signature-deduction.stderr | 24 ++------- .../ui/impl-trait/bound-normalization-fail.rs | 2 - .../bound-normalization-fail.stderr | 53 ++----------------- .../impl-trait/cross-return-site-inference.rs | 6 +-- .../cross-return-site-inference.stderr | 29 +++++----- src/test/ui/impl-trait/fallback_inference.rs | 7 +++ .../ui/impl-trait/fallback_inference.stderr | 9 ++++ src/test/ui/impl-trait/issue-72911.rs | 2 +- src/test/ui/impl-trait/issue-72911.stderr | 10 ++-- .../ui/impl-trait/issues/issue-67830.stderr | 10 ++-- .../ui/impl-trait/issues/issue-88236-2.stderr | 11 ++-- ...t_outlive_least_region_or_bound.nll.stderr | 2 +- .../must_outlive_least_region_or_bound.rs | 1 - .../must_outlive_least_region_or_bound.stderr | 15 +----- .../ui/impl-trait/nested-return-type2-tait.rs | 1 - .../nested-return-type2-tait.stderr | 21 +------- .../type_parameters_captured.nll.stderr | 2 +- .../ui/impl-trait/type_parameters_captured.rs | 1 - .../type_parameters_captured.stderr | 15 +----- src/test/ui/impl-trait/where-allowed-2.rs | 3 +- src/test/ui/impl-trait/where-allowed-2.stderr | 9 ++++ src/test/ui/issues-71798.rs | 1 - src/test/ui/issues-71798.stderr | 18 +------ .../lifetime-elision-return-type-trait.rs | 1 - .../lifetime-elision-return-type-trait.stderr | 13 +---- .../impl-trait-return-trailing-semicolon.rs | 1 - ...mpl-trait-return-trailing-semicolon.stderr | 12 +---- src/test/ui/suggestions/issue-81098.rs | 2 - src/test/ui/suggestions/issue-81098.stderr | 31 +---------- .../missing-lifetimes-in-signature.nll.stderr | 11 ++++ .../nested-tait-inference.rs | 1 - .../nested-tait-inference.stderr | 17 +----- .../nested-tait-inference2.rs | 1 - .../nested-tait-inference2.stderr | 17 +----- 44 files changed, 97 insertions(+), 384 deletions(-) create mode 100644 src/test/ui/impl-trait/fallback_inference.rs create mode 100644 src/test/ui/impl-trait/fallback_inference.stderr create mode 100644 src/test/ui/impl-trait/where-allowed-2.stderr create mode 100644 src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.nll.stderr diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs index 7cb478d78880a..d2d5307643283 100644 --- a/compiler/rustc_typeck/src/check/check.rs +++ b/compiler/rustc_typeck/src/check/check.rs @@ -102,6 +102,12 @@ pub(super) fn check_fn<'a, 'tcx>( DUMMY_SP, param_env, )); + // HACK(oli-obk): we rewrite the declared return type, too, so that we don't end up inferring all + // unconstrained RPIT to have `()` as their hidden type. This would happen because further down we + // compare the ret_coercion with declared_ret_ty, and anything uninferred would be inferred to the + // opaque type itself. That again would cause writeback to assume we have a recursive call site + // and do the sadly stabilized fallback to `()`. + let declared_ret_ty = ret_ty; fcx.ret_coercion = Some(RefCell::new(CoerceMany::new(ret_ty))); fcx.ret_type_span = Some(decl.output.span()); diff --git a/src/test/ui/associated-types/impl-trait-return-missing-constraint.rs b/src/test/ui/associated-types/impl-trait-return-missing-constraint.rs index ef0443034ec43..1de1ddbe3a4d0 100644 --- a/src/test/ui/associated-types/impl-trait-return-missing-constraint.rs +++ b/src/test/ui/associated-types/impl-trait-return-missing-constraint.rs @@ -24,7 +24,6 @@ fn bar() -> impl Bar { fn baz() -> impl Bar { //~^ ERROR type mismatch resolving `::Item == i32` - //~| ERROR type mismatch resolving `::Item == i32` bar() } diff --git a/src/test/ui/associated-types/impl-trait-return-missing-constraint.stderr b/src/test/ui/associated-types/impl-trait-return-missing-constraint.stderr index b7c49570ca40c..bd8c8a4414c4d 100644 --- a/src/test/ui/associated-types/impl-trait-return-missing-constraint.stderr +++ b/src/test/ui/associated-types/impl-trait-return-missing-constraint.stderr @@ -16,29 +16,6 @@ help: consider constraining the associated type `::Item` to `i3 LL | fn bar() -> impl Bar { | ++++++++++++ -error[E0271]: type mismatch resolving `::Item == i32` - --> $DIR/impl-trait-return-missing-constraint.rs:25:34 - | -LL | fn bar() -> impl Bar { - | -------- the expected opaque type -... -LL | fn baz() -> impl Bar { - | __________________________________^ -LL | | -LL | | -LL | | bar() -LL | | } - | |_^ expected associated type, found `i32` - | - = note: expected associated type `::Item` - found type `i32` - = help: consider constraining the associated type `::Item` to `i32` or calling a method that returns `::Item` - = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html -help: consider constraining the associated type `::Item` to `i32` - | -LL | fn bar() -> impl Bar { - | ++++++++++++ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/conservative_impl_trait.rs b/src/test/ui/conservative_impl_trait.rs index b8488d83998e8..b7f795eadb760 100644 --- a/src/test/ui/conservative_impl_trait.rs +++ b/src/test/ui/conservative_impl_trait.rs @@ -2,7 +2,6 @@ fn will_ice(something: &u32) -> impl Iterator { //~^ ERROR `()` is not an iterator - //~| ERROR `()` is not an iterator } fn main() {} diff --git a/src/test/ui/conservative_impl_trait.stderr b/src/test/ui/conservative_impl_trait.stderr index 2348f2f52978f..63a4df242f85f 100644 --- a/src/test/ui/conservative_impl_trait.stderr +++ b/src/test/ui/conservative_impl_trait.stderr @@ -6,18 +6,6 @@ LL | fn will_ice(something: &u32) -> impl Iterator { | = help: the trait `Iterator` is not implemented for `()` -error[E0277]: `()` is not an iterator - --> $DIR/conservative_impl_trait.rs:3:60 - | -LL | fn will_ice(something: &u32) -> impl Iterator { - | ____________________________________________________________^ -LL | | -LL | | -LL | | } - | |_^ `()` is not an iterator - | - = help: the trait `Iterator` is not implemented for `()` - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.rs b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.rs index 24031aa1e61f3..308c121a94111 100644 --- a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.rs +++ b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.rs @@ -5,7 +5,6 @@ impl Trait for Uwu {} fn rawr() -> impl Trait { //~^ error: the trait bound `Uwu<10_u32, 12_u32>: Trait` is not satisfied - //~| error: the trait bound `Uwu<10_u32, 12_u32>: Trait` is not satisfied Uwu::<10, 12> } @@ -17,13 +16,11 @@ impl Traitor<1, 2> for u64 {} fn uwu() -> impl Traitor { //~^ error: the trait bound `u32: Traitor` is not satisfied - //~| error: the trait bound `u32: Traitor` is not satisfied 1_u32 } fn owo() -> impl Traitor { //~^ error: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied - //~| error: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied 1_u64 } diff --git a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr index 81cfcb3560661..19813a491c96e 100644 --- a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr +++ b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr @@ -7,22 +7,8 @@ LL | fn rawr() -> impl Trait { = help: the following implementations were found: as Trait> -error[E0277]: the trait bound `Uwu<10_u32, 12_u32>: Trait` is not satisfied - --> $DIR/rp_impl_trait_fail.rs:6:25 - | -LL | fn rawr() -> impl Trait { - | _________________________^ -LL | | -LL | | -LL | | Uwu::<10, 12> -LL | | } - | |_^ the trait `Trait` is not implemented for `Uwu<10_u32, 12_u32>` - | - = help: the following implementations were found: - as Trait> - error[E0277]: the trait bound `u32: Traitor` is not satisfied - --> $DIR/rp_impl_trait_fail.rs:18:26 + --> $DIR/rp_impl_trait_fail.rs:17:26 | LL | fn uwu() -> impl Traitor { | ^^^^^^^^^^^^^^^ the trait `Traitor` is not implemented for `u32` @@ -31,23 +17,8 @@ LL | fn uwu() -> impl Traitor { > > -error[E0277]: the trait bound `u32: Traitor` is not satisfied - --> $DIR/rp_impl_trait_fail.rs:18:42 - | -LL | fn uwu() -> impl Traitor { - | __________________________________________^ -LL | | -LL | | -LL | | 1_u32 -LL | | } - | |_^ the trait `Traitor` is not implemented for `u32` - | - = help: the following implementations were found: - > - > - error[E0277]: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied - --> $DIR/rp_impl_trait_fail.rs:24:13 + --> $DIR/rp_impl_trait_fail.rs:22:13 | LL | fn owo() -> impl Traitor { | ^^^^^^^^^^^^ the trait `Traitor<1_u8, 1_u8>` is not implemented for `u64` @@ -56,21 +27,6 @@ LL | fn owo() -> impl Traitor { > > -error[E0277]: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied - --> $DIR/rp_impl_trait_fail.rs:24:26 - | -LL | fn owo() -> impl Traitor { - | __________________________^ -LL | | -LL | | -LL | | 1_u64 -LL | | } - | |_^ the trait `Traitor<1_u8, 1_u8>` is not implemented for `u64` - | - = help: the following implementations were found: - > - > - -error: aborting due to 6 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/generator/issue-88653.rs b/src/test/ui/generator/issue-88653.rs index f27956e45950a..caa452060b198 100644 --- a/src/test/ui/generator/issue-88653.rs +++ b/src/test/ui/generator/issue-88653.rs @@ -7,13 +7,10 @@ use std::ops::Generator; fn foo(bar: bool) -> impl Generator<(bool,)> { //~^ ERROR: type mismatch in generator arguments [E0631] - //~| ERROR: type mismatch in generator arguments [E0631] - //~| NOTE: expected signature of `fn((bool,)) -> _` //~| NOTE: expected signature of `fn((bool,)) -> _` //~| NOTE: in this expansion of desugaring of `impl Trait` |bar| { //~^ NOTE: found signature of `fn(bool) -> _` - //~| NOTE: found signature of `fn(bool) -> _` if bar { yield bar; } diff --git a/src/test/ui/generator/issue-88653.stderr b/src/test/ui/generator/issue-88653.stderr index 25357411ce189..5bd8ad129fef9 100644 --- a/src/test/ui/generator/issue-88653.stderr +++ b/src/test/ui/generator/issue-88653.stderr @@ -7,22 +7,6 @@ LL | fn foo(bar: bool) -> impl Generator<(bool,)> { LL | |bar| { | ----- found signature of `fn(bool) -> _` -error[E0631]: type mismatch in generator arguments - --> $DIR/issue-88653.rs:8:46 - | -LL | fn foo(bar: bool) -> impl Generator<(bool,)> { - | ______________________________________________^ -LL | | -LL | | -LL | | -... | -LL | | |bar| { - | | ----- found signature of `fn(bool) -> _` -... | -LL | | } -LL | | } - | |_^ expected signature of `fn((bool,)) -> _` - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0631`. diff --git a/src/test/ui/generator/type-mismatch-signature-deduction.rs b/src/test/ui/generator/type-mismatch-signature-deduction.rs index 77b830783c32a..8d1ce6c7a437c 100644 --- a/src/test/ui/generator/type-mismatch-signature-deduction.rs +++ b/src/test/ui/generator/type-mismatch-signature-deduction.rs @@ -4,7 +4,6 @@ use std::ops::Generator; fn foo() -> impl Generator { //~^ ERROR type mismatch - //~| ERROR type mismatch || { if false { return Ok(6); diff --git a/src/test/ui/generator/type-mismatch-signature-deduction.stderr b/src/test/ui/generator/type-mismatch-signature-deduction.stderr index 6369e7ec4c784..f05faedf21b82 100644 --- a/src/test/ui/generator/type-mismatch-signature-deduction.stderr +++ b/src/test/ui/generator/type-mismatch-signature-deduction.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/type-mismatch-signature-deduction.rs:15:9 + --> $DIR/type-mismatch-signature-deduction.rs:14:9 | LL | 5 | ^ expected enum `Result`, found integer @@ -7,12 +7,12 @@ LL | 5 = note: expected type `Result<{integer}, _>` found type `{integer}` note: return type inferred to be `Result<{integer}, _>` here - --> $DIR/type-mismatch-signature-deduction.rs:10:20 + --> $DIR/type-mismatch-signature-deduction.rs:9:20 | LL | return Ok(6); | ^^^^^ -error[E0271]: type mismatch resolving `<[generator@$DIR/type-mismatch-signature-deduction.rs:8:5: 16:6] as Generator>::Return == i32` +error[E0271]: type mismatch resolving `<[generator@$DIR/type-mismatch-signature-deduction.rs:7:5: 15:6] as Generator>::Return == i32` --> $DIR/type-mismatch-signature-deduction.rs:5:13 | LL | fn foo() -> impl Generator { @@ -21,23 +21,7 @@ LL | fn foo() -> impl Generator { = note: expected enum `Result<{integer}, _>` found type `i32` -error[E0271]: type mismatch resolving `<[generator@$DIR/type-mismatch-signature-deduction.rs:8:5: 16:6] as Generator>::Return == i32` - --> $DIR/type-mismatch-signature-deduction.rs:5:42 - | -LL | fn foo() -> impl Generator { - | __________________________________________^ -LL | | -LL | | -LL | | || { -... | -LL | | } -LL | | } - | |_^ expected enum `Result`, found `i32` - | - = note: expected enum `Result<{integer}, _>` - found type `i32` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors Some errors have detailed explanations: E0271, E0308. For more information about an error, try `rustc --explain E0271`. diff --git a/src/test/ui/impl-trait/bound-normalization-fail.rs b/src/test/ui/impl-trait/bound-normalization-fail.rs index 9f962fa9bbaf5..3329592478d6f 100644 --- a/src/test/ui/impl-trait/bound-normalization-fail.rs +++ b/src/test/ui/impl-trait/bound-normalization-fail.rs @@ -24,7 +24,6 @@ mod impl_trait { /// `T::Assoc` can't be normalized any further here. fn foo_fail() -> impl FooLike { //~^ ERROR: type mismatch - //~| ERROR: type mismatch Foo(()) } } @@ -42,7 +41,6 @@ mod lifetimes { fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike { //~^ ERROR `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope //~| ERROR: type mismatch - //~| ERROR: type mismatch Foo(()) } } diff --git a/src/test/ui/impl-trait/bound-normalization-fail.stderr b/src/test/ui/impl-trait/bound-normalization-fail.stderr index 0344f416eb7ff..eac7e6b315ec4 100644 --- a/src/test/ui/impl-trait/bound-normalization-fail.stderr +++ b/src/test/ui/impl-trait/bound-normalization-fail.stderr @@ -16,37 +16,14 @@ help: consider constraining the associated type `::Assoc LL | fn foo_fail>() -> impl FooLike { | ++++++++++++ -error[E0271]: type mismatch resolving ` as FooLike>::Output == ::Assoc` - --> $DIR/bound-normalization-fail.rs:25:64 - | -LL | fn foo_fail() -> impl FooLike { - | ________________________________________________________________^ -LL | | -LL | | -LL | | Foo(()) -LL | | } - | |_____^ type mismatch resolving ` as FooLike>::Output == ::Assoc` - | -note: expected this to be `()` - --> $DIR/bound-normalization-fail.rs:14:19 - | -LL | type Output = T; - | ^ - = note: expected unit type `()` - found associated type `::Assoc` -help: consider constraining the associated type `::Assoc` to `()` - | -LL | fn foo_fail>() -> impl FooLike { - | ++++++++++++ - error[E0760]: `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope - --> $DIR/bound-normalization-fail.rs:42:41 + --> $DIR/bound-normalization-fail.rs:41:41 | LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0271]: type mismatch resolving ` as FooLike>::Output == >::Assoc` - --> $DIR/bound-normalization-fail.rs:42:41 + --> $DIR/bound-normalization-fail.rs:41:41 | LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving ` as FooLike>::Output == >::Assoc` @@ -63,31 +40,7 @@ help: consider constraining the associated type ` LL | fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike { | ++++++++++++ -error[E0271]: type mismatch resolving ` as FooLike>::Output == >::Assoc` - --> $DIR/bound-normalization-fail.rs:42:73 - | -LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike { - | _________________________________________________________________________^ -LL | | -LL | | -LL | | -LL | | Foo(()) -LL | | } - | |_____^ type mismatch resolving ` as FooLike>::Output == >::Assoc` - | -note: expected this to be `()` - --> $DIR/bound-normalization-fail.rs:14:19 - | -LL | type Output = T; - | ^ - = note: expected unit type `()` - found associated type `>::Assoc` -help: consider constraining the associated type `>::Assoc` to `()` - | -LL | fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike { - | ++++++++++++ - -error: aborting due to 5 previous errors +error: aborting due to 3 previous errors Some errors have detailed explanations: E0271, E0760. For more information about an error, try `rustc --explain E0271`. diff --git a/src/test/ui/impl-trait/cross-return-site-inference.rs b/src/test/ui/impl-trait/cross-return-site-inference.rs index c27b5ca9f6689..a7428f9bf129f 100644 --- a/src/test/ui/impl-trait/cross-return-site-inference.rs +++ b/src/test/ui/impl-trait/cross-return-site-inference.rs @@ -29,17 +29,17 @@ fn baa(b: bool) -> impl std::fmt::Debug { } fn muh() -> Result<(), impl std::fmt::Debug> { - Err("whoops")?; //~ ERROR `?` couldn't convert the error to `impl Debug` + Err("whoops")?; //~^ ERROR type annotations needed Ok(()) } fn muh2() -> Result<(), impl std::fmt::Debug> { - return Err(From::from("foo")); //~ ERROR the trait bound `impl Debug: From<&str>` is not satisfied + return Err(From::from("foo")); //~^ ERROR type annotations needed Ok(()) } fn muh3() -> Result<(), impl std::fmt::Debug> { - Err(From::from("foo")) //~ ERROR the trait bound `impl Debug: From<&str>` is not satisfied + Err(From::from("foo")) //~^ ERROR type annotations needed } fn main() {} diff --git a/src/test/ui/impl-trait/cross-return-site-inference.stderr b/src/test/ui/impl-trait/cross-return-site-inference.stderr index 06afb938c5fad..5209d7a574349 100644 --- a/src/test/ui/impl-trait/cross-return-site-inference.stderr +++ b/src/test/ui/impl-trait/cross-return-site-inference.stderr @@ -1,26 +1,21 @@ -error[E0277]: `?` couldn't convert the error to `impl Debug` - --> $DIR/cross-return-site-inference.rs:32:18 +error[E0282]: type annotations needed + --> $DIR/cross-return-site-inference.rs:31:24 | LL | fn muh() -> Result<(), impl std::fmt::Debug> { - | -------------------------------- expected `impl Debug` because of this -LL | Err("whoops")?; - | ^ the trait `From<&str>` is not implemented for `impl Debug` - | - = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait - = note: required because of the requirements on the impl of `FromResidual>` for `Result<(), impl Debug>` + | ^^^^^^^^^^^^^^^^^^^^ cannot infer type -error[E0277]: the trait bound `impl Debug: From<&str>` is not satisfied - --> $DIR/cross-return-site-inference.rs:37:16 +error[E0282]: type annotations needed + --> $DIR/cross-return-site-inference.rs:36:25 | -LL | return Err(From::from("foo")); - | ^^^^^^^^^^ the trait `From<&str>` is not implemented for `impl Debug` +LL | fn muh2() -> Result<(), impl std::fmt::Debug> { + | ^^^^^^^^^^^^^^^^^^^^ cannot infer type -error[E0277]: the trait bound `impl Debug: From<&str>` is not satisfied - --> $DIR/cross-return-site-inference.rs:42:9 +error[E0282]: type annotations needed + --> $DIR/cross-return-site-inference.rs:41:25 | -LL | Err(From::from("foo")) - | ^^^^^^^^^^ the trait `From<&str>` is not implemented for `impl Debug` +LL | fn muh3() -> Result<(), impl std::fmt::Debug> { + | ^^^^^^^^^^^^^^^^^^^^ cannot infer type error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/impl-trait/fallback_inference.rs b/src/test/ui/impl-trait/fallback_inference.rs new file mode 100644 index 0000000000000..001f9ee487758 --- /dev/null +++ b/src/test/ui/impl-trait/fallback_inference.rs @@ -0,0 +1,7 @@ +use std::marker::PhantomData; + +fn weird() -> PhantomData { + PhantomData //~^ ERROR type annotations needed +} + +fn main() {} diff --git a/src/test/ui/impl-trait/fallback_inference.stderr b/src/test/ui/impl-trait/fallback_inference.stderr new file mode 100644 index 0000000000000..b637ca694c203 --- /dev/null +++ b/src/test/ui/impl-trait/fallback_inference.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/fallback_inference.rs:3:27 + | +LL | fn weird() -> PhantomData { + | ^^^^^^^^^^ cannot infer type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/impl-trait/issue-72911.rs b/src/test/ui/impl-trait/issue-72911.rs index cf2c8b7e41540..be9c643b2d881 100644 --- a/src/test/ui/impl-trait/issue-72911.rs +++ b/src/test/ui/impl-trait/issue-72911.rs @@ -5,7 +5,7 @@ pub struct Lint {} impl Lint {} pub fn gather_all() -> impl Iterator { - //~^ ERROR `()` is not an iterator + //~^ ERROR type annotations needed lint_files().flat_map(|f| gather_from_file(&f)) } diff --git a/src/test/ui/impl-trait/issue-72911.stderr b/src/test/ui/impl-trait/issue-72911.stderr index 4a990286d966d..fc7200c75c226 100644 --- a/src/test/ui/impl-trait/issue-72911.stderr +++ b/src/test/ui/impl-trait/issue-72911.stderr @@ -10,15 +10,13 @@ error[E0433]: failed to resolve: use of undeclared crate or module `foo` LL | fn lint_files() -> impl Iterator { | ^^^ use of undeclared crate or module `foo` -error[E0277]: `()` is not an iterator +error[E0282]: type annotations needed --> $DIR/issue-72911.rs:7:24 | LL | pub fn gather_all() -> impl Iterator { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator - | - = help: the trait `Iterator` is not implemented for `()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type error: aborting due to 3 previous errors -Some errors have detailed explanations: E0277, E0433. -For more information about an error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0282, E0433. +For more information about an error, try `rustc --explain E0282`. diff --git a/src/test/ui/impl-trait/issues/issue-67830.stderr b/src/test/ui/impl-trait/issues/issue-67830.stderr index 74e2f99cd33f9..4c0490c721bc4 100644 --- a/src/test/ui/impl-trait/issues/issue-67830.stderr +++ b/src/test/ui/impl-trait/issues/issue-67830.stderr @@ -1,12 +1,8 @@ error: implementation of `FnOnce` is not general enough - --> $DIR/issue-67830.rs:21:66 + --> $DIR/issue-67830.rs:21:14 | -LL | fn test() -> impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a> { - | __________________________________________________________________^ -LL | | -LL | | Wrap(|a| Some(a).into_iter()) -LL | | } - | |_^ implementation of `FnOnce` is not general enough +LL | fn test() -> impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | = note: closure with signature `fn(&'2 A) -> std::option::IntoIter<&A>` must implement `FnOnce<(&'1 A,)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&'2 A,)>`, for some specific lifetime `'2` diff --git a/src/test/ui/impl-trait/issues/issue-88236-2.stderr b/src/test/ui/impl-trait/issues/issue-88236-2.stderr index 45fadcab3f2e1..9574b880f7d11 100644 --- a/src/test/ui/impl-trait/issues/issue-88236-2.stderr +++ b/src/test/ui/impl-trait/issues/issue-88236-2.stderr @@ -8,15 +8,12 @@ LL | fn make_weird_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Sen = note: ...but `Hrtb<'1>` is actually implemented for the type `&'1 ()`, for some specific lifetime `'1` error: implementation of `Hrtb` is not general enough - --> $DIR/issue-88236-2.rs:19:82 + --> $DIR/issue-88236-2.rs:19:36 | -LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> { - | __________________________________________________________________________________^ -LL | | x -LL | | } - | |_^ implementation of `Hrtb` is not general enough +LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Hrtb` is not general enough | - = note: `&()` must implement `Hrtb<'0>`, for any lifetime `'0`... + = note: `Hrtb<'1>` would have to be implemented for the type `&()`, for any lifetime `'1`... = note: ...but `Hrtb<'_>` is actually implemented for the type `&()` error: aborting due to 2 previous errors diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr index 9589b69491e25..2f5e2d2b93071 100644 --- a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr +++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr @@ -80,7 +80,7 @@ LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32 | ++++ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/must_outlive_least_region_or_bound.rs:41:5 + --> $DIR/must_outlive_least_region_or_bound.rs:40:5 | LL | x | ^ diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.rs b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.rs index baa42da64468d..60e4672f1b7ff 100644 --- a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.rs +++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.rs @@ -37,7 +37,6 @@ fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { fn ty_param_wont_outlive_static(x: T) -> impl Debug + 'static { //~^ ERROR the parameter type `T` may not live long enough - //~| ERROR the parameter type `T` may not live long enough x } diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr index 1272adb35e98c..6bcfb27ce1653 100644 --- a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr +++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr @@ -132,19 +132,6 @@ LL | fn ty_param_wont_outlive_static(x: T) -> impl Debug + 'static { | | | help: consider adding an explicit lifetime bound...: `T: 'static +` -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/must_outlive_least_region_or_bound.rs:38:72 - | -LL | fn ty_param_wont_outlive_static(x: T) -> impl Debug + 'static { - | _________________________________--_____________________________________^ - | | | - | | help: consider adding an explicit lifetime bound...: `T: 'static +` -LL | | -LL | | -LL | | x -LL | | } - | |_^ ...so that the type `T` will meet its required lifetime bounds - error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement --> $DIR/must_outlive_least_region_or_bound.rs:16:50 | @@ -231,7 +218,7 @@ help: alternatively, add an explicit `'static` bound to this reference LL | fn explicit4<'a>(x: &'static i32) -> Box { Box::new(x) } | ~~~~~~~~~~~~ -error: aborting due to 14 previous errors +error: aborting due to 13 previous errors Some errors have detailed explanations: E0310, E0621, E0700, E0759. For more information about an error, try `rustc --explain E0310`. diff --git a/src/test/ui/impl-trait/nested-return-type2-tait.rs b/src/test/ui/impl-trait/nested-return-type2-tait.rs index f2217f699fbbd..a2a49c5535d3d 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait.rs +++ b/src/test/ui/impl-trait/nested-return-type2-tait.rs @@ -24,7 +24,6 @@ type Sendable = impl Send; // type does not implement `Duh`, even if its hidden type does. So we error out. fn foo() -> impl Trait { //~^ ERROR `Sendable: Duh` is not satisfied - //~| ERROR `Sendable: Duh` is not satisfied || 42 } diff --git a/src/test/ui/impl-trait/nested-return-type2-tait.stderr b/src/test/ui/impl-trait/nested-return-type2-tait.stderr index 776c06b20dfc2..6b8279775a0be 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait.stderr +++ b/src/test/ui/impl-trait/nested-return-type2-tait.stderr @@ -4,29 +4,12 @@ error[E0277]: the trait bound `Sendable: Duh` is not satisfied LL | fn foo() -> impl Trait { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Duh` is not implemented for `Sendable` | -note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait.rs:28:5: 28:10]` +note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait.rs:27:5: 27:10]` --> $DIR/nested-return-type2-tait.rs:14:31 | LL | impl R> Trait for F { | ^^^^^ ^ -error[E0277]: the trait bound `Sendable: Duh` is not satisfied - --> $DIR/nested-return-type2-tait.rs:25:42 - | -LL | fn foo() -> impl Trait { - | __________________________________________^ -LL | | -LL | | -LL | | || 42 -LL | | } - | |_^ the trait `Duh` is not implemented for `Sendable` - | -note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait.rs:28:5: 28:10]` - --> $DIR/nested-return-type2-tait.rs:14:31 - | -LL | impl R> Trait for F { - | ^^^^^ ^ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/impl-trait/type_parameters_captured.nll.stderr b/src/test/ui/impl-trait/type_parameters_captured.nll.stderr index b1175a5952e59..9dd763d443e5e 100644 --- a/src/test/ui/impl-trait/type_parameters_captured.nll.stderr +++ b/src/test/ui/impl-trait/type_parameters_captured.nll.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/type_parameters_captured.rs:10:5 + --> $DIR/type_parameters_captured.rs:9:5 | LL | x | ^ diff --git a/src/test/ui/impl-trait/type_parameters_captured.rs b/src/test/ui/impl-trait/type_parameters_captured.rs index bb9cab742a58f..6c9c9d4a42af5 100644 --- a/src/test/ui/impl-trait/type_parameters_captured.rs +++ b/src/test/ui/impl-trait/type_parameters_captured.rs @@ -6,7 +6,6 @@ impl Any for T {} // Check that type parameters are captured and not considered 'static fn foo(x: T) -> impl Any + 'static { //~^ ERROR the parameter type `T` may not live long enough - //~| ERROR the parameter type `T` may not live long enough x } diff --git a/src/test/ui/impl-trait/type_parameters_captured.stderr b/src/test/ui/impl-trait/type_parameters_captured.stderr index c4ca34a6ed39b..40e50b9922f8d 100644 --- a/src/test/ui/impl-trait/type_parameters_captured.stderr +++ b/src/test/ui/impl-trait/type_parameters_captured.stderr @@ -6,19 +6,6 @@ LL | fn foo(x: T) -> impl Any + 'static { | | | help: consider adding an explicit lifetime bound...: `T: 'static` -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/type_parameters_captured.rs:7:39 - | -LL | fn foo(x: T) -> impl Any + 'static { - | ________-______________________________^ - | | | - | | help: consider adding an explicit lifetime bound...: `T: 'static` -LL | | -LL | | -LL | | x -LL | | } - | |_^ ...so that the type `T` will meet its required lifetime bounds - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/impl-trait/where-allowed-2.rs b/src/test/ui/impl-trait/where-allowed-2.rs index d5a87b5d46834..1a1210d00726d 100644 --- a/src/test/ui/impl-trait/where-allowed-2.rs +++ b/src/test/ui/impl-trait/where-allowed-2.rs @@ -1,7 +1,6 @@ use std::fmt::Debug; -// check-pass - fn in_adt_in_return() -> Vec { panic!() } +//~^ ERROR type annotations needed fn main() {} diff --git a/src/test/ui/impl-trait/where-allowed-2.stderr b/src/test/ui/impl-trait/where-allowed-2.stderr new file mode 100644 index 0000000000000..2b328c01c8729 --- /dev/null +++ b/src/test/ui/impl-trait/where-allowed-2.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/where-allowed-2.rs:3:30 + | +LL | fn in_adt_in_return() -> Vec { panic!() } + | ^^^^^^^^^^ cannot infer type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/issues-71798.rs b/src/test/ui/issues-71798.rs index fde59f39b1cd9..14b6c0f35812f 100644 --- a/src/test/ui/issues-71798.rs +++ b/src/test/ui/issues-71798.rs @@ -1,6 +1,5 @@ fn test_ref(x: &u32) -> impl std::future::Future + '_ { //~^ ERROR `u32` is not a future - //~| ERROR `u32` is not a future *x } diff --git a/src/test/ui/issues-71798.stderr b/src/test/ui/issues-71798.stderr index 63669c0513d64..ab72c3e41af97 100644 --- a/src/test/ui/issues-71798.stderr +++ b/src/test/ui/issues-71798.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `u` in this scope - --> $DIR/issues-71798.rs:8:24 + --> $DIR/issues-71798.rs:7:24 | LL | let _ = test_ref & u; | ^ not found in this scope @@ -13,21 +13,7 @@ LL | fn test_ref(x: &u32) -> impl std::future::Future + '_ { = help: the trait `Future` is not implemented for `u32` = note: u32 must be a future or must implement `IntoFuture` to be awaited -error[E0277]: `u32` is not a future - --> $DIR/issues-71798.rs:1:69 - | -LL | fn test_ref(x: &u32) -> impl std::future::Future + '_ { - | _____________________________________________________________________^ -LL | | -LL | | -LL | | *x -LL | | } - | |_^ `u32` is not a future - | - = help: the trait `Future` is not implemented for `u32` - = note: u32 must be a future or must implement `IntoFuture` to be awaited - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0425. For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs index 133679f30f8fb..5168cb20d9ec4 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs @@ -7,7 +7,6 @@ use std::error::Error; fn foo() -> impl Future> { //~^ ERROR not satisfied - //~| ERROR not satisfied Ok(()) } diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr index a3badd7b25add..ef1127c59ac4c 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr @@ -4,17 +4,6 @@ error[E0277]: the trait bound `Result<(), _>: Future` is not satisfied LL | fn foo() -> impl Future> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Future` is not implemented for `Result<(), _>` -error[E0277]: the trait bound `Result<(), _>: Future` is not satisfied - --> $DIR/lifetime-elision-return-type-trait.rs:8:56 - | -LL | fn foo() -> impl Future> { - | ________________________________________________________^ -LL | | -LL | | -LL | | Ok(()) -LL | | } - | |_^ the trait `Future` is not implemented for `Result<(), _>` - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.rs b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.rs index cad7d76c6ab5f..e72a2d8ccc629 100644 --- a/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.rs +++ b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.rs @@ -2,7 +2,6 @@ trait Bar {} impl Bar for u8 {} fn foo() -> impl Bar { 5; //~^ ERROR the trait bound `(): Bar` is not satisfied - //~| ERROR the trait bound `(): Bar` is not satisfied } fn main() {} diff --git a/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr index ba6967e78e163..d826222a06ae5 100644 --- a/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr +++ b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr @@ -6,16 +6,6 @@ LL | fn foo() -> impl Bar { LL | 5; | - consider removing this semicolon -error[E0277]: the trait bound `(): Bar` is not satisfied - --> $DIR/impl-trait-return-trailing-semicolon.rs:3:22 - | -LL | fn foo() -> impl Bar { - | ______________________^ -LL | | 5; -LL | | -LL | | } - | |_^ the trait `Bar` is not implemented for `()` - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/issue-81098.rs b/src/test/ui/suggestions/issue-81098.rs index 7ca7380a7befd..a601b5866f43e 100644 --- a/src/test/ui/suggestions/issue-81098.rs +++ b/src/test/ui/suggestions/issue-81098.rs @@ -1,14 +1,12 @@ // Don't suggest removing a semicolon if the last statement isn't an expression with semicolon // (#81098) fn wat() -> impl core::fmt::Display { //~ ERROR: `()` doesn't implement `std::fmt::Display` - //~^ ERROR: `()` doesn't implement `std::fmt::Display` fn why() {} } // Do it if the last statement is an expression with semicolon // (#54771) fn ok() -> impl core::fmt::Display { //~ ERROR: `()` doesn't implement `std::fmt::Display` - //~^ ERROR: `()` doesn't implement `std::fmt::Display` 1; } diff --git a/src/test/ui/suggestions/issue-81098.stderr b/src/test/ui/suggestions/issue-81098.stderr index d62526442e9af..2a72159e5774b 100644 --- a/src/test/ui/suggestions/issue-81098.stderr +++ b/src/test/ui/suggestions/issue-81098.stderr @@ -8,43 +8,16 @@ LL | fn wat() -> impl core::fmt::Display { = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead error[E0277]: `()` doesn't implement `std::fmt::Display` - --> $DIR/issue-81098.rs:3:37 - | -LL | fn wat() -> impl core::fmt::Display { - | _____________________________________^ -LL | | -LL | | fn why() {} -LL | | } - | |_^ `()` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `()` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead - -error[E0277]: `()` doesn't implement `std::fmt::Display` - --> $DIR/issue-81098.rs:10:12 + --> $DIR/issue-81098.rs:9:12 | LL | fn ok() -> impl core::fmt::Display { | ^^^^^^^^^^^^^^^^^^^^^^^ `()` cannot be formatted with the default formatter -LL | LL | 1; | - consider removing this semicolon | = help: the trait `std::fmt::Display` is not implemented for `()` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -error[E0277]: `()` doesn't implement `std::fmt::Display` - --> $DIR/issue-81098.rs:10:36 - | -LL | fn ok() -> impl core::fmt::Display { - | ____________________________________^ -LL | | -LL | | 1; -LL | | } - | |_^ `()` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `()` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.nll.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.nll.stderr new file mode 100644 index 0000000000000..916a6c2bf12af --- /dev/null +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.nll.stderr @@ -0,0 +1,11 @@ +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/missing-lifetimes-in-signature.rs:36:11 + | +LL | fn baz(g: G, dest: &mut T) -> impl FnOnce() + '_ + | - ^^ undeclared lifetime + | | + | help: consider introducing lifetime `'a` here: `'a,` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0261`. diff --git a/src/test/ui/type-alias-impl-trait/nested-tait-inference.rs b/src/test/ui/type-alias-impl-trait/nested-tait-inference.rs index 314e5362a8f2c..82248971692ce 100644 --- a/src/test/ui/type-alias-impl-trait/nested-tait-inference.rs +++ b/src/test/ui/type-alias-impl-trait/nested-tait-inference.rs @@ -11,7 +11,6 @@ impl Foo<()> for () { } fn foo() -> impl Foo { //~^ ERROR: the trait bound `(): Foo` is not satisfied - //~| ERROR: the trait bound `(): Foo` is not satisfied // FIXME(type-alias-impl-trait): We could probably make this work. () } diff --git a/src/test/ui/type-alias-impl-trait/nested-tait-inference.stderr b/src/test/ui/type-alias-impl-trait/nested-tait-inference.stderr index eb72e88769100..6d744e9568c8d 100644 --- a/src/test/ui/type-alias-impl-trait/nested-tait-inference.stderr +++ b/src/test/ui/type-alias-impl-trait/nested-tait-inference.stderr @@ -7,21 +7,6 @@ LL | fn foo() -> impl Foo { = help: the following implementations were found: <() as Foo<()>> -error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/nested-tait-inference.rs:12:28 - | -LL | fn foo() -> impl Foo { - | ____________________________^ -LL | | -LL | | -LL | | // FIXME(type-alias-impl-trait): We could probably make this work. -LL | | () -LL | | } - | |_^ the trait `Foo` is not implemented for `()` - | - = help: the following implementations were found: - <() as Foo<()>> - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.rs b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.rs index 4dc30d9257bed..0d7f5bad25f11 100644 --- a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.rs +++ b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.rs @@ -12,7 +12,6 @@ impl Foo for () {} fn foo() -> impl Foo { //~^ ERROR: the trait bound `(): Foo` is not satisfied - //~| ERROR: the trait bound `(): Foo` is not satisfied () } diff --git a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr index 1372a018667c2..34d100951bed9 100644 --- a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr +++ b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr @@ -8,21 +8,6 @@ LL | fn foo() -> impl Foo { <() as Foo<()>> <() as Foo> -error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/nested-tait-inference2.rs:13:28 - | -LL | fn foo() -> impl Foo { - | ____________________________^ -LL | | -LL | | -LL | | () -LL | | } - | |_^ the trait `Foo` is not implemented for `()` - | - = help: the following implementations were found: - <() as Foo<()>> - <() as Foo> - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`.