From d361fb6f16c37f7446326149c68688b0f939948b Mon Sep 17 00:00:00 2001 From: lcnr Date: Mon, 15 Apr 2024 18:10:46 +0200 Subject: [PATCH] rebase and update fixed `crashes` --- tests/crashes/118987.rs | 17 ------------ tests/crashes/119272.rs | 27 ------------------- tests/crashes/74299.rs | 24 ----------------- .../coherence-ice-issue-118987.rs} | 7 +++-- .../coherence-ice-issue-118987.stderr | 12 +++++++++ ...efault-items-drop-coherence.current.stderr | 2 +- ...n-default-items-drop-coherence.next.stderr | 4 +-- ...ialization-default-items-drop-coherence.rs | 2 ++ .../opaque-type-layout-ice-issue-124207.rs} | 7 ++++- ...opaque-type-layout-ice-issue-124207.stderr | 27 +++++++++++++++++++ 10 files changed, 55 insertions(+), 74 deletions(-) delete mode 100644 tests/crashes/118987.rs delete mode 100644 tests/crashes/119272.rs delete mode 100644 tests/crashes/74299.rs rename tests/{crashes/118987-2.rs => ui/specialization/defaultimpl/coherence-ice-issue-118987.rs} (69%) create mode 100644 tests/ui/specialization/defaultimpl/coherence-ice-issue-118987.stderr rename tests/{crashes/124207.rs => ui/transmutability/opaque-type-layout-ice-issue-124207.rs} (52%) create mode 100644 tests/ui/transmutability/opaque-type-layout-ice-issue-124207.stderr diff --git a/tests/crashes/118987.rs b/tests/crashes/118987.rs deleted file mode 100644 index 4382a7bcb6397..0000000000000 --- 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/119272.rs b/tests/crashes/119272.rs deleted file mode 100644 index 02e2cfd09e2f8..0000000000000 --- a/tests/crashes/119272.rs +++ /dev/null @@ -1,27 +0,0 @@ -//@ known-bug: #119272 -#![feature(type_alias_impl_trait)] -mod defining_scope { - use super::*; - pub type Alias = impl Sized; - - pub fn cast(x: Container, T>) -> Container { - x - } -} - -struct Container, U> { - x: >::Assoc, -} - -trait Trait { - type Assoc; -} - -impl Trait for T { - type Assoc = Box; -} -impl Trait for defining_scope::Alias { - type Assoc = usize; -} - -fn main() {} diff --git a/tests/crashes/74299.rs b/tests/crashes/74299.rs deleted file mode 100644 index 0e2ddce1c5b11..0000000000000 --- a/tests/crashes/74299.rs +++ /dev/null @@ -1,24 +0,0 @@ -//@ known-bug: #74299 -#![feature(specialization)] - -trait X { - type U; - fn f(&self) -> Self::U { - loop {} - } -} - -impl X for T { - default type U = (); -} - -trait Y { - fn g(&self) {} -} - -impl Y for <() as X>::U {} -impl Y for ::U {} - -fn main() { - ().f().g(); -} diff --git a/tests/crashes/118987-2.rs b/tests/ui/specialization/defaultimpl/coherence-ice-issue-118987.rs similarity index 69% rename from tests/crashes/118987-2.rs rename to tests/ui/specialization/defaultimpl/coherence-ice-issue-118987.rs index 4382a7bcb6397..2f876db81ff39 100644 --- a/tests/crashes/118987-2.rs +++ b/tests/ui/specialization/defaultimpl/coherence-ice-issue-118987.rs @@ -1,4 +1,5 @@ -//@ known-bug: #118987 +//@ check-pass +// Regression test for #118987 which previously caused an ICE. #![feature(specialization)] //~ WARN the feature `specialization` is incomplete trait Assoc { @@ -14,4 +15,6 @@ impl Assoc for u8 {} trait Foo {} impl Foo for ::Output {} -impl Foo for ::Output {} +impl Foo for u16 {} + +fn main() {} diff --git a/tests/ui/specialization/defaultimpl/coherence-ice-issue-118987.stderr b/tests/ui/specialization/defaultimpl/coherence-ice-issue-118987.stderr new file mode 100644 index 0000000000000..3b587dd7029ef --- /dev/null +++ b/tests/ui/specialization/defaultimpl/coherence-ice-issue-118987.stderr @@ -0,0 +1,12 @@ +warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/coherence-ice-issue-118987.rs:3: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 + +warning: 1 warning emitted + diff --git a/tests/ui/specialization/specialization-default-items-drop-coherence.current.stderr b/tests/ui/specialization/specialization-default-items-drop-coherence.current.stderr index 36df6bfd9fc15..c4dd57c243cdd 100644 --- a/tests/ui/specialization/specialization-default-items-drop-coherence.current.stderr +++ b/tests/ui/specialization/specialization-default-items-drop-coherence.current.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Overlap` for type `u32` - --> $DIR/specialization-default-items-drop-coherence.rs:26:1 + --> $DIR/specialization-default-items-drop-coherence.rs:28:1 | LL | impl Overlap for u32 { | -------------------- first implementation here diff --git a/tests/ui/specialization/specialization-default-items-drop-coherence.next.stderr b/tests/ui/specialization/specialization-default-items-drop-coherence.next.stderr index 3a6a16929ee8e..e52b19b645a82 100644 --- a/tests/ui/specialization/specialization-default-items-drop-coherence.next.stderr +++ b/tests/ui/specialization/specialization-default-items-drop-coherence.next.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Overlap` for type `u32` - --> $DIR/specialization-default-items-drop-coherence.rs:26:1 + --> $DIR/specialization-default-items-drop-coherence.rs:28:1 | LL | impl Overlap for u32 { | -------------------- first implementation here @@ -8,7 +8,7 @@ LL | impl Overlap for ::Id { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u32` error[E0282]: type annotations needed - --> $DIR/specialization-default-items-drop-coherence.rs:15:23 + --> $DIR/specialization-default-items-drop-coherence.rs:17:23 | LL | default type Id = T; | ^ cannot infer type for associated type `::Id` diff --git a/tests/ui/specialization/specialization-default-items-drop-coherence.rs b/tests/ui/specialization/specialization-default-items-drop-coherence.rs index bcabe45fb8db3..18d6f2054fc00 100644 --- a/tests/ui/specialization/specialization-default-items-drop-coherence.rs +++ b/tests/ui/specialization/specialization-default-items-drop-coherence.rs @@ -3,6 +3,8 @@ // Should fail. Default items completely drop candidates instead of ambiguity, // which is unsound during coherence, since coherence requires completeness. +// +// A regression test for #105782. #![feature(specialization)] #![allow(incomplete_features)] diff --git a/tests/crashes/124207.rs b/tests/ui/transmutability/opaque-type-layout-ice-issue-124207.rs similarity index 52% rename from tests/crashes/124207.rs rename to tests/ui/transmutability/opaque-type-layout-ice-issue-124207.rs index a4e1c55189006..79ad570c3d35a 100644 --- a/tests/crashes/124207.rs +++ b/tests/ui/transmutability/opaque-type-layout-ice-issue-124207.rs @@ -1,9 +1,14 @@ -//@ known-bug: #124207 +// A regression test for #124207. +// +// This previous caused an ICE in the old solver. #![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/opaque-type-layout-ice-issue-124207.stderr b/tests/ui/transmutability/opaque-type-layout-ice-issue-124207.stderr new file mode 100644 index 0000000000000..51b6c3e9fcc6b --- /dev/null +++ b/tests/ui/transmutability/opaque-type-layout-ice-issue-124207.stderr @@ -0,0 +1,27 @@ +error: unconstrained opaque type + --> $DIR/opaque-type-layout-ice-issue-124207.rs:7: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/opaque-type-layout-ice-issue-124207.rs:10:45 + | +LL | impl> AnotherTrait for T {} + | ^^ + +error[E0119]: conflicting implementations of trait `AnotherTrait` + --> $DIR/opaque-type-layout-ice-issue-124207.rs:12: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`.