diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/ui/coherence | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/coherence')
20 files changed, 171 insertions, 46 deletions
diff --git a/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs b/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs index 20ff87549..bce3b0fd7 100644 --- a/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs +++ b/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs @@ -6,5 +6,6 @@ trait NotObjectSafe { fn eq(&self, other: Self); } impl NotObjectSafe for dyn NotObjectSafe { } //~^ ERROR E0038 +//~| ERROR E0046 fn main() { } diff --git a/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr b/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr index e9090c1b6..1dcc30ee6 100644 --- a/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr +++ b/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr @@ -13,6 +13,15 @@ LL | trait NotObjectSafe { fn eq(&self, other: Self); } | this trait cannot be made into an object... = help: consider moving `eq` to another trait -error: aborting due to previous error +error[E0046]: not all trait items implemented, missing: `eq` + --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:7:1 + | +LL | trait NotObjectSafe { fn eq(&self, other: Self); } + | -------------------------- `eq` from trait +LL | impl NotObjectSafe for dyn NotObjectSafe { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `eq` in implementation + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0046. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs b/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs index 3acf0d8d3..0e16d12a1 100644 --- a/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs +++ b/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs @@ -1,5 +1,5 @@ // revisions: stock with_negative_coherence -//[with_negative_coherence] check-pass +//[with_negative_coherence] known-bug: unknown #![feature(negative_impls)] #![cfg_attr(with_negative_coherence, feature(with_negative_coherence))] diff --git a/tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr b/tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr new file mode 100644 index 000000000..097cc4e0f --- /dev/null +++ b/tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `MyTrait<'_>` for type `&_` + --> $DIR/coherence-negative-outlives-lifetimes.rs:14:1 + | +LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {} + | ---------------------------------------------- first implementation here +LL | impl<'a, T> MyTrait<'a> for &'a T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-overlap-downstream.next.stderr b/tests/ui/coherence/coherence-overlap-downstream.next.stderr index 9d62efbc3..6c2e9466b 100644 --- a/tests/ui/coherence/coherence-overlap-downstream.next.stderr +++ b/tests/ui/coherence/coherence-overlap-downstream.next.stderr @@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32` --> $DIR/coherence-overlap-downstream.rs:17:1 | LL | impl<X, T> Foo<X> for T where T: Bar<X> {} - | ----------------------- first implementation here + | --------------------------------------- first implementation here LL | impl<X> Foo<X> for i32 {} | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` | diff --git a/tests/ui/coherence/coherence-overlap-downstream.old.stderr b/tests/ui/coherence/coherence-overlap-downstream.old.stderr index 9d62efbc3..6c2e9466b 100644 --- a/tests/ui/coherence/coherence-overlap-downstream.old.stderr +++ b/tests/ui/coherence/coherence-overlap-downstream.old.stderr @@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32` --> $DIR/coherence-overlap-downstream.rs:17:1 | LL | impl<X, T> Foo<X> for T where T: Bar<X> {} - | ----------------------- first implementation here + | --------------------------------------- first implementation here LL | impl<X> Foo<X> for i32 {} | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` | diff --git a/tests/ui/coherence/coherence-overlap-trait-alias.rs b/tests/ui/coherence/coherence-overlap-trait-alias.rs index 9d9c76af9..d42a666c5 100644 --- a/tests/ui/coherence/coherence-overlap-trait-alias.rs +++ b/tests/ui/coherence/coherence-overlap-trait-alias.rs @@ -13,8 +13,6 @@ impl B for u32 {} trait C {} impl<T: AB> C for T {} impl C for u32 {} -//~^ ERROR -// FIXME it's giving an ungreat error but unsure if we care given that it's using an internal rustc -// attribute and an artificial code path for testing purposes +//~^ ERROR conflicting implementations of trait `C` for type `u32` fn main() {} diff --git a/tests/ui/coherence/coherence-overlap-trait-alias.stderr b/tests/ui/coherence/coherence-overlap-trait-alias.stderr index 668b8319b..687f3af00 100644 --- a/tests/ui/coherence/coherence-overlap-trait-alias.stderr +++ b/tests/ui/coherence/coherence-overlap-trait-alias.stderr @@ -1,17 +1,11 @@ -error[E0283]: type annotations needed: cannot satisfy `u32: C` - --> $DIR/coherence-overlap-trait-alias.rs:15:12 - | -LL | impl C for u32 {} - | ^^^ - | -note: multiple `impl`s satisfying `u32: C` found - --> $DIR/coherence-overlap-trait-alias.rs:14:1 +error[E0119]: conflicting implementations of trait `C` for type `u32` + --> $DIR/coherence-overlap-trait-alias.rs:15:1 | LL | impl<T: AB> C for T {} - | ^^^^^^^^^^^^^^^^^^^ + | ------------------- first implementation here LL | impl C for u32 {} - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ conflicting implementation for `u32` error: aborting due to previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-overlap-upstream.stderr b/tests/ui/coherence/coherence-overlap-upstream.stderr index f6145c188..8272c8875 100644 --- a/tests/ui/coherence/coherence-overlap-upstream.stderr +++ b/tests/ui/coherence/coherence-overlap-upstream.stderr @@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i16` --> $DIR/coherence-overlap-upstream.rs:13:1 | LL | impl<T> Foo for T where T: Remote {} - | ----------------- first implementation here + | --------------------------------- first implementation here LL | impl Foo for i16 {} | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16` | diff --git a/tests/ui/coherence/coherence-overlap-with-regions.rs b/tests/ui/coherence/coherence-overlap-with-regions.rs index 32f01f418..9945c8e6c 100644 --- a/tests/ui/coherence/coherence-overlap-with-regions.rs +++ b/tests/ui/coherence/coherence-overlap-with-regions.rs @@ -1,4 +1,10 @@ -// check-pass +// known-bug: unknown + +// This fails because we currently perform negative coherence in coherence mode. +// This means that when looking for a negative predicate, we also assemble a +// coherence-unknowable predicate. Since confirming the negative impl has region +// obligations, we don't prefer the impl over the unknowable predicate +// unconditionally and instead flounder. #![feature(negative_impls)] #![feature(rustc_attrs)] diff --git a/tests/ui/coherence/coherence-overlap-with-regions.stderr b/tests/ui/coherence/coherence-overlap-with-regions.stderr new file mode 100644 index 000000000..fd25f0978 --- /dev/null +++ b/tests/ui/coherence/coherence-overlap-with-regions.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `Bar` for type `&_` + --> $DIR/coherence-overlap-with-regions.rs:20:1 + | +LL | impl<T: Foo> Bar for T {} + | ---------------------- first implementation here +LL | impl<T> Bar for &T where T: 'static {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-wasm-bindgen.stderr b/tests/ui/coherence/coherence-wasm-bindgen.stderr index 89615f0fb..600cd42d8 100644 --- a/tests/ui/coherence/coherence-wasm-bindgen.stderr +++ b/tests/ui/coherence/coherence-wasm-bindgen.stderr @@ -1,11 +1,17 @@ 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) - | ------------------------------------------------------------ first implementation here +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) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&dyn Fn(&_) -> _` +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 <https://github.com/rust-lang/rust/issues/56105> diff --git a/tests/ui/coherence/coherence-with-generator.rs b/tests/ui/coherence/coherence-with-coroutine.rs index 5eb8dc2a4..21857d7fe 100644 --- a/tests/ui/coherence/coherence-with-generator.rs +++ b/tests/ui/coherence/coherence-with-coroutine.rs @@ -1,13 +1,13 @@ // Test that encountering closures during coherence does not cause issues. -#![feature(type_alias_impl_trait, generators)] +#![feature(type_alias_impl_trait, coroutines)] #![cfg_attr(specialized, feature(specialization))] #![allow(incomplete_features)] // revisions: stock specialized // [specialized]check-pass -type OpaqueGenerator = impl Sized; -fn defining_use() -> OpaqueGenerator { +type OpaqueCoroutine = impl Sized; +fn defining_use() -> OpaqueCoroutine { || { for i in 0..10 { yield i; @@ -17,8 +17,8 @@ fn defining_use() -> OpaqueGenerator { struct Wrapper<T>(T); trait Trait {} -impl Trait for Wrapper<OpaqueGenerator> {} +impl Trait for Wrapper<OpaqueCoroutine> {} impl<T: Sync> Trait for Wrapper<T> {} -//[stock]~^ ERROR conflicting implementations of trait `Trait` for type `Wrapper<OpaqueGenerator>` +//[stock]~^ ERROR conflicting implementations of trait `Trait` for type `Wrapper<OpaqueCoroutine>` fn main() {} diff --git a/tests/ui/coherence/coherence-with-generator.stock.stderr b/tests/ui/coherence/coherence-with-coroutine.stock.stderr index 478ac4912..b2a9135c5 100644 --- a/tests/ui/coherence/coherence-with-generator.stock.stderr +++ b/tests/ui/coherence/coherence-with-coroutine.stock.stderr @@ -1,10 +1,10 @@ -error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueGenerator>` - --> $DIR/coherence-with-generator.rs:21:1 +error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueCoroutine>` + --> $DIR/coherence-with-coroutine.rs:21:1 | -LL | impl Trait for Wrapper<OpaqueGenerator> {} +LL | impl Trait for Wrapper<OpaqueCoroutine> {} | --------------------------------------- first implementation here LL | impl<T: Sync> Trait for Wrapper<T> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Wrapper<OpaqueGenerator>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Wrapper<OpaqueCoroutine>` error: aborting due to previous error diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr index 0dd28706e..9b2dbc66c 100644 --- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr +++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr @@ -1,11 +1,14 @@ error[E0119]: conflicting implementations of trait `From<()>` for type `S` --> $DIR/inter-crate-ambiguity-causes-notes.rs:12:1 | -LL | impl From<()> for S { - | ------------------- first implementation here +LL | impl From<()> for S { + | ------------------- first implementation here ... -LL | impl<I> From<I> for S - | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S` +LL | / impl<I> From<I> for S +LL | | +LL | | where +LL | | I: Iterator<Item = ()>, + | |___________________________^ conflicting implementation for `S` | = note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr index 0dd28706e..9b2dbc66c 100644 --- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr +++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr @@ -1,11 +1,14 @@ error[E0119]: conflicting implementations of trait `From<()>` for type `S` --> $DIR/inter-crate-ambiguity-causes-notes.rs:12:1 | -LL | impl From<()> for S { - | ------------------- first implementation here +LL | impl From<()> for S { + | ------------------- first implementation here ... -LL | impl<I> From<I> for S - | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S` +LL | / impl<I> From<I> for S +LL | | +LL | | where +LL | | I: Iterator<Item = ()>, + | |___________________________^ conflicting implementation for `S` | = note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions diff --git a/tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr b/tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr new file mode 100644 index 000000000..4cf50b4f2 --- /dev/null +++ b/tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Bar` for type `&_` + --> $DIR/negative-coherence-considering-regions.rs:22:1 + | +LL | impl<T> Bar for T where T: Foo {} + | ------------------------------ first implementation here +... +LL | impl<T> Bar for &T {} + | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/negative-coherence-considering-regions.rs b/tests/ui/coherence/negative-coherence-considering-regions.rs new file mode 100644 index 000000000..597a59726 --- /dev/null +++ b/tests/ui/coherence/negative-coherence-considering-regions.rs @@ -0,0 +1,29 @@ +// revisions: any_lt static_lt +//[static_lt] known-bug: unknown + +// This fails because we currently perform negative coherence in coherence mode. +// This means that when looking for a negative predicate, we also assemble a +// coherence-unknowable predicate. Since confirming the negative impl has region +// obligations, we don't prefer the impl over the unknowable predicate +// unconditionally and instead flounder. + +#![feature(negative_impls)] +#![feature(with_negative_coherence)] + +trait Foo {} + +impl<T> !Foo for &'static T {} + +trait Bar {} + +impl<T> Bar for T where T: Foo {} + +#[cfg(any_lt)] +impl<T> Bar for &T {} +//[any_lt]~^ ERROR conflicting implementations of trait `Bar` for type `&_` + +#[cfg(static_lt)] +impl<T> Bar for &'static T {} + + +fn main() {} diff --git a/tests/ui/coherence/negative-coherence-considering-regions.static_lt.stderr b/tests/ui/coherence/negative-coherence-considering-regions.static_lt.stderr new file mode 100644 index 000000000..87e7be2aa --- /dev/null +++ b/tests/ui/coherence/negative-coherence-considering-regions.static_lt.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Bar` for type `&'static _` + --> $DIR/negative-coherence-considering-regions.rs:26:1 + | +LL | impl<T> Bar for T where T: Foo {} + | ------------------------------ first implementation here +... +LL | impl<T> Bar for &'static T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&'static _` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr index 89289767b..4f32639a6 100644 --- a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr +++ b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr @@ -1,11 +1,16 @@ error: implementations of `PartialEq<Interval<_>>` for `Interval<_>` will conflict in the future --> $DIR/warn-when-cycle-is-error-in-coherence.rs:13:1 | -LL | #[derive(PartialEq, Default)] - | --------- the second impl is here +LL | #[derive(PartialEq, Default)] + | --------- the second impl is here ... -LL | impl<T, Q> PartialEq<Q> for Interval<T> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the first impl is here +LL | / impl<T, Q> PartialEq<Q> for Interval<T> +LL | | +LL | | +LL | | where +LL | | T: Borrow<Q>, +LL | | Q: ?Sized + PartialOrd, + | |___________________________^ the first impl is here | = 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 #114040 <https://github.com/rust-lang/rust/issues/114040> @@ -19,3 +24,28 @@ LL | #![deny(coinductive_overlap_in_coherence)] error: aborting due to previous error +Future incompatibility report: Future breakage diagnostic: +error: implementations of `PartialEq<Interval<_>>` for `Interval<_>` will conflict in the future + --> $DIR/warn-when-cycle-is-error-in-coherence.rs:13:1 + | +LL | #[derive(PartialEq, Default)] + | --------- the second impl is here +... +LL | / impl<T, Q> PartialEq<Q> for Interval<T> +LL | | +LL | | +LL | | where +LL | | T: Borrow<Q>, +LL | | Q: ?Sized + PartialOrd, + | |___________________________^ the first impl is here + | + = 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 #114040 <https://github.com/rust-lang/rust/issues/114040> + = note: impls that are not considered to overlap may be considered to overlap in the future + = note: `Interval<_>: PartialOrd` may be considered to hold in future releases, causing the impls to overlap +note: the lint level is defined here + --> $DIR/warn-when-cycle-is-error-in-coherence.rs:1:9 + | +LL | #![deny(coinductive_overlap_in_coherence)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + |