diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index 32a713beef8..bc979b885b4 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -423,9 +423,9 @@ pub fn super_relate_tys>( let sz_a = sz_a.try_eval_usize(tcx, relation.param_env()); let sz_b = sz_b.try_eval_usize(tcx, relation.param_env()); match (sz_a, sz_b) { - (Some(sz_a_val), Some(sz_b_val)) => Err(TypeError::FixedArraySize( - expected_found(relation, sz_a_val, sz_b_val), - )), + (Some(sz_a_val), Some(sz_b_val)) if sz_a_val != sz_b_val => Err( + TypeError::FixedArraySize(expected_found(relation, sz_a_val, sz_b_val)), + ), _ => Err(err), } } diff --git a/src/test/ui/const-generics/issues/issue-69654-run-pass.rs b/src/test/ui/const-generics/issues/issue-69654-run-pass.rs index 8c0398e8a13..45318ca68fc 100644 --- a/src/test/ui/const-generics/issues/issue-69654-run-pass.rs +++ b/src/test/ui/const-generics/issues/issue-69654-run-pass.rs @@ -14,5 +14,5 @@ where fn main() { Foo::foo(); - //~^ ERROR no function or associated item + //~^ ERROR the function or associated item } diff --git a/src/test/ui/const-generics/issues/issue-69654-run-pass.stderr b/src/test/ui/const-generics/issues/issue-69654-run-pass.stderr index a95cc0f2a1c..a82a60696b3 100644 --- a/src/test/ui/const-generics/issues/issue-69654-run-pass.stderr +++ b/src/test/ui/const-generics/issues/issue-69654-run-pass.stderr @@ -1,13 +1,13 @@ -error[E0599]: no function or associated item named `foo` found for struct `Foo<{_: usize}>` in the current scope +error[E0599]: the function or associated item `foo` exists for struct `Foo<{_: usize}>`, but its trait bounds were not satisfied --> $DIR/issue-69654-run-pass.rs:16:10 | LL | struct Foo {} | -------------------------- function or associated item `foo` not found for this ... LL | Foo::foo(); - | ^^^ function or associated item not found in `Foo<{_: usize}>` + | ^^^ function or associated item cannot be called on `Foo<{_: usize}>` due to unsatisfied trait bounds | - = note: the method `foo` exists but the following trait bounds were not satisfied: + = note: the following trait bounds were not satisfied: `[u8; _]: Bar<[(); _]>` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-69654.rs b/src/test/ui/const-generics/issues/issue-69654.rs index 38fca98ad4f..b1214b12a14 100644 --- a/src/test/ui/const-generics/issues/issue-69654.rs +++ b/src/test/ui/const-generics/issues/issue-69654.rs @@ -15,5 +15,5 @@ where fn main() { Foo::foo(); - //~^ ERROR no function or associated item + //~^ ERROR the function or associated item } diff --git a/src/test/ui/const-generics/issues/issue-69654.stderr b/src/test/ui/const-generics/issues/issue-69654.stderr index 69cd0806fcd..0ce7640f685 100644 --- a/src/test/ui/const-generics/issues/issue-69654.stderr +++ b/src/test/ui/const-generics/issues/issue-69654.stderr @@ -4,16 +4,16 @@ error[E0423]: expected value, found type parameter `T` LL | impl Bar for [u8; T] {} | ^ not a value -error[E0599]: no function or associated item named `foo` found for struct `Foo<{_: usize}>` in the current scope +error[E0599]: the function or associated item `foo` exists for struct `Foo<{_: usize}>`, but its trait bounds were not satisfied --> $DIR/issue-69654.rs:17:10 | LL | struct Foo {} | -------------------------- function or associated item `foo` not found for this ... LL | Foo::foo(); - | ^^^ function or associated item not found in `Foo<{_: usize}>` + | ^^^ function or associated item cannot be called on `Foo<{_: usize}>` due to unsatisfied trait bounds | - = note: the method `foo` exists but the following trait bounds were not satisfied: + = note: the following trait bounds were not satisfied: `[u8; _]: Bar<[(); _]>` error: aborting due to 2 previous errors