diff --git a/compiler/rustc_hir_analysis/src/check/intrinsic.rs b/compiler/rustc_hir_analysis/src/check/intrinsic.rs index 7ea21b24fc821..8bcdd44ccbedd 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsic.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsic.rs @@ -138,6 +138,7 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) { let name_str = intrinsic_name.as_str(); let bound_vars = tcx.mk_bound_variable_kinds(&[ + ty::BoundVariableKind::Region(ty::BrAnon), ty::BoundVariableKind::Region(ty::BrAnon), ty::BoundVariableKind::Region(ty::BrEnv), ]); @@ -151,7 +152,7 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) { let env_region = ty::Region::new_bound( tcx, ty::INNERMOST, - ty::BoundRegion { var: ty::BoundVar::from_u32(1), kind: ty::BrEnv }, + ty::BoundRegion { var: ty::BoundVar::from_u32(2), kind: ty::BrEnv }, ); let va_list_ty = tcx.type_of(did).instantiate(tcx, &[region.into()]); (Ty::new_ref(tcx, env_region, ty::TypeAndMut { ty: va_list_ty, mutbl }), va_list_ty) @@ -446,9 +447,12 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) { sym::raw_eq => { let br = ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon }; - let param_ty = + let param_ty_lhs = + Ty::new_imm_ref(tcx, ty::Region::new_bound(tcx, ty::INNERMOST, br), param(0)); + let br = ty::BoundRegion { var: ty::BoundVar::from_u32(1), kind: ty::BrAnon }; + let param_ty_rhs = Ty::new_imm_ref(tcx, ty::Region::new_bound(tcx, ty::INNERMOST, br), param(0)); - (1, vec![param_ty; 2], tcx.types.bool) + (1, vec![param_ty_lhs, param_ty_rhs], tcx.types.bool) } sym::black_box => (1, vec![param(0)], param(0)), diff --git a/compiler/rustc_infer/src/infer/equate.rs b/compiler/rustc_infer/src/infer/equate.rs index 5d929394eb04c..b33cdd1e35e3b 100644 --- a/compiler/rustc_infer/src/infer/equate.rs +++ b/compiler/rustc_infer/src/infer/equate.rs @@ -4,10 +4,11 @@ use crate::traits::PredicateObligations; use super::combine::{CombineFields, ObligationEmittingRelation}; use super::Subtype; +use rustc_middle::ty::error::TypeError; use rustc_middle::ty::relate::{self, Relate, RelateResult, TypeRelation}; use rustc_middle::ty::GenericArgsRef; use rustc_middle::ty::TyVar; -use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt}; +use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_hir::def_id::DefId; @@ -164,14 +165,18 @@ impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> { return Ok(a); } - if a.skip_binder().has_escaping_bound_vars() || b.skip_binder().has_escaping_bound_vars() { - self.fields.higher_ranked_sub(a, b, self.a_is_expected)?; - self.fields.higher_ranked_sub(b, a, self.a_is_expected)?; + let a = self.tcx().anonymize_bound_vars(a); + let b = self.tcx().anonymize_bound_vars(b); + + if a.bound_vars() == b.bound_vars() { + let (a, b) = self + .fields + .infcx + .instantiate_binder_with_placeholders(a.map_bound(|a| (a, b.skip_binder()))); + Ok(ty::Binder::dummy(self.relate(a, b)?)) } else { - // Fast path for the common case. - self.relate(a.skip_binder(), b.skip_binder())?; + Err(TypeError::Mismatch) } - Ok(a) } } diff --git a/tests/ui/associated-inherent-types/issue-109789.rs b/tests/ui/associated-inherent-types/issue-109789.rs index 0b5ba7d1fb55d..b1402c26e1f60 100644 --- a/tests/ui/associated-inherent-types/issue-109789.rs +++ b/tests/ui/associated-inherent-types/issue-109789.rs @@ -16,7 +16,6 @@ impl Other for u32 {} // `try_report_trait_placeholder_mismatch`. fn bar(_: Foo fn(&'a ())>::Assoc) {} -//~^ ERROR mismatched types -//~| ERROR mismatched types +//~^ ERROR associated type `Assoc` not found for `Foo fn(&'a ())>` in the current scope [E0220] fn main() {} diff --git a/tests/ui/associated-inherent-types/issue-109789.stderr b/tests/ui/associated-inherent-types/issue-109789.stderr index e844f6795e6f8..415d774b85fa1 100644 --- a/tests/ui/associated-inherent-types/issue-109789.stderr +++ b/tests/ui/associated-inherent-types/issue-109789.stderr @@ -1,22 +1,15 @@ -error[E0308]: mismatched types - --> $DIR/issue-109789.rs:18:11 +error[E0220]: associated type `Assoc` not found for `Foo fn(&'a ())>` in the current scope + --> $DIR/issue-109789.rs:18:36 | +LL | struct Foo(T); + | ------------- associated item `Assoc` not found for this struct +... LL | fn bar(_: Foo fn(&'a ())>::Assoc) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^ associated item not found in `Foo fn(&'a ())>` | - = note: expected struct `Foo` - found struct `Foo fn(&'a ())>` + = note: the associated type was found for + - `Foo` -error[E0308]: mismatched types - --> $DIR/issue-109789.rs:18:11 - | -LL | fn bar(_: Foo fn(&'a ())>::Assoc) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected struct `Foo` - found struct `Foo fn(&'a ())>` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0220`. diff --git a/tests/ui/associated-inherent-types/issue-111404-1.stderr b/tests/ui/associated-inherent-types/issue-111404-1.stderr index c55f1432389c7..b39b716977977 100644 --- a/tests/ui/associated-inherent-types/issue-111404-1.stderr +++ b/tests/ui/associated-inherent-types/issue-111404-1.stderr @@ -1,8 +1,33 @@ +error[E0220]: associated type `Assoc` not found for `Foo fn(&'b ())>` in the current scope + --> $DIR/issue-111404-1.rs:10:55 + | +LL | struct Foo(T); + | ------------- associated item `Assoc` not found for this struct +... +LL | fn bar(_: fn(Foo fn(Foo::Assoc)>::Assoc)) {} +<<<<<<< HEAD + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error +||||||| parent of 9bb25a65025 (Make type equality != bidirectional subtyping) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: higher-ranked subtype error --> $DIR/issue-111404-1.rs:10:1 | LL | fn bar(_: fn(Foo fn(Foo::Assoc)>::Assoc)) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors +======= + | ^^^^^ associated item not found in `Foo fn(&'b ())>` + | + = note: the associated type was found for + - `Foo` error: aborting due to previous error +>>>>>>> 9bb25a65025 (Make type equality != bidirectional subtyping) +For more information about this error, try `rustc --explain E0220`. diff --git a/tests/ui/closure-expected-type/expect-fn-supply-fn.rs b/tests/ui/closure-expected-type/expect-fn-supply-fn.rs index 7f1c140279c4e..6f7f69eed6a47 100644 --- a/tests/ui/closure-expected-type/expect-fn-supply-fn.rs +++ b/tests/ui/closure-expected-type/expect-fn-supply-fn.rs @@ -14,8 +14,6 @@ fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { // Here, the type given for `'x` "obscures" a region from the // expected signature that is bound at closure level. with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); - //~^ ERROR lifetime may not live long enough - //~| ERROR lifetime may not live long enough } fn expect_free_supply_free_from_closure() { @@ -30,14 +28,14 @@ fn expect_free_supply_bound() { // Here, we are given a function whose region is bound at closure level, // but we expect one bound in the argument. Error results. with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); - //~^ ERROR mismatched types + //~^ ERROR type mismatch in closure arguments } fn expect_bound_supply_free_from_fn<'x>(x: &'x u32) { // Here, we are given a `fn(&u32)` but we expect a `fn(&'x // u32)`. In principle, this could be ok, but we demand equality. with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); - //~^ ERROR mismatched types + //~^ ERROR type mismatch in closure arguments } fn expect_bound_supply_free_from_closure() { @@ -46,7 +44,7 @@ fn expect_bound_supply_free_from_closure() { // the argument level. type Foo<'a> = fn(&'a u32); with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { - //~^ ERROR mismatched types + //~^ ERROR type mismatch in closure arguments }); } diff --git a/tests/ui/closure-expected-type/expect-fn-supply-fn.stderr b/tests/ui/closure-expected-type/expect-fn-supply-fn.stderr index e6ddc60689779..5563ae242d65b 100644 --- a/tests/ui/closure-expected-type/expect-fn-supply-fn.stderr +++ b/tests/ui/closure-expected-type/expect-fn-supply-fn.stderr @@ -1,51 +1,72 @@ -error: lifetime may not live long enough - --> $DIR/expect-fn-supply-fn.rs:16:49 - | -LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { - | -- lifetime `'x` defined here -... -LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); - | ^ - | | - | has type `fn(&'1 u32)` - | requires that `'1` must outlive `'x` - -error: lifetime may not live long enough - --> $DIR/expect-fn-supply-fn.rs:16:49 - | -LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { - | -- lifetime `'x` defined here -... -LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); - | ^ requires that `'x` must outlive `'static` - -error[E0308]: mismatched types - --> $DIR/expect-fn-supply-fn.rs:32:49 +error[E0631]: type mismatch in closure arguments + --> $DIR/expect-fn-supply-fn.rs:30:5 | LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); - | ^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature defined here + | | + | expected due to this + | + = note: expected closure signature `for<'a, 'b> fn(for<'a> fn(&'a u32), &'b i32) -> _` + found closure signature `fn(for<'a> fn(&'a u32), _) -> _` +note: required by a bound in `with_closure_expecting_fn_with_free_region` + --> $DIR/expect-fn-supply-fn.rs:3:8 + | +LL | fn with_closure_expecting_fn_with_free_region(_: F) + | ------------------------------------------ required by a bound in this function +LL | where +LL | F: for<'a> FnOnce(fn(&'a u32), &i32), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_free_region` +help: consider adjusting the signature so it borrows its argument | - = note: expected fn pointer `fn(&u32)` - found fn pointer `for<'a> fn(&'a u32)` +LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), &y| {}); + | + -error[E0308]: mismatched types - --> $DIR/expect-fn-supply-fn.rs:39:50 +error[E0631]: type mismatch in closure arguments + --> $DIR/expect-fn-supply-fn.rs:37:5 | LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); - | ^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature defined here + | | + | expected due to this | - = note: expected fn pointer `for<'a> fn(&'a u32)` - found fn pointer `fn(&u32)` + = note: expected closure signature `for<'a> fn(for<'a> fn(&'a u32), &'a i32) -> _` + found closure signature `fn(fn(&'x u32), _) -> _` +note: required by a bound in `with_closure_expecting_fn_with_bound_region` + --> $DIR/expect-fn-supply-fn.rs:9:8 + | +LL | fn with_closure_expecting_fn_with_bound_region(_: F) + | ------------------------------------------- required by a bound in this function +LL | where +LL | F: FnOnce(fn(&u32), &i32), + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_bound_region` +help: consider adjusting the signature so it borrows its argument + | +LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), &y| {}); + | + -error[E0308]: mismatched types - --> $DIR/expect-fn-supply-fn.rs:48:50 +error[E0631]: type mismatch in closure arguments + --> $DIR/expect-fn-supply-fn.rs:46:5 | LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { - | ^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- found signature defined here + | | + | expected due to this + | + = note: expected closure signature `for<'a> fn(for<'a> fn(&'a u32), &'a i32) -> _` + found closure signature `for<'a> fn(for<'a> fn(&'a u32), _) -> _` +note: required by a bound in `with_closure_expecting_fn_with_bound_region` + --> $DIR/expect-fn-supply-fn.rs:9:8 + | +LL | fn with_closure_expecting_fn_with_bound_region(_: F) + | ------------------------------------------- required by a bound in this function +LL | where +LL | F: FnOnce(fn(&u32), &i32), + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_bound_region` +help: consider adjusting the signature so it borrows its argument | - = note: expected fn pointer `for<'a> fn(&'a u32)` - found fn pointer `fn(&u32)` +LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, &y| { + | + -error: aborting due to 5 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0631`. diff --git a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs index 99f805f7f0f63..6eab905d9eee3 100644 --- a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs +++ b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs @@ -10,12 +10,14 @@ // * true if `exists<'r> { 'r: 'static }` (obviously true) // * `fn(fn(&'static u32)) <: for<'r> fn(fn(&'r u32))` // * true if `forall<'r> { 'static: 'r }` (also true) +// +// check-pass + trait Trait {} impl Trait for for<'r> fn(fn(&'r ())) {} impl<'a> Trait for fn(fn(&'a ())) {} -//~^ ERROR conflicting implementations // // Note in particular that we do NOT get a future-compatibility warning // here. This is because the new leak-check proposed in [MCP 295] does not diff --git a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr deleted file mode 100644 index 7dabd97b94e82..0000000000000 --- a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0119]: conflicting implementations of trait `Trait` for type `for<'r> fn(fn(&'r ()))` - --> $DIR/coherence-fn-covariant-bound-vs-static.rs:17:1 - | -LL | impl Trait for for<'r> fn(fn(&'r ())) {} - | ------------------------------------- first implementation here -LL | impl<'a> Trait for fn(fn(&'a ())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'r> fn(fn(&'r ()))` - | - = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-fn-implied-bounds.rs b/tests/ui/coherence/coherence-fn-implied-bounds.rs index 4539af9a32e38..5252132a4ad22 100644 --- a/tests/ui/coherence/coherence-fn-implied-bounds.rs +++ b/tests/ui/coherence/coherence-fn-implied-bounds.rs @@ -11,16 +11,12 @@ // Note that while we would like to make this a hard error, we also // give the same warning for `coherence-wasm-bindgen.rs`, which ought // to be accepted. - -#![deny(coherence_leak_check)] - +// +// check-pass trait Trait {} impl Trait for for<'a, 'b> fn(&'a &'b u32, &'b &'a u32) -> &'b u32 {} -impl Trait for for<'c> fn(&'c &'c u32, &'c &'c u32) -> &'c u32 { - //~^ ERROR conflicting implementations - //~| WARNING this was previously accepted by the compiler -} +impl Trait for for<'c> fn(&'c &'c u32, &'c &'c u32) -> &'c u32 {} fn main() {} diff --git a/tests/ui/coherence/coherence-fn-implied-bounds.stderr b/tests/ui/coherence/coherence-fn-implied-bounds.stderr deleted file mode 100644 index 2018712043e23..0000000000000 --- a/tests/ui/coherence/coherence-fn-implied-bounds.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: conflicting implementations of trait `Trait` for type `for<'a, 'b> fn(&'a &'b u32, &'b &'a u32) -> &'b u32` - --> $DIR/coherence-fn-implied-bounds.rs:21:1 - | -LL | impl Trait for for<'a, 'b> fn(&'a &'b u32, &'b &'a u32) -> &'b u32 {} - | ------------------------------------------------------------------ first implementation here -LL | -LL | impl Trait for for<'c> fn(&'c &'c u32, &'c &'c u32) -> &'c u32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a &'b u32, &'b &'a u32) -> &'b u32` - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #56105 - = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details -note: the lint level is defined here - --> $DIR/coherence-fn-implied-bounds.rs:15:9 - | -LL | #![deny(coherence_leak_check)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/coherence/coherence-fn-inputs.rs b/tests/ui/coherence/coherence-fn-inputs.rs index 3afec5c5459af..5fcdb585c8156 100644 --- a/tests/ui/coherence/coherence-fn-inputs.rs +++ b/tests/ui/coherence/coherence-fn-inputs.rs @@ -9,17 +9,11 @@ // // * `'c` can be the intersection of `'a` and `'b` (and there is always an intersection) // * `'a` and `'b` can both be equal to `'c` +// +// check-pass trait Trait {} impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {} -impl Trait for for<'c> fn(&'c u32, &'c u32) { - //~^ ERROR conflicting implementations - // - // Note in particular that we do NOT get a future-compatibility warning - // here. This is because the new leak-check proposed in [MCP 295] does not - // "error" when these two types are equated. - // - // [MCP 295]: https://github.com/rust-lang/compiler-team/issues/295 -} +impl Trait for for<'c> fn(&'c u32, &'c u32) {} fn main() {} diff --git a/tests/ui/coherence/coherence-fn-inputs.stderr b/tests/ui/coherence/coherence-fn-inputs.stderr deleted file mode 100644 index 82bd8a35f4575..0000000000000 --- a/tests/ui/coherence/coherence-fn-inputs.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0119]: conflicting implementations of trait `Trait` for type `for<'a, 'b> fn(&'a u32, &'b u32)` - --> $DIR/coherence-fn-inputs.rs:15:1 - | -LL | impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {} - | ----------------------------------------------- first implementation here -LL | impl Trait for for<'c> fn(&'c u32, &'c u32) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u32, &'b u32)` - | - = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-free-vs-bound-region.rs b/tests/ui/coherence/coherence-free-vs-bound-region.rs index 2f5c49d293d5d..ac01e09a1508d 100644 --- a/tests/ui/coherence/coherence-free-vs-bound-region.rs +++ b/tests/ui/coherence/coherence-free-vs-bound-region.rs @@ -1,11 +1,12 @@ // Capture a coherence pattern from wasm-bindgen that we discovered as part of -// future-compatibility warning #56105. This pattern currently receives a lint -// warning but we probably want to support it long term. +// future-compatibility warning #56105. // // Key distinction: we are implementing once for `A` (take ownership) and one // for `&A` (borrow). // // c.f. #56105 +// +// check-pass #![deny(coherence_leak_check)] @@ -13,9 +14,6 @@ trait TheTrait {} impl<'a> TheTrait for fn(&'a u8) {} -impl TheTrait for fn(&u8) { - //~^ ERROR conflicting implementations of trait - //~| WARNING this was previously accepted by the compiler -} +impl TheTrait for fn(&u8) {} fn main() {} diff --git a/tests/ui/coherence/coherence-free-vs-bound-region.stderr b/tests/ui/coherence/coherence-free-vs-bound-region.stderr deleted file mode 100644 index e2d84b833200c..0000000000000 --- a/tests/ui/coherence/coherence-free-vs-bound-region.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: conflicting implementations of trait `TheTrait` for type `fn(&u8)` - --> $DIR/coherence-free-vs-bound-region.rs:16:1 - | -LL | impl<'a> TheTrait for fn(&'a u8) {} - | -------------------------------- first implementation here -LL | -LL | impl TheTrait for fn(&u8) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `fn(&u8)` - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #56105 - = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details -note: the lint level is defined here - --> $DIR/coherence-free-vs-bound-region.rs:10:9 - | -LL | #![deny(coherence_leak_check)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/coherence/coherence-inherited-subtyping.rs b/tests/ui/coherence/coherence-inherited-subtyping.rs index f35cd2103da4a..69f5ea584ebbe 100644 --- a/tests/ui/coherence/coherence-inherited-subtyping.rs +++ b/tests/ui/coherence/coherence-inherited-subtyping.rs @@ -3,13 +3,14 @@ // // Note: This scenario is currently accepted, but as part of the // universe transition (#56105) may eventually become an error. - +// +// check-pass struct Foo { t: T, } impl Foo fn(&'a u8, &'b u8) -> &'a u8> { - fn method1(&self) {} //~ ERROR duplicate definitions with name `method1` + fn method1(&self) {} } impl Foo fn(&'a u8, &'a u8) -> &'a u8> { diff --git a/tests/ui/coherence/coherence-inherited-subtyping.stderr b/tests/ui/coherence/coherence-inherited-subtyping.stderr deleted file mode 100644 index f60b2aa2735d5..0000000000000 --- a/tests/ui/coherence/coherence-inherited-subtyping.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0592]: duplicate definitions with name `method1` - --> $DIR/coherence-inherited-subtyping.rs:12:5 - | -LL | fn method1(&self) {} - | ^^^^^^^^^^^^^^^^^ duplicate definitions for `method1` -... -LL | fn method1(&self) {} - | ----------------- other definition for `method1` - | - = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0592`. diff --git a/tests/ui/coherence/coherence-subtyping.rs b/tests/ui/coherence/coherence-subtyping.rs index b3ed728a81c06..78974b6972a71 100644 --- a/tests/ui/coherence/coherence-subtyping.rs +++ b/tests/ui/coherence/coherence-subtyping.rs @@ -3,7 +3,6 @@ // // Note: This scenario is currently accepted, but as part of the // universe transition (#56105) may eventually become an error. - // check-pass trait TheTrait { @@ -12,9 +11,6 @@ trait TheTrait { impl TheTrait for for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8 {} -impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { - //~^ WARNING conflicting implementation - //~^^ WARNING this was previously accepted by the compiler but is being phased out -} +impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {} fn main() {} diff --git a/tests/ui/coherence/coherence-subtyping.stderr b/tests/ui/coherence/coherence-subtyping.stderr deleted file mode 100644 index 9d90019a50fd3..0000000000000 --- a/tests/ui/coherence/coherence-subtyping.stderr +++ /dev/null @@ -1,16 +0,0 @@ -warning: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` - --> $DIR/coherence-subtyping.rs:15:1 - | -LL | impl TheTrait for for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8 {} - | ---------------------------------------------------------- first implementation here -LL | -LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #56105 - = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details - = note: `#[warn(coherence_leak_check)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/coherence/coherence-wasm-bindgen.rs b/tests/ui/coherence/coherence-wasm-bindgen.rs index ee09a72449be1..1de8b8c30fe0e 100644 --- a/tests/ui/coherence/coherence-wasm-bindgen.rs +++ b/tests/ui/coherence/coherence-wasm-bindgen.rs @@ -6,6 +6,8 @@ // for `&A` (borrow). // // c.f. #56105 +// +// check-pass #![deny(coherence_leak_check)] @@ -29,9 +31,6 @@ impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn for<'x> Fn(&'x A) -> R + 'b) where A: RefFromWasmAbi, R: ReturnWasmAbi, -{ - //~^^^^^ ERROR conflicting implementation - //~| WARNING this was previously accepted -} +{} fn main() {} diff --git a/tests/ui/coherence/coherence-wasm-bindgen.stderr b/tests/ui/coherence/coherence-wasm-bindgen.stderr deleted file mode 100644 index 600cd42d8c69d..0000000000000 --- a/tests/ui/coherence/coherence-wasm-bindgen.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error: conflicting implementations of trait `IntoWasmAbi` for type `&dyn Fn(&_) -> _` - --> $DIR/coherence-wasm-bindgen.rs:28:1 - | -LL | / impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(A) -> R + 'b) -LL | | where -LL | | A: FromWasmAbi, -LL | | R: ReturnWasmAbi, - | |_____________________- first implementation here -... -LL | / impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn for<'x> Fn(&'x A) -> R + 'b) -LL | | where -LL | | A: RefFromWasmAbi, -LL | | R: ReturnWasmAbi, - | |_____________________^ conflicting implementation for `&dyn Fn(&_) -> _` - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #56105 - = note: downstream crates may implement trait `FromWasmAbi` for type `&_` - = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details -note: the lint level is defined here - --> $DIR/coherence-wasm-bindgen.rs:10:9 - | -LL | #![deny(coherence_leak_check)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.explicit.stderr b/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.explicit.stderr deleted file mode 100644 index 34f3904443c31..0000000000000 --- a/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.explicit.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error: conflicting implementations of trait `FnMarker` for type `fn(&_)` - --> $DIR/negative-coherence-placeholder-region-constraints-on-unification.rs:21:1 - | -LL | impl FnMarker for fn(T) {} - | ------------------------------------------- first implementation here -LL | impl FnMarker for fn(&T) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `fn(&_)` - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #56105 - = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details -note: the lint level is defined here - --> $DIR/negative-coherence-placeholder-region-constraints-on-unification.rs:4:11 - | -LL | #![forbid(coherence_leak_check)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.rs b/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.rs index 26d9d84d8f0c9..22d085273901e 100644 --- a/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.rs +++ b/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.rs @@ -1,5 +1,5 @@ // revisions: explicit implicit -//[implicit] check-pass +// check-pass #![forbid(coherence_leak_check)] #![feature(negative_impls, with_negative_coherence)] @@ -19,7 +19,5 @@ trait FnMarker {} // as an assumption when proving `&'!0 T: Marker`... impl FnMarker for fn(T) {} impl FnMarker for fn(&T) {} -//[explicit]~^ ERROR conflicting implementations of trait `FnMarker` for type `fn(&_)` -//[explicit]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr b/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr index 8cbd12654480a..77f93774f978b 100644 --- a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr +++ b/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr @@ -7,5 +7,12 @@ LL | WHAT_A_TYPE => 0, = note: the traits must be derived, manual `impl`s are not sufficient = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details -error: aborting due to previous error +error[E0277]: the trait bound `for<'a, 'b> fn(&'a (), &'b ()): WithAssoc` is not satisfied + --> $DIR/typeid-equality-by-subtyping.rs:44:51 + | +LL | fn unsound(x: >::Assoc) -> >::Assoc + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `WithAssoc` is not implemented for `for<'a, 'b> fn(&'a (), &'b ())` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/const-generics/invariant.rs b/tests/ui/const-generics/invariant.rs index 39d658be67d40..fb041b141bddd 100644 --- a/tests/ui/const-generics/invariant.rs +++ b/tests/ui/const-generics/invariant.rs @@ -12,8 +12,6 @@ impl SadBee for for<'a> fn(&'a ()) { const ASSOC: usize = 0; } impl SadBee for fn(&'static ()) { - //~^ WARNING conflicting implementations of trait - //~| WARNING this was previously accepted const ASSOC: usize = 100; } diff --git a/tests/ui/const-generics/invariant.stderr b/tests/ui/const-generics/invariant.stderr index aabe4c93b3624..06fcc84287469 100644 --- a/tests/ui/const-generics/invariant.stderr +++ b/tests/ui/const-generics/invariant.stderr @@ -1,26 +1,14 @@ -warning: conflicting implementations of trait `SadBee` for type `for<'a> fn(&'a ())` - --> $DIR/invariant.rs:14:1 - | -LL | impl SadBee for for<'a> fn(&'a ()) { - | ---------------------------------- first implementation here -... -LL | impl SadBee for fn(&'static ()) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a> fn(&'a ())` - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #56105 - = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details - = note: `#[warn(coherence_leak_check)]` on by default - error[E0308]: mismatched types - --> $DIR/invariant.rs:27:5 + --> $DIR/invariant.rs:25:5 | +LL | ) -> &'static Foo { + | ----------------------------- expected `&'static Foo` because of return type LL | v - | ^ one type is more general than the other + | ^ types differ | - = note: expected reference `&Foo` - found reference `&Foo fn(&'a ())>` + = note: expected reference `&'static Foo` + found reference `&'static Foo fn(&'a ())>` -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.rs b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.rs index 921061916fc95..2ee9355657318 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.rs +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.rs @@ -32,5 +32,5 @@ fn main() { // NB. *However*, the reinstated leak-check gives an error here. foo::<()>(); - //~^ ERROR implementation of `Trait` is not general enough + //~^ ERROR the trait bound `(): Trait fn(&'b u32)>` is not satisfied } diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr index 364b613fc7717..db9f6f356433d 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr @@ -1,11 +1,19 @@ -error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:5 +error[E0277]: the trait bound `(): Trait fn(&'b u32)>` is not satisfied + --> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:11 | LL | foo::<()>(); - | ^^^^^^^^^^^ implementation of `Trait` is not general enough + | ^^ the trait `Trait fn(&'b u32)>` is not implemented for `()` | - = note: `()` must implement `Trait fn(&'b u32)>` - = note: ...but it actually implements `Trait`, for some specific lifetime `'0` + = help: the trait `Trait` is implemented for `()` +note: required by a bound in `foo` + --> $DIR/hrtb-exists-forall-trait-contravariant.rs:10:8 + | +LL | fn foo() + | --- required by a bound in this function +LL | where +LL | T: Trait fn(&'b u32)>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` error: aborting due to previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.rs b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.rs index f95496a6c3cc0..fb5e51fd1e361 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.rs +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.rs @@ -2,8 +2,6 @@ // // In particular, we test this pattern in trait solving, where it is not connected // to any part of the source code. -// -// check-pass trait Trait {} @@ -34,4 +32,5 @@ fn main() { // This is because we can use `'static`. foo::<()>(); + //~^ ERROR the trait bound `(): Trait fn(fn(&'b u32))>` is not satisfied [E0277] } diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr new file mode 100644 index 0000000000000..333dc59281ee5 --- /dev/null +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `(): Trait fn(fn(&'b u32))>` is not satisfied + --> $DIR/hrtb-exists-forall-trait-covariant.rs:34:11 + | +LL | foo::<()>(); + | ^^ the trait `Trait fn(fn(&'b u32))>` is not implemented for `()` + | + = help: the trait `Trait` is implemented for `()` +note: required by a bound in `foo` + --> $DIR/hrtb-exists-forall-trait-covariant.rs:10:8 + | +LL | fn foo() + | --- required by a bound in this function +LL | where +LL | T: Trait fn(fn(&'b u32))>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.rs b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.rs index 9b9e4496a870d..a2ea7dbcf5163 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.rs +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.rs @@ -25,5 +25,5 @@ fn main() { // yielding `fn(&!b u32)`, in a fresh universe U1 // - So we get `?a = !b` but the universe U0 assigned to `?a` cannot name `!b`. - foo::<()>(); //~ ERROR implementation of `Trait` is not general enough + foo::<()>(); //~ ERROR the trait bound `(): Trait fn(Cell<&'b u32>)>` is not satisfied } diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr index cb2ce8a4116aa..d612aebf0c9a3 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr @@ -1,11 +1,19 @@ -error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5 +error[E0277]: the trait bound `(): Trait fn(Cell<&'b u32>)>` is not satisfied + --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:11 | LL | foo::<()>(); - | ^^^^^^^^^^^ implementation of `Trait` is not general enough + | ^^ the trait `Trait fn(Cell<&'b u32>)>` is not implemented for `()` | - = note: `()` must implement `Trait fn(Cell<&'b u32>)>` - = note: ...but it actually implements `Trait)>`, for some specific lifetime `'0` + = help: the trait `Trait)>` is implemented for `()` +note: required by a bound in `foo` + --> $DIR/hrtb-exists-forall-trait-invariant.rs:12:8 + | +LL | fn foo() + | --- required by a bound in this function +LL | where +LL | T: Trait fn(Cell<&'b u32>)>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` error: aborting due to previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/issue-46989.rs b/tests/ui/higher-ranked/trait-bounds/issue-46989.rs index 4a09f4be156e2..cd0f70fef05b7 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-46989.rs +++ b/tests/ui/higher-ranked/trait-bounds/issue-46989.rs @@ -36,5 +36,5 @@ fn assert_foo() {} fn main() { assert_foo::(); - //~^ ERROR implementation of `Foo` is not general enough + //~^ ERROR the trait bound `for<'a> fn(&'a i32): Foo` is not satisfied [E0277] } diff --git a/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr b/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr index 3f874220a2708..4421a08b20321 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr @@ -1,11 +1,16 @@ -error: implementation of `Foo` is not general enough - --> $DIR/issue-46989.rs:38:5 +error[E0277]: the trait bound `for<'a> fn(&'a i32): Foo` is not satisfied + --> $DIR/issue-46989.rs:38:18 | LL | assert_foo::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | ^^^^^^^^ the trait `Foo` is not implemented for `for<'a> fn(&'a i32)` | - = note: `Foo` would have to be implemented for the type `for<'a> fn(&'a i32)` - = note: ...but `Foo` is actually implemented for the type `fn(&'0 i32)`, for some specific lifetime `'0` + = help: the trait `Foo` is implemented for fn pointer `fn(A)` +note: required by a bound in `assert_foo` + --> $DIR/issue-46989.rs:35:18 + | +LL | fn assert_foo() {} + | ^^^ required by this bound in `assert_foo` error: aborting due to previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-57362-2.rs b/tests/ui/issues/issue-57362-2.rs index a0b0ea1d03893..de27fa2fa1885 100644 --- a/tests/ui/issues/issue-57362-2.rs +++ b/tests/ui/issues/issue-57362-2.rs @@ -19,7 +19,8 @@ impl<'a> X for fn(&'a ()) { } fn g() { - let x = ::make_g(); //~ ERROR the function + let x = ::make_g(); + //~^ ERROR no function or associated item named `make_g` } fn main() {} diff --git a/tests/ui/issues/issue-57362-2.stderr b/tests/ui/issues/issue-57362-2.stderr index 37beb587d2767..a558f3c54feeb 100644 --- a/tests/ui/issues/issue-57362-2.stderr +++ b/tests/ui/issues/issue-57362-2.stderr @@ -1,11 +1,9 @@ -error[E0599]: the function or associated item `make_g` exists for fn pointer `fn(&())`, but its trait bounds were not satisfied +error[E0599]: no function or associated item named `make_g` found for fn pointer `for<'a> fn(&'a ())` in the current scope --> $DIR/issue-57362-2.rs:22:25 | LL | let x = ::make_g(); - | ^^^^^^ function or associated item cannot be called on `fn(&())` due to unsatisfied trait bounds + | ^^^^^^ function or associated item not found in `fn(&())` | - = note: the following trait bounds were not satisfied: - `for<'a> fn(&'a ()): X` = help: items from traits can only be used if the trait is implemented and in scope note: `X` defines an item `make_g`, perhaps you need to implement it --> $DIR/issue-57362-2.rs:8:1 diff --git a/tests/ui/lub-glb/old-lub-glb-hr-eq.rs b/tests/ui/lub-glb/old-lub-glb-hr-eq.rs index fbf4aee02045d..fa13f0f6c3db7 100644 --- a/tests/ui/lub-glb/old-lub-glb-hr-eq.rs +++ b/tests/ui/lub-glb/old-lub-glb-hr-eq.rs @@ -3,8 +3,6 @@ // error. However, now that we handle subtyping correctly, we no // longer get an error, because we recognize these two types as // equivalent! -// -// check-pass fn foo(x: fn(&u8, &u8), y: for<'a> fn(&'a u8, &'a u8)) { // The two types above are actually equivalent. With the older @@ -12,7 +10,7 @@ fn foo(x: fn(&u8, &u8), y: for<'a> fn(&'a u8, &'a u8)) { // hence we gave errors. But now we've fixed that. let z = match 22 { 0 => x, - _ => y, + _ => y, //~ ERROR `match` arms have incompatible types }; } diff --git a/tests/ui/lub-glb/old-lub-glb-hr-eq.stderr b/tests/ui/lub-glb/old-lub-glb-hr-eq.stderr new file mode 100644 index 0000000000000..8bf18d16dba18 --- /dev/null +++ b/tests/ui/lub-glb/old-lub-glb-hr-eq.stderr @@ -0,0 +1,18 @@ +error[E0308]: `match` arms have incompatible types + --> $DIR/old-lub-glb-hr-eq.rs:13:14 + | +LL | let z = match 22 { + | _____________- +LL | | 0 => x, + | | - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8)` +LL | | _ => y, + | | ^ types differ +LL | | }; + | |_____- `match` arms have incompatible types + | + = note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8)` + found fn pointer `for<'a> fn(&'a u8, &'a u8)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.baseleak.stderr b/tests/ui/lub-glb/old-lub-glb-hr-noteq1.baseleak.stderr index 4448f9326cb94..e400b607fefd8 100644 --- a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.baseleak.stderr +++ b/tests/ui/lub-glb/old-lub-glb-hr-noteq1.baseleak.stderr @@ -6,7 +6,7 @@ LL | let z = match 22 { LL | | 0 => x, | | - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` LL | | _ => y, - | | ^ one type is more general than the other + | | ^ types differ LL | | ... | LL | | @@ -15,6 +15,11 @@ LL | | }; | = note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8` +help: consider removing the `` + | +LL - _ => y, +LL + _ => y, + | error: aborting due to previous error diff --git a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr b/tests/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr index 0d61311350e8c..e400b607fefd8 100644 --- a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr +++ b/tests/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr @@ -1,11 +1,25 @@ -error[E0308]: mismatched types +error[E0308]: `match` arms have incompatible types --> $DIR/old-lub-glb-hr-noteq1.rs:17:14 | -LL | _ => y, - | ^ one type is more general than the other +LL | let z = match 22 { + | _____________- +LL | | 0 => x, + | | - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` +LL | | _ => y, + | | ^ types differ +LL | | +... | +LL | | +LL | | }; + | |_____- `match` arms have incompatible types | = note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8` +help: consider removing the `` + | +LL - _ => y, +LL + _ => y, + | error: aborting due to previous error diff --git a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.leak.stderr b/tests/ui/lub-glb/old-lub-glb-hr-noteq1.leak.stderr index dd0fdf3a12abf..4210229e5e90b 100644 --- a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.leak.stderr +++ b/tests/ui/lub-glb/old-lub-glb-hr-noteq1.leak.stderr @@ -6,7 +6,7 @@ LL | let z = match 22 { LL | | 0 => x, | | - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` LL | | _ => y, - | | ^ one type is more general than the other + | | ^ types differ LL | | LL | | LL | | }; diff --git a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.noleak.stderr b/tests/ui/lub-glb/old-lub-glb-hr-noteq1.noleak.stderr index cb046d0b0acad..4210229e5e90b 100644 --- a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.noleak.stderr +++ b/tests/ui/lub-glb/old-lub-glb-hr-noteq1.noleak.stderr @@ -1,8 +1,16 @@ -error[E0308]: mismatched types +error[E0308]: `match` arms have incompatible types --> $DIR/old-lub-glb-hr-noteq1.rs:14:14 | -LL | _ => y, - | ^ one type is more general than the other +LL | let z = match 22 { + | _____________- +LL | | 0 => x, + | | - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` +LL | | _ => y, + | | ^ types differ +LL | | +LL | | +LL | | }; + | |_____- `match` arms have incompatible types | = note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8` diff --git a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.rs b/tests/ui/lub-glb/old-lub-glb-hr-noteq1.rs index 589119abb9b7c..89d1f975931ae 100644 --- a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.rs +++ b/tests/ui/lub-glb/old-lub-glb-hr-noteq1.rs @@ -13,7 +13,7 @@ fn foo(x: for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8, y: for<'a> fn(&'a u8, &'a u8 0 => x, _ => y, //[leak]~^ ERROR `match` arms have incompatible types - //[noleak]~^^ ERROR mismatched types + //[noleak]~^^ ERROR `match` arms have incompatible types }; } diff --git a/tests/ui/lub-glb/old-lub-glb-hr-noteq2.leak.stderr b/tests/ui/lub-glb/old-lub-glb-hr-noteq2.leak.stderr index e54fcf068d8e8..e6532215ebae1 100644 --- a/tests/ui/lub-glb/old-lub-glb-hr-noteq2.leak.stderr +++ b/tests/ui/lub-glb/old-lub-glb-hr-noteq2.leak.stderr @@ -1,12 +1,13 @@ error[E0308]: `match` arms have incompatible types - --> $DIR/old-lub-glb-hr-noteq2.rs:25:14 + --> $DIR/old-lub-glb-hr-noteq2.rs:23:14 | LL | let z = match 22 { | _____________- LL | | 0 => y, | | - this is found to be of type `for<'a> fn(&'a u8, &'a u8) -> &'a u8` LL | | _ => x, - | | ^ one type is more general than the other + | | ^ types differ +LL | | LL | | LL | | }; | |_____- `match` arms have incompatible types diff --git a/tests/ui/lub-glb/old-lub-glb-hr-noteq2.noleak.stderr b/tests/ui/lub-glb/old-lub-glb-hr-noteq2.noleak.stderr new file mode 100644 index 0000000000000..e6532215ebae1 --- /dev/null +++ b/tests/ui/lub-glb/old-lub-glb-hr-noteq2.noleak.stderr @@ -0,0 +1,20 @@ +error[E0308]: `match` arms have incompatible types + --> $DIR/old-lub-glb-hr-noteq2.rs:23:14 + | +LL | let z = match 22 { + | _____________- +LL | | 0 => y, + | | - this is found to be of type `for<'a> fn(&'a u8, &'a u8) -> &'a u8` +LL | | _ => x, + | | ^ types differ +LL | | +LL | | +LL | | }; + | |_____- `match` arms have incompatible types + | + = note: expected fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8` + found fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lub-glb/old-lub-glb-hr-noteq2.rs b/tests/ui/lub-glb/old-lub-glb-hr-noteq2.rs index 9940c40da8134..b1635a133c6e3 100644 --- a/tests/ui/lub-glb/old-lub-glb-hr-noteq2.rs +++ b/tests/ui/lub-glb/old-lub-glb-hr-noteq2.rs @@ -14,8 +14,6 @@ // revisions: leak noleak //[noleak] compile-flags: -Zno-leak-check -//[noleak] check-pass - fn foo(x: for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8, y: for<'a> fn(&'a u8, &'a u8) -> &'a u8) { // The two types above are not equivalent. With the older LUB/GLB // algorithm, this may have worked (I don't remember), but now it @@ -24,6 +22,7 @@ fn foo(x: for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8, y: for<'a> fn(&'a u8, &'a u8 0 => y, _ => x, //[leak]~^ ERROR `match` arms have incompatible types + //[noleak]~^^ ERROR `match` arms have incompatible types }; } diff --git a/tests/ui/mir/field-projection-invariant.rs b/tests/ui/mir/field-projection-invariant.rs index b5d6add043cb9..ae87c172875bb 100644 --- a/tests/ui/mir/field-projection-invariant.rs +++ b/tests/ui/mir/field-projection-invariant.rs @@ -1,4 +1,3 @@ -// build-pass struct Inv<'a>(&'a mut &'a ()); enum Foo { Bar, @@ -9,7 +8,7 @@ type Supertype = Foo fn(Inv<'a>, Inv<'a>)>; fn foo(x: Foo fn(Inv<'a>, Inv<'b>)>) { match x { Supertype::Bar => {} - Supertype::Var(x) => {} + Supertype::Var(x) => {} //~ ERROR mismatched types [E0308] } } @@ -17,7 +16,7 @@ fn foo_nested(x: Foo fn(Inv<'a>, Inv<'b>)>>) { match x { Foo::Bar => {} Foo::Var(Supertype::Bar) => {} - Foo::Var(Supertype::Var(x)) => {} + Foo::Var(Supertype::Var(x)) => {} //~ ERROR mismatched types [E0308] } } diff --git a/tests/ui/mir/field-projection-invariant.stderr b/tests/ui/mir/field-projection-invariant.stderr new file mode 100644 index 0000000000000..14f03363b81d7 --- /dev/null +++ b/tests/ui/mir/field-projection-invariant.stderr @@ -0,0 +1,27 @@ +error[E0308]: mismatched types + --> $DIR/field-projection-invariant.rs:11:9 + | +LL | match x { + | - this expression has type `Foo fn(Inv<'a>, Inv<'b>)>` +LL | Supertype::Bar => {} +LL | Supertype::Var(x) => {} + | ^^^^^^^^^^^^^^^^^ types differ + | + = note: expected enum `Foo fn(Inv<'a>, Inv<'b>)>` + found enum `Foo fn(Inv<'a>, Inv<'a>)>` + +error[E0308]: mismatched types + --> $DIR/field-projection-invariant.rs:19:18 + | +LL | match x { + | - this expression has type `Foo fn(Inv<'a>, Inv<'b>)>>` +... +LL | Foo::Var(Supertype::Var(x)) => {} + | ^^^^^^^^^^^^^^^^^ types differ + | + = note: expected enum `Foo fn(Inv<'a>, Inv<'b>)>` + found enum `Foo fn(Inv<'a>, Inv<'a>)>` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/mir/field-projection-mutating-context.stderr b/tests/ui/mir/field-projection-mutating-context.stderr index 9b18b3427adff..8cf35860340d1 100644 --- a/tests/ui/mir/field-projection-mutating-context.stderr +++ b/tests/ui/mir/field-projection-mutating-context.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/field-projection-mutating-context.rs:9:13 + --> $DIR/field-projection-mutating-context.rs:9:49 | LL | let Foo(ref mut y): Foo = x; - | ^^^^^^^^^ one type is more general than the other + | ^ types differ | - = note: expected fn pointer `for<'a> fn(&'a str)` - found fn pointer `fn(&str)` + = note: expected struct `Foo` + found struct `Foo fn(&'a str)>` error: aborting due to previous error diff --git a/tests/ui/nll/issue-57642-higher-ranked-subtype.rs b/tests/ui/nll/issue-57642-higher-ranked-subtype.rs index eba859cde2206..fe55b9b003e0a 100644 --- a/tests/ui/nll/issue-57642-higher-ranked-subtype.rs +++ b/tests/ui/nll/issue-57642-higher-ranked-subtype.rs @@ -28,7 +28,7 @@ impl Y for fn(T) { } fn higher_ranked_region_has_lost_its_binder() { - let x = ::make_g(); //~ ERROR the function + let x = ::make_g(); //~ ERROR no function } fn magical() { diff --git a/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr b/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr index d1e94bc702cae..679bab63e8531 100644 --- a/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr +++ b/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr @@ -1,11 +1,9 @@ -error[E0599]: the function or associated item `make_g` exists for fn pointer `fn(&())`, but its trait bounds were not satisfied +error[E0599]: no function or associated item named `make_g` found for fn pointer `for<'a> fn(&'a ())` in the current scope --> $DIR/issue-57642-higher-ranked-subtype.rs:31:25 | LL | let x = ::make_g(); - | ^^^^^^ function or associated item cannot be called on `fn(&())` due to unsatisfied trait bounds + | ^^^^^^ function or associated item not found in `fn(&())` | - = note: the following trait bounds were not satisfied: - `for<'a> fn(&'a ()): X` = help: items from traits can only be used if the trait is implemented and in scope note: `X` defines an item `make_g`, perhaps you need to implement it --> $DIR/issue-57642-higher-ranked-subtype.rs:4:1 diff --git a/tests/ui/nll/issue-97997.rs b/tests/ui/nll/issue-97997.rs index c64e720b12f7f..d8213d04bef89 100644 --- a/tests/ui/nll/issue-97997.rs +++ b/tests/ui/nll/issue-97997.rs @@ -11,6 +11,5 @@ fn main() { impls_foo(foo as fn(i32)); ::ASSOC; - //~^ ERROR implementation of `Foo` is not general enough - //~| ERROR implementation of `Foo` is not general enough + //~^ ERROR the trait bound `for<'a> fn(&'a u8): Foo` is not satisfied [E0277] } diff --git a/tests/ui/nll/issue-97997.stderr b/tests/ui/nll/issue-97997.stderr index 89eaf77adf063..9540cc4816b4f 100644 --- a/tests/ui/nll/issue-97997.stderr +++ b/tests/ui/nll/issue-97997.stderr @@ -1,21 +1,11 @@ -error: implementation of `Foo` is not general enough - --> $DIR/issue-97997.rs:13:5 +error[E0277]: the trait bound `for<'a> fn(&'a u8): Foo` is not satisfied + --> $DIR/issue-97997.rs:13:6 | LL | ::ASSOC; - | ^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | ^^^^^^^ the trait `Foo` is not implemented for `for<'a> fn(&'a u8)` | - = note: `Foo` would have to be implemented for the type `for<'a> fn(&'a u8)` - = note: ...but `Foo` is actually implemented for the type `fn(&'0 u8)`, for some specific lifetime `'0` + = help: the trait `Foo` is implemented for fn pointer `fn(T)` -error: implementation of `Foo` is not general enough - --> $DIR/issue-97997.rs:13:5 - | -LL | ::ASSOC; - | ^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `Foo` would have to be implemented for the type `for<'a> fn(&'a u8)` - = note: ...but `Foo` is actually implemented for the type `fn(&'0 u8)`, for some specific lifetime `'0` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -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/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs b/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs index 92730341c1110..683186d7c33df 100644 --- a/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs +++ b/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs @@ -1,13 +1,9 @@ -// Test an interesting corner case that ought to be legal (though the -// current code actually gets it wrong, see below): a fn that takes +// Test an interesting corner case that has previously been legal: a fn that takes // two arguments that are references with the same lifetime is in fact // equivalent to a fn that takes two references with distinct // lifetimes. This is true because the two functions can call one // another -- effectively, the single lifetime `'a` is just inferred // to be the intersection of the two distinct lifetimes. -// -// check-pass -// compile-flags:-Zno-leak-check use std::cell::Cell; @@ -17,7 +13,8 @@ fn make_cell_aa() -> Cell fn(&'a u32, &'a u32)> { fn aa_eq_ab() { let a: Cell fn(&'a u32, &'b u32)> = make_cell_aa(); + //~^ ERROR mismatched types drop(a); } -fn main() { } +fn main() {} diff --git a/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.stderr b/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.stderr new file mode 100644 index 0000000000000..4ff0024036382 --- /dev/null +++ b/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/hr-fn-aau-eq-abu.rs:15:53 + | +LL | let a: Cell fn(&'a u32, &'b u32)> = make_cell_aa(); + | -------------------------------------- ^^^^^^^^^^^^^^ types differ + | | + | expected due to this + | + = note: expected struct `Cell fn(&'a u32, &'b u32)>` + found struct `Cell fn(&'a u32, &'a u32)>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs index 05e2ea047f65a..d76fd4a42f307 100644 --- a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs +++ b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs @@ -28,7 +28,5 @@ impl Y for fn(T) { fn main() { let _x = ::make_f(); - //~^ ERROR implementation of `Y` is not general enough - //~| ERROR implementation of `Y` is not general enough - //~| ERROR implementation of `Y` is not general enough + //~^ ERROR no function or associated item named `make_f` } diff --git a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr index 804071a3e6f77..fad1280464933 100644 --- a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr +++ b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr @@ -1,31 +1,16 @@ -error: implementation of `Y` is not general enough - --> $DIR/impl-fn-ignore-binder-via-bottom.rs:30:14 +error[E0599]: no function or associated item named `make_f` found for fn pointer `for<'a> fn(&'a ())` in the current scope + --> $DIR/impl-fn-ignore-binder-via-bottom.rs:30:25 | LL | let _x = ::make_f(); - | ^^^^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + | ^^^^^^ function or associated item not found in `fn(&())` | - = note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())` - = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` - -error: implementation of `Y` is not general enough - --> $DIR/impl-fn-ignore-binder-via-bottom.rs:30:14 - | -LL | let _x = ::make_f(); - | ^^^^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough - | - = note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())` - = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: implementation of `Y` is not general enough - --> $DIR/impl-fn-ignore-binder-via-bottom.rs:30:14 - | -LL | let _x = ::make_f(); - | ^^^^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + = help: items from traits can only be used if the trait is implemented and in scope +note: `Y` defines an item `make_f`, perhaps you need to implement it + --> $DIR/impl-fn-ignore-binder-via-bottom.rs:16:1 | - = note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())` - = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +LL | trait Y { + | ^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to previous error +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr index 85555c43906e8..5ef83076fa4e2 100644 --- a/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr +++ b/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr @@ -1,8 +1,8 @@ error[E0308]: `#[panic_handler]` function has wrong type - --> $DIR/panic-handler-bad-signature-1.rs:9:16 + --> $DIR/panic-handler-bad-signature-1.rs:9:1 | LL | fn panic(info: PanicInfo) -> () {} - | ^^^^^^^^^ expected `&PanicInfo<'_>`, found `PanicInfo<'_>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ | = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> !` found signature `for<'a> fn(PanicInfo<'a>)` diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr index 84eba2a5a63c2..e60e8d2d8cacf 100644 --- a/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr +++ b/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr @@ -2,7 +2,7 @@ error[E0308]: `#[panic_handler]` function has wrong type --> $DIR/panic-handler-bad-signature-2.rs:9:1 | LL | fn panic(info: &'static PanicInfo) -> ! - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ | = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _` found signature `for<'a> fn(&'static PanicInfo<'a>) -> _` diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr index cdf55ab6534ea..b6f1c49165861 100644 --- a/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr +++ b/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr @@ -2,7 +2,7 @@ error[E0308]: `#[panic_handler]` function has wrong type --> $DIR/panic-handler-bad-signature-3.rs:9:1 | LL | fn panic() -> ! { - | ^^^^^^^^^^^^^^^ incorrect number of function parameters + | ^^^^^^^^^^^^^^^ types differ | = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _` found signature `fn() -> _` diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr index 20c17587590ca..1a84c52666b33 100644 --- a/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr +++ b/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr @@ -2,7 +2,7 @@ error[E0308]: `#[panic_handler]` function has wrong type --> $DIR/panic-handler-bad-signature-5.rs:9:1 | LL | fn panic(info: &PanicInfo<'static>) -> ! - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ | = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _` found signature `for<'a> fn(&'a PanicInfo<'static>) -> _` diff --git a/tests/ui/traits/new-solver/member-constraints-in-root-universe.rs b/tests/ui/traits/new-solver/member-constraints-in-root-universe.rs index 97c4430586447..3de167dc7bd36 100644 --- a/tests/ui/traits/new-solver/member-constraints-in-root-universe.rs +++ b/tests/ui/traits/new-solver/member-constraints-in-root-universe.rs @@ -10,7 +10,7 @@ impl Trait for for<'a> fn(&'a u8, &'a u8) { } // argument is necessary to create universes before registering the hidden type. -fn test<'a>(_: ::Ty) -> impl Sized { +fn test<'a>(_: fn(&'b u8, &'b u8) as Trait>::Ty) -> impl Sized { "hidden type is `&'?0 str` with '?0 member of ['static,]" } diff --git a/tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr b/tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr index dd2737c706d6b..2bb472b11d3a5 100644 --- a/tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr +++ b/tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr @@ -29,14 +29,12 @@ LL | type Opaque = impl Sized; | ---------- the expected opaque type ... LL | let _: Opaque = dyn_hoops::(0); - | ------ ^^^^^^^^^^^^^^^^^^ expected opaque type, found `*const dyn FnOnce(())` + | ------ ^^^^^^^^^^^^^^^^^^ types differ | | | expected due to this | = note: expected opaque type `typeck::Opaque` found raw pointer `*const (dyn FnOnce(()) + 'static)` - = help: consider constraining the associated type `::Gat<'_>` to `()` or calling a method that returns `::Gat<'_>` - = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html error: concrete type differs from previous defining opaque type use --> $DIR/normalize-hidden-types.rs:54:25