From d3f982d46601c559c7f6ffd7155fcedfc1afc5e1 Mon Sep 17 00:00:00 2001 From: lcnr Date: Sat, 21 Sep 2024 07:04:42 +0000 Subject: [PATCH] rebase and update fixed `crashes` --- tests/crashes/118987.rs | 17 ------------ .../default-impl-normalization-ambig-2.rs} | 4 ++- .../default-impl-normalization-ambig-2.stderr | 21 +++++++++++++++ .../default-item-normalization-ambig-1.rs} | 5 ++-- .../default-item-normalization-ambig-1.stderr | 21 +++++++++++++++ .../coherence-bikeshed-intrinsic-from.rs} | 4 ++- .../coherence-bikeshed-intrinsic-from.stderr | 27 +++++++++++++++++++ 7 files changed, 78 insertions(+), 21 deletions(-) delete mode 100644 tests/crashes/118987.rs rename tests/{crashes/118987-2.rs => ui/specialization/coherence/default-impl-normalization-ambig-2.rs} (74%) create mode 100644 tests/ui/specialization/coherence/default-impl-normalization-ambig-2.stderr rename tests/{crashes/74299.rs => ui/specialization/coherence/default-item-normalization-ambig-1.rs} (56%) create mode 100644 tests/ui/specialization/coherence/default-item-normalization-ambig-1.stderr rename tests/{crashes/124207.rs => ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.rs} (62%) create mode 100644 tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr diff --git a/tests/crashes/118987.rs b/tests/crashes/118987.rs deleted file mode 100644 index 4382a7bcb63..00000000000 --- a/tests/crashes/118987.rs +++ /dev/null @@ -1,17 +0,0 @@ -//@ known-bug: #118987 -#![feature(specialization)] //~ WARN the feature `specialization` is incomplete - -trait Assoc { - type Output; -} - -default impl Assoc for T { - type Output = bool; -} - -impl Assoc for u8 {} - -trait Foo {} - -impl Foo for ::Output {} -impl Foo for ::Output {} diff --git a/tests/crashes/118987-2.rs b/tests/ui/specialization/coherence/default-impl-normalization-ambig-2.rs similarity index 74% rename from tests/crashes/118987-2.rs rename to tests/ui/specialization/coherence/default-impl-normalization-ambig-2.rs index 4382a7bcb63..1691530fa0a 100644 --- a/tests/crashes/118987-2.rs +++ b/tests/ui/specialization/coherence/default-impl-normalization-ambig-2.rs @@ -1,4 +1,4 @@ -//@ known-bug: #118987 +// regression test for #118987 #![feature(specialization)] //~ WARN the feature `specialization` is incomplete trait Assoc { @@ -15,3 +15,5 @@ trait Foo {} impl Foo for ::Output {} impl Foo for ::Output {} +//~^ ERROR the trait bound `u16: Assoc` is not satisfied +fn main() {} diff --git a/tests/ui/specialization/coherence/default-impl-normalization-ambig-2.stderr b/tests/ui/specialization/coherence/default-impl-normalization-ambig-2.stderr new file mode 100644 index 00000000000..a2fca2ef5b6 --- /dev/null +++ b/tests/ui/specialization/coherence/default-impl-normalization-ambig-2.stderr @@ -0,0 +1,21 @@ +warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/default-impl-normalization-ambig-2.rs:2:12 + | +LL | #![feature(specialization)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #31844 for more information + = help: consider using `min_specialization` instead, which is more stable and complete + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the trait bound `u16: Assoc` is not satisfied + --> $DIR/default-impl-normalization-ambig-2.rs:17:14 + | +LL | impl Foo for ::Output {} + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Assoc` is not implemented for `u16` + | + = help: the trait `Assoc` is implemented for `u8` + +error: aborting due to 1 previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/crashes/74299.rs b/tests/ui/specialization/coherence/default-item-normalization-ambig-1.rs similarity index 56% rename from tests/crashes/74299.rs rename to tests/ui/specialization/coherence/default-item-normalization-ambig-1.rs index 0e2ddce1c5b..af7cf332d5f 100644 --- a/tests/crashes/74299.rs +++ b/tests/ui/specialization/coherence/default-item-normalization-ambig-1.rs @@ -1,5 +1,5 @@ -//@ known-bug: #74299 -#![feature(specialization)] +// regression test for #73299. +#![feature(specialization)] //~ WARN the feature `specialization` is incomplete trait X { type U; @@ -18,6 +18,7 @@ fn g(&self) {} impl Y for <() as X>::U {} impl Y for ::U {} +//~^ ERROR conflicting implementations of trait `Y` for type `<() as X>::U` fn main() { ().f().g(); diff --git a/tests/ui/specialization/coherence/default-item-normalization-ambig-1.stderr b/tests/ui/specialization/coherence/default-item-normalization-ambig-1.stderr new file mode 100644 index 00000000000..a15151cc9c4 --- /dev/null +++ b/tests/ui/specialization/coherence/default-item-normalization-ambig-1.stderr @@ -0,0 +1,21 @@ +warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/default-item-normalization-ambig-1.rs:2:12 + | +LL | #![feature(specialization)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #31844 for more information + = help: consider using `min_specialization` instead, which is more stable and complete + = note: `#[warn(incomplete_features)]` on by default + +error[E0119]: conflicting implementations of trait `Y` for type `<() as X>::U` + --> $DIR/default-item-normalization-ambig-1.rs:20:1 + | +LL | impl Y for <() as X>::U {} + | ----------------------- first implementation here +LL | impl Y for ::U {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<() as X>::U` + +error: aborting due to 1 previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/crashes/124207.rs b/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.rs similarity index 62% rename from tests/crashes/124207.rs rename to tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.rs index a11eedb140a..0cebc99cd41 100644 --- a/tests/crashes/124207.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.rs @@ -1,9 +1,11 @@ -//@ known-bug: #124207 #![feature(transmutability)] #![feature(type_alias_impl_trait)] trait OpaqueTrait {} type OpaqueType = impl OpaqueTrait; +//~^ ERROR unconstrained opaque type trait AnotherTrait {} impl> AnotherTrait for T {} +//~^ ERROR type provided when a constant was expected impl AnotherTrait for OpaqueType {} +//~^ ERROR conflicting implementations of trait `AnotherTrait` pub fn main() {} diff --git a/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr b/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr new file mode 100644 index 00000000000..2424541af23 --- /dev/null +++ b/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr @@ -0,0 +1,27 @@ +error: unconstrained opaque type + --> $DIR/coherence-bikeshed-intrinsic-from.rs:4:19 + | +LL | type OpaqueType = impl OpaqueTrait; + | ^^^^^^^^^^^^^^^^ + | + = note: `OpaqueType` must be used in combination with a concrete type within the same module + +error[E0747]: type provided when a constant was expected + --> $DIR/coherence-bikeshed-intrinsic-from.rs:7:37 + | +LL | impl> AnotherTrait for T {} + | ^^ + +error[E0119]: conflicting implementations of trait `AnotherTrait` + --> $DIR/coherence-bikeshed-intrinsic-from.rs:9:1 + | +LL | impl> AnotherTrait for T {} + | ----------------------------------------------------------- first implementation here +LL | +LL | impl AnotherTrait for OpaqueType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0119, E0747. +For more information about an error, try `rustc --explain E0119`.