diff --git a/compiler/rustc_infer/src/infer/combine.rs b/compiler/rustc_infer/src/infer/combine.rs index 534106ac446cf..e32d5ca05e8ab 100644 --- a/compiler/rustc_infer/src/infer/combine.rs +++ b/compiler/rustc_infer/src/infer/combine.rs @@ -749,9 +749,7 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> { } } } - ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted }) - if self.tcx().lazy_normalization() => - { + ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted }) => { assert_eq!(promoted, None); let substs = self.relate_with_variance( ty::Variance::Invariant, @@ -980,9 +978,7 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> { } } } - ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted }) - if self.tcx().lazy_normalization() => - { + ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted }) => { assert_eq!(promoted, None); let substs = self.relate_with_variance( ty::Variance::Invariant, diff --git a/compiler/rustc_infer/src/infer/equate.rs b/compiler/rustc_infer/src/infer/equate.rs index ef6d464d3c6f1..b81f72adc3bb3 100644 --- a/compiler/rustc_infer/src/infer/equate.rs +++ b/compiler/rustc_infer/src/infer/equate.rs @@ -1,6 +1,7 @@ use super::combine::{CombineFields, ConstEquateRelation, RelationDir}; use super::Subtype; +use rustc_middle::ty::error::TypeError; use rustc_middle::ty::relate::{self, Relate, RelateResult, TypeRelation}; use rustc_middle::ty::subst::SubstsRef; use rustc_middle::ty::TyVar; @@ -151,13 +152,16 @@ impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> { where T: Relate<'tcx>, { - 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_late_bound_regions(a); + let b = self.tcx().anonymize_late_bound_regions(b); + if a.bound_vars() == b.bound_vars() { + let (a, b) = self + .fields + .infcx + .replace_bound_vars_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())?; - Ok(a) + Err(TypeError::Mismatch) } } } diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index 0379b16334cdc..2fd595b42bc77 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -432,19 +432,22 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> { GenericArgKind::Const(constant) => { match constant.val() { ty::ConstKind::Unevaluated(uv) => { - let obligations = self.nominal_obligations(uv.def.did, uv.substs); - self.out.extend(obligations); - - let predicate = - ty::Binder::dummy(ty::PredicateKind::ConstEvaluatable(uv.shrink())) - .to_predicate(self.tcx()); - let cause = self.cause(traits::MiscObligation); - self.out.push(traits::Obligation::with_depth( - cause, - self.recursion_depth, - self.param_env, - predicate, - )); + if !uv.has_escaping_bound_vars() { + let obligations = self.nominal_obligations(uv.def.did, uv.substs); + self.out.extend(obligations); + + let predicate = ty::Binder::dummy( + ty::PredicateKind::ConstEvaluatable(uv.shrink()), + ) + .to_predicate(self.tcx()); + let cause = self.cause(traits::MiscObligation); + self.out.push(traits::Obligation::with_depth( + cause, + self.recursion_depth, + self.param_env, + predicate, + )); + } } ty::ConstKind::Infer(infer) => { let resolved = self.infcx.shallow_resolve(infer); diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs index 17eac2bb2c9e9..4b3e9cdd195f9 100644 --- a/compiler/rustc_ty_utils/src/instance.rs +++ b/compiler/rustc_ty_utils/src/instance.rs @@ -148,6 +148,7 @@ fn inner_resolve_instance<'tcx>( let result = if let Some(trait_def_id) = tcx.trait_of_item(def.did) { debug!(" => associated item, attempting to find impl in param_env {:#?}", param_env); + let substs = tcx.normalize_erasing_regions(param_env, substs); resolve_associated_item(tcx, def.did, param_env, trait_def_id, substs) } else { let ty = tcx.type_of(def.def_id_for_type_of()); diff --git a/compiler/rustc_typeck/src/check/intrinsic.rs b/compiler/rustc_typeck/src/check/intrinsic.rs index 7fe710cf8f4f2..ea91e8a78ae43 100644 --- a/compiler/rustc_typeck/src/check/intrinsic.rs +++ b/compiler/rustc_typeck/src/check/intrinsic.rs @@ -115,9 +115,13 @@ 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(0)), ty::BoundVariableKind::Region(ty::BrEnv)] - .iter() - .copied(), + [ + ty::BoundVariableKind::Region(ty::BrAnon(0)), + ty::BoundVariableKind::Region(ty::BrAnon(1)), + ty::BoundVariableKind::Region(ty::BrEnv), + ] + .iter() + .copied(), ); let mk_va_list_ty = |mutbl| { tcx.lang_items().va_list().map(|did| { @@ -127,7 +131,7 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) { )); let env_region = tcx.mk_region(ty::ReLateBound( 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.bound_type_of(did).subst(tcx, &[region.into()]); (tcx.mk_ref(env_region, ty::TypeAndMut { ty: va_list_ty, mutbl }), va_list_ty) @@ -391,9 +395,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(0) }; - let param_ty = + let param_ty_lhs = tcx.mk_imm_ref(tcx.mk_region(ty::ReLateBound(ty::INNERMOST, br)), param(0)); - (1, vec![param_ty; 2], tcx.types.bool) + let br = ty::BoundRegion { var: ty::BoundVar::from_u32(1), kind: ty::BrAnon(1) }; + let param_ty_rhs = + tcx.mk_imm_ref(tcx.mk_region(ty::ReLateBound(ty::INNERMOST, br)), param(0)); + (1, vec![param_ty_lhs, param_ty_rhs], tcx.types.bool) } sym::black_box => (1, vec![param(0)], param(0)), diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.base.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.base.stderr index c3efe16e251ba..4e0acd2779e83 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.base.stderr +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.base.stderr @@ -36,33 +36,58 @@ note: ...does not necessarily outlive the anonymous lifetime #1 defined here LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | ^^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/expect-fn-supply-fn.rs:38:52 +error[E0631]: type mismatch in closure arguments + --> $DIR/expect-fn-supply-fn.rs:36:5 | LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); - | ^^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `fn(for<'r> fn(&'r u32), _) -> _` + | | + | expected signature of `for<'a, 'r> fn(for<'a> fn(&'a u32), &'r i32) -> _` | - = note: expected fn pointer `fn(&u32)` - found fn pointer `for<'r> fn(&'r u32)` +note: required by a bound in `with_closure_expecting_fn_with_free_region` + --> $DIR/expect-fn-supply-fn.rs:7:8 + | +LL | fn with_closure_expecting_fn_with_free_region(_: F) + | ------------------------------------------ required by a bound in this +LL | where +LL | F: for<'a> FnOnce(fn(&'a u32), &i32), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_free_region` -error[E0308]: mismatched types - --> $DIR/expect-fn-supply-fn.rs:45:53 +error[E0631]: type mismatch in closure arguments + --> $DIR/expect-fn-supply-fn.rs:43:5 | LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); - | ^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _` + | | + | expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _` | - = note: expected fn pointer `for<'r> fn(&'r u32)` - found fn pointer `fn(&'x u32)` +note: required by a bound in `with_closure_expecting_fn_with_bound_region` + --> $DIR/expect-fn-supply-fn.rs:13:8 + | +LL | fn with_closure_expecting_fn_with_bound_region(_: F) + | ------------------------------------------- required by a bound in this +LL | where +LL | F: FnOnce(fn(&u32), &i32), + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_bound_region` -error[E0308]: mismatched types - --> $DIR/expect-fn-supply-fn.rs:54:53 +error[E0631]: type mismatch in closure arguments + --> $DIR/expect-fn-supply-fn.rs:52:5 | LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { - | ^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- found signature of `for<'r> fn(for<'r> fn(&'r u32), _) -> _` + | | + | expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _` + | +note: required by a bound in `with_closure_expecting_fn_with_bound_region` + --> $DIR/expect-fn-supply-fn.rs:13:8 | - = note: expected fn pointer `for<'r> fn(&'r u32)` - found fn pointer `fn(&u32)` +LL | fn with_closure_expecting_fn_with_bound_region(_: F) + | ------------------------------------------- required by a bound in this +LL | where +LL | F: FnOnce(fn(&u32), &i32), + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_bound_region` error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0308, E0631. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr index 52e2898d2bb1a..6bbfe3a3512e7 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr @@ -1,51 +1,54 @@ -error: lifetime may not live long enough - --> $DIR/expect-fn-supply-fn.rs:20: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:20: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:38:49 +error[E0631]: type mismatch in closure arguments + --> $DIR/expect-fn-supply-fn.rs:36:5 | LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); - | ^ one type is more general than the other - | - = note: expected fn pointer `for<'r> fn(&'r u32)` - found fn pointer `fn(&u32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `fn(for<'r> fn(&'r u32), _) -> _` + | | + | expected signature of `for<'a, 'r> fn(for<'a> fn(&'a u32), &'r i32) -> _` + | +note: required by a bound in `with_closure_expecting_fn_with_free_region` + --> $DIR/expect-fn-supply-fn.rs:7:8 + | +LL | fn with_closure_expecting_fn_with_free_region(_: F) + | ------------------------------------------ required by a bound in this +LL | where +LL | F: for<'a> FnOnce(fn(&'a u32), &i32), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_free_region` -error[E0308]: mismatched types - --> $DIR/expect-fn-supply-fn.rs:45:50 +error[E0631]: type mismatch in closure arguments + --> $DIR/expect-fn-supply-fn.rs:43:5 | LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); - | ^ one type is more general than the other - | - = note: expected fn pointer `fn(&'x u32)` - found fn pointer `for<'r> fn(&'r u32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _` + | | + | expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _` + | +note: required by a bound in `with_closure_expecting_fn_with_bound_region` + --> $DIR/expect-fn-supply-fn.rs:13:8 + | +LL | fn with_closure_expecting_fn_with_bound_region(_: F) + | ------------------------------------------- required by a bound in this +LL | where +LL | F: FnOnce(fn(&u32), &i32), + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_bound_region` -error[E0308]: mismatched types - --> $DIR/expect-fn-supply-fn.rs:54:50 +error[E0631]: type mismatch in closure arguments + --> $DIR/expect-fn-supply-fn.rs:52:5 | LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { - | ^ one type is more general than the other - | - = note: expected fn pointer `fn(&u32)` - found fn pointer `for<'r> fn(&'r u32)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- found signature of `for<'r> fn(for<'r> fn(&'r u32), _) -> _` + | | + | expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _` + | +note: required by a bound in `with_closure_expecting_fn_with_bound_region` + --> $DIR/expect-fn-supply-fn.rs:13:8 + | +LL | fn with_closure_expecting_fn_with_bound_region(_: F) + | ------------------------------------------- required by a bound in this +LL | where +LL | F: FnOnce(fn(&u32), &i32), + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_bound_region` -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/src/test/ui/closure-expected-type/expect-fn-supply-fn.rs b/src/test/ui/closure-expected-type/expect-fn-supply-fn.rs index 1715f56ff63ce..1780ae66ed027 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.rs +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.rs @@ -20,8 +20,6 @@ fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); //[base]~^ ERROR mismatched types //[base]~| ERROR mismatched types - //[nll]~^^^ ERROR lifetime may not live long enough - //[nll]~| ERROR lifetime may not live long enough } fn expect_free_supply_free_from_closure() { @@ -36,14 +34,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() { @@ -52,7 +50,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/src/test/ui/coherence/coherence-fn-covariant-bound-vs-static.rs b/src/test/ui/coherence/coherence-fn-covariant-bound-vs-static.rs index 99f805f7f0f63..6eab905d9eee3 100644 --- a/src/test/ui/coherence/coherence-fn-covariant-bound-vs-static.rs +++ b/src/test/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/src/test/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr b/src/test/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr deleted file mode 100644 index cfcef9699f372..0000000000000 --- a/src/test/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(for<'r> 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(for<'r> 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/src/test/ui/coherence/coherence-fn-implied-bounds.rs b/src/test/ui/coherence/coherence-fn-implied-bounds.rs index 4539af9a32e38..5252132a4ad22 100644 --- a/src/test/ui/coherence/coherence-fn-implied-bounds.rs +++ b/src/test/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/src/test/ui/coherence/coherence-fn-implied-bounds.stderr b/src/test/ui/coherence/coherence-fn-implied-bounds.stderr deleted file mode 100644 index c8accc9974791..0000000000000 --- a/src/test/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` - | -note: the lint level is defined here - --> $DIR/coherence-fn-implied-bounds.rs:15:9 - | -LL | #![deny(coherence_leak_check)] - | ^^^^^^^^^^^^^^^^^^^^ - = 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 - -error: aborting due to previous error - diff --git a/src/test/ui/coherence/coherence-fn-inputs.rs b/src/test/ui/coherence/coherence-fn-inputs.rs index 3afec5c5459af..5fcdb585c8156 100644 --- a/src/test/ui/coherence/coherence-fn-inputs.rs +++ b/src/test/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/src/test/ui/coherence/coherence-fn-inputs.stderr b/src/test/ui/coherence/coherence-fn-inputs.stderr deleted file mode 100644 index 82bd8a35f4575..0000000000000 --- a/src/test/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/src/test/ui/coherence/coherence-free-vs-bound-region.rs b/src/test/ui/coherence/coherence-free-vs-bound-region.rs index 2f5c49d293d5d..ac01e09a1508d 100644 --- a/src/test/ui/coherence/coherence-free-vs-bound-region.rs +++ b/src/test/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/src/test/ui/coherence/coherence-free-vs-bound-region.stderr b/src/test/ui/coherence/coherence-free-vs-bound-region.stderr deleted file mode 100644 index c249fa43c3b60..0000000000000 --- a/src/test/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)` - | -note: the lint level is defined here - --> $DIR/coherence-free-vs-bound-region.rs:10:9 - | -LL | #![deny(coherence_leak_check)] - | ^^^^^^^^^^^^^^^^^^^^ - = 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 - -error: aborting due to previous error - diff --git a/src/test/ui/coherence/coherence-inherited-subtyping.old.stderr b/src/test/ui/coherence/coherence-inherited-subtyping.old.stderr deleted file mode 100644 index 4701bc0b13973..0000000000000 --- a/src/test/ui/coherence/coherence-inherited-subtyping.old.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0592]: duplicate definitions with name `method1` - --> $DIR/coherence-inherited-subtyping.rs:14: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/src/test/ui/coherence/coherence-inherited-subtyping.re.stderr b/src/test/ui/coherence/coherence-inherited-subtyping.re.stderr deleted file mode 100644 index 4701bc0b13973..0000000000000 --- a/src/test/ui/coherence/coherence-inherited-subtyping.re.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0592]: duplicate definitions with name `method1` - --> $DIR/coherence-inherited-subtyping.rs:14: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/src/test/ui/coherence/coherence-inherited-subtyping.rs b/src/test/ui/coherence/coherence-inherited-subtyping.rs index 8587eb77950c7..69f5ea584ebbe 100644 --- a/src/test/ui/coherence/coherence-inherited-subtyping.rs +++ b/src/test/ui/coherence/coherence-inherited-subtyping.rs @@ -3,15 +3,14 @@ // // Note: This scenario is currently accepted, but as part of the // universe transition (#56105) may eventually become an error. - -// revisions: old re - +// +// 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/src/test/ui/coherence/coherence-subtyping.rs b/src/test/ui/coherence/coherence-subtyping.rs index b3ed728a81c06..78974b6972a71 100644 --- a/src/test/ui/coherence/coherence-subtyping.rs +++ b/src/test/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/src/test/ui/coherence/coherence-subtyping.stderr b/src/test/ui/coherence/coherence-subtyping.stderr deleted file mode 100644 index 6f95f0a06b5fa..0000000000000 --- a/src/test/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` - | - = note: `#[warn(coherence_leak_check)]` on by default - = 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 - -warning: 1 warning emitted - diff --git a/src/test/ui/coherence/coherence-wasm-bindgen.rs b/src/test/ui/coherence/coherence-wasm-bindgen.rs index ee09a72449be1..1de8b8c30fe0e 100644 --- a/src/test/ui/coherence/coherence-wasm-bindgen.rs +++ b/src/test/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/src/test/ui/coherence/coherence-wasm-bindgen.stderr b/src/test/ui/coherence/coherence-wasm-bindgen.stderr deleted file mode 100644 index 432646e5321eb..0000000000000 --- a/src/test/ui/coherence/coherence-wasm-bindgen.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error: conflicting implementations of trait `IntoWasmAbi` for type `&dyn std::ops::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, -LL | | { -LL | | } - | |_- 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, -... | -LL | | -LL | | } - | |_^ conflicting implementation for `&dyn std::ops::Fn(&_) -> _` - | -note: the lint level is defined here - --> $DIR/coherence-wasm-bindgen.rs:10:9 - | -LL | #![deny(coherence_leak_check)] - | ^^^^^^^^^^^^^^^^^^^^ - = 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 - -error: aborting due to previous error - diff --git a/src/test/ui/const-generics/invariant.base.stderr b/src/test/ui/const-generics/invariant.base.stderr index 255900e19bb4b..d1cb3229b64d9 100644 --- a/src/test/ui/const-generics/invariant.base.stderr +++ b/src/test/ui/const-generics/invariant.base.stderr @@ -1,26 +1,14 @@ -warning: conflicting implementations of trait `SadBee` for type `for<'a> fn(&'a ())` - --> $DIR/invariant.rs:18: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 ())` - | - = note: `#[warn(coherence_leak_check)]` on by default - = 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 - error[E0308]: mismatched types - --> $DIR/invariant.rs:31:5 + --> $DIR/invariant.rs:29: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 `&'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/src/test/ui/const-generics/invariant.nll.stderr b/src/test/ui/const-generics/invariant.nll.stderr index f684f7fddc8f5..d1cb3229b64d9 100644 --- a/src/test/ui/const-generics/invariant.nll.stderr +++ b/src/test/ui/const-generics/invariant.nll.stderr @@ -1,26 +1,14 @@ -warning: conflicting implementations of trait `SadBee` for type `for<'a> fn(&'a ())` - --> $DIR/invariant.rs:18: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 ())` - | - = note: `#[warn(coherence_leak_check)]` on by default - = 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 - error[E0308]: mismatched types - --> $DIR/invariant.rs:31:5 + --> $DIR/invariant.rs:29: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/src/test/ui/const-generics/invariant.rs b/src/test/ui/const-generics/invariant.rs index 65d1ee9420c3d..7c6927c5c050b 100644 --- a/src/test/ui/const-generics/invariant.rs +++ b/src/test/ui/const-generics/invariant.rs @@ -16,8 +16,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/src/test/ui/consts/issue-91434.rs b/src/test/ui/consts/issue-91434.rs index fc7731291b371..bc518858c97a5 100644 --- a/src/test/ui/consts/issue-91434.rs +++ b/src/test/ui/consts/issue-91434.rs @@ -2,5 +2,5 @@ fn main() { [9; [[9E; h]]]; //~^ ERROR: expected at least one digit in exponent //~| ERROR: cannot find value `h` in this scope [E0425] - //~| ERROR: constant expression depends on a generic parameter + //~| ERROR: mismatched types } diff --git a/src/test/ui/consts/issue-91434.stderr b/src/test/ui/consts/issue-91434.stderr index 9d3fe5f201656..3af1565912be4 100644 --- a/src/test/ui/consts/issue-91434.stderr +++ b/src/test/ui/consts/issue-91434.stderr @@ -10,14 +10,13 @@ error[E0425]: cannot find value `h` in this scope LL | [9; [[9E; h]]]; | ^ not found in this scope -error: constant expression depends on a generic parameter +error[E0308]: mismatched types --> $DIR/issue-91434.rs:2:9 | LL | [9; [[9E; h]]]; - | ^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes + | ^^^^^^^^^ expected `usize`, found array `[[{float}; _]; 1]` error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0425`. +Some errors have detailed explanations: E0308, E0425. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.base.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.base.stderr index 006b6756b1eb5..10920cf0e8a52 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.base.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.base.stderr @@ -1,11 +1,19 @@ -error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-contravariant.rs:38:5 +error[E0277]: the trait bound `(): Trait fn(&'b u32)>` is not satisfied + --> $DIR/hrtb-exists-forall-trait-contravariant.rs:38: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:14:8 + | +LL | fn foo() + | --- required by a bound in this +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/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.nll.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.nll.stderr index 23b5072826418..10920cf0e8a52 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.nll.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.nll.stderr @@ -1,11 +1,19 @@ -error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-contravariant.rs:38:5 +error[E0277]: the trait bound `(): Trait fn(&'b u32)>` is not satisfied + --> $DIR/hrtb-exists-forall-trait-contravariant.rs:38: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:14:8 + | +LL | fn foo() + | --- required by a bound in this +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/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs index 4b33dcb2cab4c..6a5c0ce8f5dc3 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs @@ -36,5 +36,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/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.rs b/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.rs index f95496a6c3cc0..3552b98e183d8 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.rs +++ b/src/test/ui/hrtb/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(for<'b> fn(&'b u32))>` is not satisfied } diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.stderr new file mode 100644 index 0000000000000..b10925a075973 --- /dev/null +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `(): Trait fn(for<'b> fn(&'b u32))>` is not satisfied + --> $DIR/hrtb-exists-forall-trait-covariant.rs:34:11 + | +LL | foo::<()>(); + | ^^ the trait `Trait fn(for<'b> 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 +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/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.base.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.base.stderr deleted file mode 100644 index 05575b01834b7..0000000000000 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.base.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-invariant.rs:32:5 - | -LL | foo::<()>(); - | ^^^^^^^^^ implementation of `Trait` is not general enough - | - = note: `()` must implement `Trait fn(Cell<&'b u32>)>` - = note: ...but it actually implements `Trait)>`, for some specific lifetime `'0` - -error: aborting due to previous error - diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.nll.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.nll.stderr deleted file mode 100644 index 58d59f60379f7..0000000000000 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-invariant.rs:32:5 - | -LL | foo::<()>(); - | ^^^^^^^^^^^ implementation of `Trait` is not general enough - | - = note: `()` must implement `Trait fn(Cell<&'b u32>)>` - = note: ...but it actually implements `Trait)>`, for some specific lifetime `'0` - -error: aborting due to previous error - diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs index c779bc3f46c33..a2ea7dbcf5163 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs @@ -1,7 +1,3 @@ -// revisions: base nll -// ignore-compare-mode-nll -//[nll] compile-flags: -Z borrowck=mir - // Test an `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! // // In particular, we test this pattern in trait solving, where it is not connected @@ -29,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/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr new file mode 100644 index 0000000000000..c73729bfba017 --- /dev/null +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `(): Trait fn(Cell<&'b u32>)>` is not satisfied + --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:11 + | +LL | foo::<()>(); + | ^^ the trait `Trait fn(Cell<&'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-invariant.rs:12:8 + | +LL | fn foo() + | --- required by a bound in this +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/src/test/ui/hrtb/issue-46989.base.stderr b/src/test/ui/hrtb/issue-46989.base.stderr deleted file mode 100644 index d1f6fed10fdde..0000000000000 --- a/src/test/ui/hrtb/issue-46989.base.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `Foo` is not general enough - --> $DIR/issue-46989.rs:42:5 - | -LL | assert_foo::(); - | ^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `Foo` would have to be implemented for the type `for<'r> fn(&'r i32)` - = note: ...but `Foo` is actually implemented for the type `fn(&'0 i32)`, for some specific lifetime `'0` - -error: aborting due to previous error - diff --git a/src/test/ui/hrtb/issue-46989.nll.stderr b/src/test/ui/hrtb/issue-46989.nll.stderr deleted file mode 100644 index e1ddd7235f57d..0000000000000 --- a/src/test/ui/hrtb/issue-46989.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `Foo` is not general enough - --> $DIR/issue-46989.rs:42:5 - | -LL | assert_foo::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `Foo` would have to be implemented for the type `for<'r> fn(&'r i32)` - = note: ...but `Foo` is actually implemented for the type `fn(&'0 i32)`, for some specific lifetime `'0` - -error: aborting due to previous error - diff --git a/src/test/ui/hrtb/issue-46989.rs b/src/test/ui/hrtb/issue-46989.rs index 0bb6d7a18eb75..2ca8617a1c8e7 100644 --- a/src/test/ui/hrtb/issue-46989.rs +++ b/src/test/ui/hrtb/issue-46989.rs @@ -1,7 +1,3 @@ -// revisions: base nll -// ignore-compare-mode-nll -//[nll] compile-flags: -Z borrowck=mir - // Regression test for #46989: // // In the move to universes, this test started passing. @@ -40,5 +36,5 @@ fn assert_foo() {} fn main() { assert_foo::(); - //~^ ERROR implementation of `Foo` is not general enough + //~^ ERROR the trait bound `for<'r> fn(&'r i32): Foo` is not satisfied } diff --git a/src/test/ui/hrtb/issue-46989.stderr b/src/test/ui/hrtb/issue-46989.stderr new file mode 100644 index 0000000000000..8687678694613 --- /dev/null +++ b/src/test/ui/hrtb/issue-46989.stderr @@ -0,0 +1,16 @@ +error[E0277]: the trait bound `for<'r> fn(&'r i32): Foo` is not satisfied + --> $DIR/issue-46989.rs:38:18 + | +LL | assert_foo::(); + | ^^^^^^^^ the trait `Foo` is not implemented for `for<'r> fn(&'r i32)` + | + = help: the trait `Foo` is implemented for `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/src/test/ui/hrtb/issue-95034.rs b/src/test/ui/hrtb/issue-95034.rs index aee6fe61ba812..b424010dd2e12 100644 --- a/src/test/ui/hrtb/issue-95034.rs +++ b/src/test/ui/hrtb/issue-95034.rs @@ -1,22 +1,7 @@ -// known-bug -// failure-status: 101 // compile-flags: --edition=2021 --crate-type=lib -// rustc-env:RUST_BACKTRACE=0 - -// normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" -// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" -// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" -// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" -// normalize-stderr-test "note: compiler flags.*\n\n" -> "" -// normalize-stderr-test "note: rustc.*running on.*\n\n" -> "" -// normalize-stderr-test "query stack during panic:\n" -> "" -// normalize-stderr-test "we're just showing a limited slice of the query stack\n" -> "" -// normalize-stderr-test "end of query stack\n" -> "" -// normalize-stderr-test "#.*\n" -> "" - -// This should not ICE. - +// +// check-pass +// // Refer to the issue for more minimized versions. use std::{ diff --git a/src/test/ui/hrtb/issue-95034.stderr b/src/test/ui/hrtb/issue-95034.stderr deleted file mode 100644 index 1d8329142fc5c..0000000000000 --- a/src/test/ui/hrtb/issue-95034.stderr +++ /dev/null @@ -1 +0,0 @@ -thread 'rustc' panicked diff --git a/src/test/ui/issues/issue-57362-2.rs b/src/test/ui/issues/issue-57362-2.rs index a0b0ea1d03893..de27fa2fa1885 100644 --- a/src/test/ui/issues/issue-57362-2.rs +++ b/src/test/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/src/test/ui/issues/issue-57362-2.stderr b/src/test/ui/issues/issue-57362-2.stderr index 3b6cffeafe4c2..2edc009746455 100644 --- a/src/test/ui/issues/issue-57362-2.stderr +++ b/src/test/ui/issues/issue-57362-2.stderr @@ -1,11 +1,9 @@ -error[E0599]: the function or associated item `make_g` exists for fn pointer `for<'r> fn(&'r ())`, but its trait bounds were not satisfied +error[E0599]: no function or associated item named `make_g` found for fn pointer `for<'r> fn(&'r ())` in the current scope --> $DIR/issue-57362-2.rs:22:25 | LL | let x = ::make_g(); - | ^^^^^^ function or associated item cannot be called on `for<'r> fn(&'r ())` due to unsatisfied trait bounds + | ^^^^^^ function or associated item not found in `for<'r> fn(&'r ())` | - = note: the following trait bounds were not satisfied: - `for<'r> fn(&'r ()): 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/src/test/ui/lub-glb/old-lub-glb-hr-eq.rs b/src/test/ui/lub-glb/old-lub-glb-hr-eq.rs index fbf4aee02045d..fa13f0f6c3db7 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-eq.rs +++ b/src/test/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/src/test/ui/lub-glb/old-lub-glb-hr-eq.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-eq.stderr new file mode 100644 index 0000000000000..704cfd6e2eccc --- /dev/null +++ b/src/test/ui/lub-glb/old-lub-glb-hr-eq.stderr @@ -0,0 +1,23 @@ +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<'r, 's> fn(&'r u8, &'s u8)` +LL | | _ => y, + | | ^ types differ +LL | | }; + | |_____- `match` arms have incompatible types + | + = note: expected fn pointer `for<'r, 's> fn(&'r u8, &'s u8)` + found fn pointer `for<'a> fn(&'a u8, &'a u8)` +help: consider removing the `` + | +LL - _ => y, +LL + _ => y, + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.baseleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.baseleak.stderr index 4448f9326cb94..e400b607fefd8 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.baseleak.stderr +++ b/src/test/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/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr index 4448f9326cb94..e400b607fefd8 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.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/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllleak.stderr index 4448f9326cb94..e400b607fefd8 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllleak.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllleak.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/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllnoleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllnoleak.stderr index 0d61311350e8c..e400b607fefd8 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllnoleak.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllnoleak.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/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.rs b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.rs index 2cf123cce7ffd..04b7ad9b97a09 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.rs +++ b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.rs @@ -18,7 +18,7 @@ fn foo(x: for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8, y: for<'a> fn(&'a u8, &'a u8 //[baseleak]~^ ERROR `match` arms have incompatible types //[nllleak]~^^ ERROR `match` arms have incompatible types //[basenoleak]~^^^ ERROR `match` arms have incompatible types - //[nllnoleak]~^^^^ ERROR mismatched types + //[nllnoleak]~^^^^ ERROR `match` arms have incompatible types }; } diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.baseleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.baseleak.stderr index 1c9ce115e961e..a998ca45c0cf0 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.baseleak.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.baseleak.stderr @@ -1,20 +1,25 @@ error[E0308]: `match` arms have incompatible types - --> $DIR/old-lub-glb-hr-noteq2.rs:28:14 + --> $DIR/old-lub-glb-hr-noteq2.rs:26: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 -LL | | + | | ^ 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` +help: consider removing the `` + | +LL - _ => x, +LL + _ => x, + | error: aborting due to previous error diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.basenoleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.basenoleak.stderr index 1c9ce115e961e..a998ca45c0cf0 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.basenoleak.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.basenoleak.stderr @@ -1,20 +1,25 @@ error[E0308]: `match` arms have incompatible types - --> $DIR/old-lub-glb-hr-noteq2.rs:28:14 + --> $DIR/old-lub-glb-hr-noteq2.rs:26: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 -LL | | + | | ^ 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` +help: consider removing the `` + | +LL - _ => x, +LL + _ => x, + | error: aborting due to previous error diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.nllleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.nllleak.stderr index 1c9ce115e961e..a998ca45c0cf0 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.nllleak.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.nllleak.stderr @@ -1,20 +1,25 @@ error[E0308]: `match` arms have incompatible types - --> $DIR/old-lub-glb-hr-noteq2.rs:28:14 + --> $DIR/old-lub-glb-hr-noteq2.rs:26: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 -LL | | + | | ^ 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` +help: consider removing the `` + | +LL - _ => x, +LL + _ => x, + | error: aborting due to previous error diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.nllnoleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.nllnoleak.stderr new file mode 100644 index 0000000000000..a998ca45c0cf0 --- /dev/null +++ b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.nllnoleak.stderr @@ -0,0 +1,26 @@ +error[E0308]: `match` arms have incompatible types + --> $DIR/old-lub-glb-hr-noteq2.rs:26: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` +help: consider removing the `` + | +LL - _ => x, +LL + _ => x, + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.rs b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.rs index d49b85ce05ef7..4726f17579002 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.rs +++ b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.rs @@ -17,8 +17,6 @@ //[nllnoleak] compile-flags: -Zborrowck=mir -Zno-leak-check //[basenoleak] compile-flags:-Zno-leak-check -//[nllnoleak] 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 @@ -29,6 +27,7 @@ fn foo(x: for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8, y: for<'a> fn(&'a u8, &'a u8 //[baseleak]~^ ERROR `match` arms have incompatible types //[nllleak]~^^ ERROR `match` arms have incompatible types //[basenoleak]~^^^ ERROR `match` arms have incompatible types + //[nllnoleak]~^^^^ ERROR `match` arms have incompatible types }; } diff --git a/src/test/ui/nll/issue-57642-higher-ranked-subtype.rs b/src/test/ui/nll/issue-57642-higher-ranked-subtype.rs index b222b90e4af24..36c54628317e9 100644 --- a/src/test/ui/nll/issue-57642-higher-ranked-subtype.rs +++ b/src/test/ui/nll/issue-57642-higher-ranked-subtype.rs @@ -31,7 +31,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/src/test/ui/nll/issue-57642-higher-ranked-subtype.stderr b/src/test/ui/nll/issue-57642-higher-ranked-subtype.stderr index 95811ea05b873..3c42ff99d555f 100644 --- a/src/test/ui/nll/issue-57642-higher-ranked-subtype.stderr +++ b/src/test/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 `for<'r> fn(&'r ())`, but its trait bounds were not satisfied +error[E0599]: no function or associated item named `make_g` found for fn pointer `for<'r> fn(&'r ())` in the current scope --> $DIR/issue-57642-higher-ranked-subtype.rs:34:25 | LL | let x = ::make_g(); - | ^^^^^^ function or associated item cannot be called on `for<'r> fn(&'r ())` due to unsatisfied trait bounds + | ^^^^^^ function or associated item not found in `for<'r> fn(&'r ())` | - = note: the following trait bounds were not satisfied: - `for<'r> fn(&'r ()): 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:7:1 diff --git a/src/test/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs b/src/test/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs index 527cca133956c..3425a76658c62 100644 --- a/src/test/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs +++ b/src/test/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs @@ -1,14 +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 - #![feature(nll)] use std::cell::Cell; @@ -19,6 +14,7 @@ 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); } diff --git a/src/test/ui/nll/relate_tys/hr-fn-aau-eq-abu.stderr b/src/test/ui/nll/relate_tys/hr-fn-aau-eq-abu.stderr new file mode 100644 index 0000000000000..58ebfe9173519 --- /dev/null +++ b/src/test/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:16: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/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs b/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs index 37a01f28946d2..3eb890ac45bee 100644 --- a/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs +++ b/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs @@ -30,6 +30,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 no function or associated item named `make_f` } diff --git a/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr b/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr index ed79c7df25e2a..46b54f247445e 100644 --- a/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr +++ b/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr @@ -1,20 +1,16 @@ -error: implementation of `Y` is not general enough - --> $DIR/impl-fn-ignore-binder-via-bottom.rs:32:14 +error[E0599]: no function or associated item named `make_f` found for fn pointer `for<'r> fn(&'r ())` in the current scope + --> $DIR/impl-fn-ignore-binder-via-bottom.rs:32:25 | LL | let _x = ::make_f(); - | ^^^^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + | ^^^^^^ function or associated item not found in `for<'r> fn(&'r ())` | - = note: `Y` would have to be implemented for the type `for<'r> fn(&'r ())` - = 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:32: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:18:1 | - = note: `Y` would have to be implemented for the type `for<'r> fn(&'r ())` - = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` +LL | trait Y { + | ^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to previous error +For more information about this error, try `rustc --explain E0599`.