diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:25:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:25:56 +0000 |
commit | 018c4950b9406055dec02ef0fb52f132e2bb1e2c (patch) | |
tree | a835ebdf2088ef88fa681f8fad45f09922c1ae9a /tests/ui/associated-consts | |
parent | Adding debian version 1.75.0+dfsg1-5. (diff) | |
download | rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.tar.xz rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.zip |
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/associated-consts')
30 files changed, 159 insertions, 72 deletions
diff --git a/tests/ui/associated-consts/assoc-const-eq-ambiguity.rs b/tests/ui/associated-consts/assoc-const-eq-ambiguity.rs new file mode 100644 index 000000000..ac085864f --- /dev/null +++ b/tests/ui/associated-consts/assoc-const-eq-ambiguity.rs @@ -0,0 +1,19 @@ +// We used to say "ambiguous associated type" on ambiguous associated consts. +// Ensure that we now use the correct label. + +#![feature(associated_const_equality)] + +trait Trait0: Parent0<i32> + Parent0<u32> {} +trait Parent0<T> { const K: (); } + +fn take0(_: impl Trait0<K = { () }>) {} +//~^ ERROR ambiguous associated constant `K` in bounds of `Trait0` + +trait Trait1: Parent1 + Parent2 {} +trait Parent1 { const C: i32; } +trait Parent2 { const C: &'static str; } + +fn take1(_: impl Trait1<C = "?">) {} +//~^ ERROR ambiguous associated constant `C` in bounds of `Trait1` + +fn main() {} diff --git a/tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr b/tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr new file mode 100644 index 000000000..ba3a87013 --- /dev/null +++ b/tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr @@ -0,0 +1,38 @@ +error[E0222]: ambiguous associated constant `K` in bounds of `Trait0` + --> $DIR/assoc-const-eq-ambiguity.rs:9:25 + | +LL | trait Parent0<T> { const K: (); } + | ----------- + | | + | ambiguous `K` from `Parent0<u32>` + | ambiguous `K` from `Parent0<i32>` +LL | +LL | fn take0(_: impl Trait0<K = { () }>) {} + | ^^^^^^^^^^ ambiguous associated constant `K` + | + = help: consider introducing a new type parameter `T` and adding `where` constraints: + where + T: Trait0, + T: Parent0<u32>::K = { () }, + T: Parent0<i32>::K = { () } + +error[E0222]: ambiguous associated constant `C` in bounds of `Trait1` + --> $DIR/assoc-const-eq-ambiguity.rs:16:25 + | +LL | trait Parent1 { const C: i32; } + | ------------ ambiguous `C` from `Parent1` +LL | trait Parent2 { const C: &'static str; } + | --------------------- ambiguous `C` from `Parent2` +LL | +LL | fn take1(_: impl Trait1<C = "?">) {} + | ^^^^^^^ ambiguous associated constant `C` + | + = help: consider introducing a new type parameter `T` and adding `where` constraints: + where + T: Trait1, + T: Parent2::C = "?", + T: Parent1::C = "?" + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0222`. diff --git a/tests/ui/associated-consts/assoc-const-eq-missing.rs b/tests/ui/associated-consts/assoc-const-eq-missing.rs index 5e029a12d..f384927e4 100644 --- a/tests/ui/associated-consts/assoc-const-eq-missing.rs +++ b/tests/ui/associated-consts/assoc-const-eq-missing.rs @@ -11,13 +11,12 @@ impl Foo for Bar { const N: usize = 3; } - -fn foo1<F: Foo<Z=3>>() {} -//~^ ERROR associated type -fn foo2<F: Foo<Z=usize>>() {} -//~^ ERROR associated type -fn foo3<F: Foo<Z=5>>() {} -//~^ ERROR associated type +fn foo1<F: Foo<Z = 3>>() {} +//~^ ERROR associated constant `Z` not found for `Foo` +fn foo2<F: Foo<Z = usize>>() {} +//~^ ERROR associated type `Z` not found for `Foo` +fn foo3<F: Foo<Z = 5>>() {} +//~^ ERROR associated constant `Z` not found for `Foo` fn main() { foo1::<Bar>(); diff --git a/tests/ui/associated-consts/assoc-const-eq-missing.stderr b/tests/ui/associated-consts/assoc-const-eq-missing.stderr index b4bd6456c..318c85dcf 100644 --- a/tests/ui/associated-consts/assoc-const-eq-missing.stderr +++ b/tests/ui/associated-consts/assoc-const-eq-missing.stderr @@ -1,20 +1,20 @@ -error[E0220]: associated type `Z` not found for `Foo` - --> $DIR/assoc-const-eq-missing.rs:15:16 +error[E0220]: associated constant `Z` not found for `Foo` + --> $DIR/assoc-const-eq-missing.rs:14:16 | -LL | fn foo1<F: Foo<Z=3>>() {} - | ^ associated type `Z` not found +LL | fn foo1<F: Foo<Z = 3>>() {} + | ^ help: there is an associated constant with a similar name: `N` error[E0220]: associated type `Z` not found for `Foo` - --> $DIR/assoc-const-eq-missing.rs:17:16 + --> $DIR/assoc-const-eq-missing.rs:16:16 | -LL | fn foo2<F: Foo<Z=usize>>() {} +LL | fn foo2<F: Foo<Z = usize>>() {} | ^ associated type `Z` not found -error[E0220]: associated type `Z` not found for `Foo` - --> $DIR/assoc-const-eq-missing.rs:19:16 +error[E0220]: associated constant `Z` not found for `Foo` + --> $DIR/assoc-const-eq-missing.rs:18:16 | -LL | fn foo3<F: Foo<Z=5>>() {} - | ^ associated type `Z` not found +LL | fn foo3<F: Foo<Z = 5>>() {} + | ^ help: there is an associated constant with a similar name: `N` error: aborting due to 3 previous errors diff --git a/tests/ui/associated-consts/assoc-const-eq-ty-alias-noninteracting.rs b/tests/ui/associated-consts/assoc-const-eq-ty-alias-noninteracting.rs new file mode 100644 index 000000000..de9008bfc --- /dev/null +++ b/tests/ui/associated-consts/assoc-const-eq-ty-alias-noninteracting.rs @@ -0,0 +1,21 @@ +// Regression test for issue #112560. +// Respect the fact that (associated) types and constants live in different namespaces and +// therefore equality bounds involving identically named associated items don't conflict if +// their kind (type vs. const) differs. + +// FIXME(fmease): Extend this test to cover supertraits again +// once #118040 is fixed. See initial version of PR #118360. + +// check-pass + +#![feature(associated_const_equality)] + +trait Trait { + type N; + + const N: usize; +} + +fn take(_: impl Trait<N = 0, N = ()>) {} + +fn main() {} diff --git a/tests/ui/associated-consts/assoc-const-ty-mismatch.rs b/tests/ui/associated-consts/assoc-const-ty-mismatch.rs index c5d78469e..721163765 100644 --- a/tests/ui/associated-consts/assoc-const-ty-mismatch.rs +++ b/tests/ui/associated-consts/assoc-const-ty-mismatch.rs @@ -2,30 +2,30 @@ #![allow(unused)] pub trait Foo { - const N: usize; + const N: usize; } pub trait FooTy { - type T; + type T; } pub struct Bar; impl Foo for Bar { - const N: usize = 3; + const N: usize = 3; } impl FooTy for Bar { - type T = usize; + type T = usize; } -fn foo<F: Foo<N=usize>>() {} -//~^ ERROR expected associated constant bound, found type -fn foo2<F: FooTy<T=3usize>>() {} -//~^ ERROR expected associated type bound, found constant +fn foo<F: Foo<N = usize>>() {} +//~^ ERROR expected constant, found type +fn foo2<F: FooTy<T = 3usize>>() {} +//~^ ERROR expected type, found constant fn main() { - foo::<Bar>(); - foo2::<Bar>(); + foo::<Bar>(); + foo2::<Bar>(); } diff --git a/tests/ui/associated-consts/assoc-const-ty-mismatch.stderr b/tests/ui/associated-consts/assoc-const-ty-mismatch.stderr index 11198729e..b844cfc4a 100644 --- a/tests/ui/associated-consts/assoc-const-ty-mismatch.stderr +++ b/tests/ui/associated-consts/assoc-const-ty-mismatch.stderr @@ -1,26 +1,30 @@ -error: expected associated constant bound, found type - --> $DIR/assoc-const-ty-mismatch.rs:23:15 +error: expected constant, found type + --> $DIR/assoc-const-ty-mismatch.rs:23:19 | -LL | fn foo<F: Foo<N=usize>>() {} - | ^^^^^^^ +LL | fn foo<F: Foo<N = usize>>() {} + | - ^^^^^ unexpected type + | | + | expected a constant because of this associated constant | -note: associated constant defined here - --> $DIR/assoc-const-ty-mismatch.rs:5:3 +note: the associated constant is defined here + --> $DIR/assoc-const-ty-mismatch.rs:5:5 | -LL | const N: usize; - | ^^^^^^^^^^^^^^ +LL | const N: usize; + | ^^^^^^^^^^^^^^ -error: expected associated type bound, found constant - --> $DIR/assoc-const-ty-mismatch.rs:25:18 +error: expected type, found constant + --> $DIR/assoc-const-ty-mismatch.rs:25:22 | -LL | fn foo2<F: FooTy<T=3usize>>() {} - | ^^^^^^^^ +LL | fn foo2<F: FooTy<T = 3usize>>() {} + | - ^^^^^^ unexpected constant + | | + | expected a type because of this associated type | -note: associated type defined here - --> $DIR/assoc-const-ty-mismatch.rs:9:3 +note: the associated type is defined here + --> $DIR/assoc-const-ty-mismatch.rs:9:5 | -LL | type T; - | ^^^^^^ +LL | type T; + | ^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/associated-consts/associated-const-ambiguity-report.stderr b/tests/ui/associated-consts/associated-const-ambiguity-report.stderr index e39224f2c..42d722291 100644 --- a/tests/ui/associated-consts/associated-const-ambiguity-report.stderr +++ b/tests/ui/associated-consts/associated-const-ambiguity-report.stderr @@ -21,6 +21,6 @@ LL | const X: i32 = <i32 as Bar>::ID; LL | const X: i32 = <i32 as Foo>::ID; | ~~~~~~~~~~~~~~ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/associated-consts/associated-const-array-len.stderr b/tests/ui/associated-consts/associated-const-array-len.stderr index e3db45810..f804cf205 100644 --- a/tests/ui/associated-consts/associated-const-array-len.stderr +++ b/tests/ui/associated-consts/associated-const-array-len.stderr @@ -10,6 +10,6 @@ help: this trait has no implementations, consider adding one LL | trait Foo { | ^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-consts/associated-const-dead-code.stderr b/tests/ui/associated-consts/associated-const-dead-code.stderr index 7e485a314..33f5a5cee 100644 --- a/tests/ui/associated-consts/associated-const-dead-code.stderr +++ b/tests/ui/associated-consts/associated-const-dead-code.stderr @@ -12,5 +12,5 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/associated-consts/associated-const-generic-obligations.stderr b/tests/ui/associated-consts/associated-const-generic-obligations.stderr index d45868151..5ea85ff3b 100644 --- a/tests/ui/associated-consts/associated-const-generic-obligations.stderr +++ b/tests/ui/associated-consts/associated-const-generic-obligations.stderr @@ -12,6 +12,6 @@ LL | const FROM: Self::Out; = note: expected associated type `<T as Foo>::Out` found reference `&'static str` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0326`. diff --git a/tests/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr b/tests/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr index 742b81535..1304bef42 100644 --- a/tests/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr +++ b/tests/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr @@ -4,8 +4,8 @@ error[E0308]: const not compatible with trait LL | const NAME: &'a str = "unit"; | ^^^^^^^^^^^^^^^^^^^ lifetime mismatch | - = note: expected reference `&'static str` - found reference `&'a str` + = note: expected reference `&'static _` + found reference `&'a _` note: the lifetime `'a` as defined here... --> $DIR/associated-const-impl-wrong-lifetime.rs:6:6 | @@ -13,6 +13,6 @@ LL | impl<'a> Foo for &'a () { | ^^ = note: ...does not necessarily outlive the static lifetime -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/associated-consts/associated-const-impl-wrong-type.stderr b/tests/ui/associated-consts/associated-const-impl-wrong-type.stderr index f3616035f..b91b777d5 100644 --- a/tests/ui/associated-consts/associated-const-impl-wrong-type.stderr +++ b/tests/ui/associated-consts/associated-const-impl-wrong-type.stderr @@ -10,6 +10,6 @@ note: type in trait LL | const BAR: u32; | ^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0326`. diff --git a/tests/ui/associated-consts/associated-const-in-trait.stderr b/tests/ui/associated-consts/associated-const-in-trait.stderr index 60bbe385c..59acd4820 100644 --- a/tests/ui/associated-consts/associated-const-in-trait.stderr +++ b/tests/ui/associated-consts/associated-const-in-trait.stderr @@ -13,6 +13,6 @@ LL | const N: usize; | ^ ...because it contains this associated `const` = help: consider moving `N` to another trait -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/associated-consts/associated-const-no-item.stderr b/tests/ui/associated-consts/associated-const-no-item.stderr index fe27da5ac..7ded05b7b 100644 --- a/tests/ui/associated-consts/associated-const-no-item.stderr +++ b/tests/ui/associated-consts/associated-const-no-item.stderr @@ -11,6 +11,6 @@ note: `Foo` defines an item `ID`, perhaps you need to implement it LL | trait Foo { | ^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/associated-consts/associated-const-private-impl.stderr b/tests/ui/associated-consts/associated-const-private-impl.stderr index a3fa3002e..13bde56a6 100644 --- a/tests/ui/associated-consts/associated-const-private-impl.stderr +++ b/tests/ui/associated-consts/associated-const-private-impl.stderr @@ -7,6 +7,6 @@ LL | const ID: i32 = 1; LL | assert_eq!(1, bar1::Foo::ID); | ^^ private associated constant -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0624`. diff --git a/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr b/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr index 0bc019b2d..cd8303942 100644 --- a/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr +++ b/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr @@ -6,5 +6,5 @@ LL | let _array = [4; <A as Foo>::Y]; | = note: this may fail depending on what value the parameter takes -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/associated-consts/associated-const-type-parameter-arrays.stderr b/tests/ui/associated-consts/associated-const-type-parameter-arrays.stderr index 46a54a12d..7f9324035 100644 --- a/tests/ui/associated-consts/associated-const-type-parameter-arrays.stderr +++ b/tests/ui/associated-consts/associated-const-type-parameter-arrays.stderr @@ -5,7 +5,7 @@ LL | let _array: [u32; <A as Foo>::Y]; | ^ cannot perform const operation using `A` | = note: type parameters may not be used in const expressions - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/associated-consts/defaults-cyclic-fail.stderr b/tests/ui/associated-consts/defaults-cyclic-fail.stderr index e29c32f5d..9cee03041 100644 --- a/tests/ui/associated-consts/defaults-cyclic-fail.stderr +++ b/tests/ui/associated-consts/defaults-cyclic-fail.stderr @@ -27,6 +27,6 @@ LL | assert_eq!(<() as Tr>::A, 0); | ^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr index ac5ec8e05..091a50f94 100644 --- a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr +++ b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr @@ -27,6 +27,6 @@ LL | assert_eq!(<() as Tr>::B, 0); // causes the error above = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/associated-consts/double-elided.stderr b/tests/ui/associated-consts/double-elided.stderr index ba4e6a23e..67834788c 100644 --- a/tests/ui/associated-consts/double-elided.stderr +++ b/tests/ui/associated-consts/double-elided.stderr @@ -42,6 +42,6 @@ note: but the referenced data is only valid for the anonymous lifetime as define LL | const C: &&str = &""; | ^ -error: aborting due to previous error; 2 warnings emitted +error: aborting due to 1 previous error; 2 warnings emitted For more information about this error, try `rustc --explain E0491`. diff --git a/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr b/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr index f8c02420f..e946491a0 100644 --- a/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr +++ b/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr @@ -18,6 +18,6 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures LL | const ASSOC: &dyn Fn(_) = 1i32; | ^ not allowed in type signatures -error: aborting due to previous error; 1 warning emitted +error: aborting due to 1 previous error; 1 warning emitted For more information about this error, try `rustc --explain E0121`. diff --git a/tests/ui/associated-consts/issue-102335-const.stderr b/tests/ui/associated-consts/issue-102335-const.stderr index 531d15c59..b69dfd51e 100644 --- a/tests/ui/associated-consts/issue-102335-const.stderr +++ b/tests/ui/associated-consts/issue-102335-const.stderr @@ -4,6 +4,6 @@ error[E0229]: associated type bindings are not allowed here LL | type A: S<C<X = 0i32> = 34>; | ^^^^^^^^ associated type not allowed here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0229`. diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr index 4418fb755..21062fdaf 100644 --- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr +++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr @@ -38,6 +38,6 @@ LL | const BAR: u32 = IMPL_REF_BAR; = note: cycle used when running analysis passes on this crate = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr index 392cd5e34..e4abf6203 100644 --- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr +++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr @@ -38,6 +38,6 @@ LL | const BAR: u32 = DEFAULT_REF_BAR; = note: cycle used when running analysis passes on this crate = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr index 6cbddca9c..05ebd76f5 100644 --- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr +++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr @@ -38,6 +38,6 @@ LL | const BAR: u32 = TRAIT_REF_BAR; = note: cycle used when running analysis passes on this crate = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/associated-consts/issue-47814.stderr b/tests/ui/associated-consts/issue-47814.stderr index 2e4ddb811..7382426b0 100644 --- a/tests/ui/associated-consts/issue-47814.stderr +++ b/tests/ui/associated-consts/issue-47814.stderr @@ -10,5 +10,5 @@ note: not a concrete type LL | impl<'a> ArpIPv4<'a> { | ^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/associated-consts/projection-unspecified-but-bounded.stderr b/tests/ui/associated-consts/projection-unspecified-but-bounded.stderr index 8175e510a..91bfcf29c 100644 --- a/tests/ui/associated-consts/projection-unspecified-but-bounded.stderr +++ b/tests/ui/associated-consts/projection-unspecified-but-bounded.stderr @@ -12,6 +12,6 @@ note: required by a bound in `foo` LL | fn foo<T: TraitWAssocConst<A = 32>>() {} | ^^^^^^ required by this bound in `foo` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/associated-consts/shadowed-const.rs b/tests/ui/associated-consts/shadowed-const.rs index cfdb391d3..d9b565742 100644 --- a/tests/ui/associated-consts/shadowed-const.rs +++ b/tests/ui/associated-consts/shadowed-const.rs @@ -17,7 +17,7 @@ trait Baz2: Foo { trait Baz3 { const BAR: usize; const QUX: Self::BAR; - //~^ ERROR found associated const + //~^ ERROR expected type, found constant } fn main() {} diff --git a/tests/ui/associated-consts/shadowed-const.stderr b/tests/ui/associated-consts/shadowed-const.stderr index fe21d2aec..2db645b3c 100644 --- a/tests/ui/associated-consts/shadowed-const.stderr +++ b/tests/ui/associated-consts/shadowed-const.stderr @@ -1,8 +1,14 @@ -error: found associated const `BAR` when type was expected - --> $DIR/shadowed-const.rs:19:14 +error: expected type, found constant + --> $DIR/shadowed-const.rs:19:20 | LL | const QUX: Self::BAR; - | ^^^^^^^^^ + | ^^^ unexpected constant + | +note: the associated constant is defined here + --> $DIR/shadowed-const.rs:18:3 + | +LL | const BAR: usize; + | ^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error |