From e5e1fadc2b9b6395a29a76396d20827ca5405809 Mon Sep 17 00:00:00 2001 From: Jack Huey <31162821+jackh726@users.noreply.github.com> Date: Sun, 22 Sep 2024 15:42:55 -0400 Subject: [PATCH] Cleanup some known-bug issues --- .../in-trait/async-generics-and-bounds.rs | 3 +-- .../in-trait/async-generics-and-bounds.stderr | 4 +-- .../ui/async-await/in-trait/async-generics.rs | 3 +-- .../in-trait/async-generics.stderr | 4 +-- .../coherence/auxiliary/parametrized-trait.rs | 3 +++ .../coherence/occurs-check/associated-type.rs | 2 +- .../orphan-check-alias.classic.stderr | 15 +++++++++++ .../coherence/orphan-check-alias.next.stderr | 15 +++++++++++ tests/ui/coherence/orphan-check-alias.rs | 25 +++++++++++++++++++ .../bugs/issue-100013.rs | 2 +- .../bugs/issue-87735.rs | 2 +- .../bugs/issue-91762.rs | 2 +- tests/ui/never_type/exhaustive_patterns.rs | 4 ++- .../ui/never_type/exhaustive_patterns.stderr | 4 +-- ...102048.stderr => issue-102048.next.stderr} | 2 +- .../next-solver/coherence/issue-102048.rs | 9 +++++-- .../implied_lifetime_wf_check.error.stderr | 12 +++++++++ .../implied_lifetime_wf_check.rs | 12 +++++---- 18 files changed, 100 insertions(+), 23 deletions(-) create mode 100644 tests/ui/coherence/orphan-check-alias.classic.stderr create mode 100644 tests/ui/coherence/orphan-check-alias.next.stderr create mode 100644 tests/ui/coherence/orphan-check-alias.rs rename tests/ui/traits/next-solver/coherence/{issue-102048.stderr => issue-102048.next.stderr} (96%) create mode 100644 tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.error.stderr diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.rs b/tests/ui/async-await/in-trait/async-generics-and-bounds.rs index aede820f6fd06..89f6e057aaac1 100644 --- a/tests/ui/async-await/in-trait/async-generics-and-bounds.rs +++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.rs @@ -1,5 +1,4 @@ -//@ check-fail -//@ known-bug: #102682 +//@ known-bug: #130935 //@ edition: 2021 use std::fmt::Debug; diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr index b547da7126a44..183b0fa152aa3 100644 --- a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr +++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr @@ -1,5 +1,5 @@ error[E0311]: the parameter type `T` may not live long enough - --> $DIR/async-generics-and-bounds.rs:9:5 + --> $DIR/async-generics-and-bounds.rs:8:5 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: Debug + Sized, U: Has | ++++ ++ ++ +++++++ error[E0311]: the parameter type `U` may not live long enough - --> $DIR/async-generics-and-bounds.rs:9:5 + --> $DIR/async-generics-and-bounds.rs:8:5 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/async-await/in-trait/async-generics.rs b/tests/ui/async-await/in-trait/async-generics.rs index eedc63fa24c60..2302407e1ebe2 100644 --- a/tests/ui/async-await/in-trait/async-generics.rs +++ b/tests/ui/async-await/in-trait/async-generics.rs @@ -1,5 +1,4 @@ -//@ check-fail -//@ known-bug: #102682 +//@ known-bug: #130935 //@ edition: 2021 trait MyTrait { diff --git a/tests/ui/async-await/in-trait/async-generics.stderr b/tests/ui/async-await/in-trait/async-generics.stderr index 2e29a9bcc77a7..8916ef5ab6830 100644 --- a/tests/ui/async-await/in-trait/async-generics.stderr +++ b/tests/ui/async-await/in-trait/async-generics.stderr @@ -1,5 +1,5 @@ error[E0311]: the parameter type `T` may not live long enough - --> $DIR/async-generics.rs:6:5 + --> $DIR/async-generics.rs:5:5 | LL | async fn foo(&self) -> &(T, U); | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: 'a; | ++++ ++ ++ +++++++++++ error[E0311]: the parameter type `U` may not live long enough - --> $DIR/async-generics.rs:6:5 + --> $DIR/async-generics.rs:5:5 | LL | async fn foo(&self) -> &(T, U); | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/coherence/auxiliary/parametrized-trait.rs b/tests/ui/coherence/auxiliary/parametrized-trait.rs index 88a3d5cd52dc0..f9dbdd4ff1851 100644 --- a/tests/ui/coherence/auxiliary/parametrized-trait.rs +++ b/tests/ui/coherence/auxiliary/parametrized-trait.rs @@ -1,2 +1,5 @@ pub trait Trait0 {} pub trait Trait1 {} +pub trait Trait2 { + type Assoc; +} diff --git a/tests/ui/coherence/occurs-check/associated-type.rs b/tests/ui/coherence/occurs-check/associated-type.rs index df03d5f60a028..4441c38ba6d6f 100644 --- a/tests/ui/coherence/occurs-check/associated-type.rs +++ b/tests/ui/coherence/occurs-check/associated-type.rs @@ -1,7 +1,7 @@ //@ revisions: old next //@[next] compile-flags: -Znext-solver -// A regression test for #105787 +// A (partial) regression test for #105787 // Using the higher ranked projection hack to prevent us from replacing the projection // with an inference variable. diff --git a/tests/ui/coherence/orphan-check-alias.classic.stderr b/tests/ui/coherence/orphan-check-alias.classic.stderr new file mode 100644 index 0000000000000..3fd62b05b4df0 --- /dev/null +++ b/tests/ui/coherence/orphan-check-alias.classic.stderr @@ -0,0 +1,15 @@ +warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`B`) + --> $DIR/orphan-check-alias.rs:21:6 + | +LL | impl foreign::Trait2 for ::Assoc { + | ^ type parameter `T` must be covered by another type when it appears before the first local type (`B`) + | + = 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 #124559 + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type + = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = note: `#[warn(uncovered_param_in_projection)]` on by default + +warning: 1 warning emitted + +For more information about this error, try `rustc --explain E0210`. diff --git a/tests/ui/coherence/orphan-check-alias.next.stderr b/tests/ui/coherence/orphan-check-alias.next.stderr new file mode 100644 index 0000000000000..3fd62b05b4df0 --- /dev/null +++ b/tests/ui/coherence/orphan-check-alias.next.stderr @@ -0,0 +1,15 @@ +warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`B`) + --> $DIR/orphan-check-alias.rs:21:6 + | +LL | impl foreign::Trait2 for ::Assoc { + | ^ type parameter `T` must be covered by another type when it appears before the first local type (`B`) + | + = 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 #124559 + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type + = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = note: `#[warn(uncovered_param_in_projection)]` on by default + +warning: 1 warning emitted + +For more information about this error, try `rustc --explain E0210`. diff --git a/tests/ui/coherence/orphan-check-alias.rs b/tests/ui/coherence/orphan-check-alias.rs new file mode 100644 index 0000000000000..d6c9d0aa8bea1 --- /dev/null +++ b/tests/ui/coherence/orphan-check-alias.rs @@ -0,0 +1,25 @@ +// Alias might not cover type parameters. + +//@ revisions: classic next +//@[next] compile-flags: -Znext-solver + +//@ aux-crate:foreign=parametrized-trait.rs +//@ edition:2021 + +//@ known-bug: #99554 +//@ check-pass + +trait Id { + type Assoc; +} + +impl Id for T { + type Assoc = T; +} + +pub struct B; +impl foreign::Trait2 for ::Assoc { + type Assoc = usize; +} + +fn main() {} diff --git a/tests/ui/generic-associated-types/bugs/issue-100013.rs b/tests/ui/generic-associated-types/bugs/issue-100013.rs index 994f41e9f86b2..ac72c29c03b92 100644 --- a/tests/ui/generic-associated-types/bugs/issue-100013.rs +++ b/tests/ui/generic-associated-types/bugs/issue-100013.rs @@ -1,5 +1,5 @@ //@ check-fail -//@ known-bug: unknown +//@ known-bug: #100013 //@ edition: 2021 // We really should accept this, but we need implied bounds between the regions diff --git a/tests/ui/generic-associated-types/bugs/issue-87735.rs b/tests/ui/generic-associated-types/bugs/issue-87735.rs index e864ad7c815dd..0a24151cda77b 100644 --- a/tests/ui/generic-associated-types/bugs/issue-87735.rs +++ b/tests/ui/generic-associated-types/bugs/issue-87735.rs @@ -1,5 +1,5 @@ //@ check-fail -//@ known-bug: #87735, #88526 +//@ known-bug: unknown // This should pass, but we need an extension of implied bounds (probably). diff --git a/tests/ui/generic-associated-types/bugs/issue-91762.rs b/tests/ui/generic-associated-types/bugs/issue-91762.rs index b4799eb12f466..77bd275fa88e7 100644 --- a/tests/ui/generic-associated-types/bugs/issue-91762.rs +++ b/tests/ui/generic-associated-types/bugs/issue-91762.rs @@ -1,5 +1,5 @@ //@ check-fail -//@ known-bug: unknown +//@ known-bug: #91762 // We almost certainly want this to pass, but // it's particularly difficult currently, because we need a way of specifying diff --git a/tests/ui/never_type/exhaustive_patterns.rs b/tests/ui/never_type/exhaustive_patterns.rs index 3c53ac319b4a4..b56eab6cb9d94 100644 --- a/tests/ui/never_type/exhaustive_patterns.rs +++ b/tests/ui/never_type/exhaustive_patterns.rs @@ -1,5 +1,4 @@ //@ check-fail -//@ known-bug: #104034 #![feature(exhaustive_patterns, never_type)] @@ -17,5 +16,8 @@ fn foo() -> Either<(), !> { } fn main() { + // We can't treat this a irrefutable, because `Either::B` could become + // inhabited in the future because it's private. let Either::A(()) = foo(); + //~^ error refutable pattern in local binding } diff --git a/tests/ui/never_type/exhaustive_patterns.stderr b/tests/ui/never_type/exhaustive_patterns.stderr index ee7d9070cd325..1314cbc52f881 100644 --- a/tests/ui/never_type/exhaustive_patterns.stderr +++ b/tests/ui/never_type/exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding - --> $DIR/exhaustive_patterns.rs:20:9 + --> $DIR/exhaustive_patterns.rs:21:9 | LL | let Either::A(()) = foo(); | ^^^^^^^^^^^^^ pattern `Either::B(_)` not covered @@ -7,7 +7,7 @@ LL | let Either::A(()) = foo(); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html note: `Either<(), !>` defined here - --> $DIR/exhaustive_patterns.rs:10:6 + --> $DIR/exhaustive_patterns.rs:9:6 | LL | enum Either { | ^^^^^^ diff --git a/tests/ui/traits/next-solver/coherence/issue-102048.stderr b/tests/ui/traits/next-solver/coherence/issue-102048.next.stderr similarity index 96% rename from tests/ui/traits/next-solver/coherence/issue-102048.stderr rename to tests/ui/traits/next-solver/coherence/issue-102048.next.stderr index 4e93ae2849695..39fde307f23f1 100644 --- a/tests/ui/traits/next-solver/coherence/issue-102048.stderr +++ b/tests/ui/traits/next-solver/coherence/issue-102048.next.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Trait fn(<_ as WithAssoc1<'a>>::Assoc, <_ as WithAssoc2<'a>>::Assoc)>` for type `(_, _)` - --> $DIR/issue-102048.rs:39:1 + --> $DIR/issue-102048.rs:44:1 | LL | / impl Trait fn(>::Assoc, >::Assoc)> for (T, U) LL | | where diff --git a/tests/ui/traits/next-solver/coherence/issue-102048.rs b/tests/ui/traits/next-solver/coherence/issue-102048.rs index 64b223822c6ec..16ae5d98488d0 100644 --- a/tests/ui/traits/next-solver/coherence/issue-102048.rs +++ b/tests/ui/traits/next-solver/coherence/issue-102048.rs @@ -17,7 +17,12 @@ // that to `i32`. We then try to unify `i32` from `impl1` with `u32` from `impl2` which fails, // causing coherence to consider these two impls distinct. -//@ compile-flags: -Znext-solver +//@ revisions: classic next +//@[next] compile-flags: -Znext-solver + +//@[classic] known-bug: #102048 +//@[classic] check-pass + pub trait Trait {} pub trait WithAssoc1<'a> { @@ -37,7 +42,7 @@ where // impl 2 impl Trait fn(>::Assoc, u32)> for (T, U) where - U: for<'a> WithAssoc1<'a> //~^ ERROR conflicting implementations of trait + U: for<'a> WithAssoc1<'a> //[next]~^ ERROR conflicting implementations of trait { } diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.error.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.error.stderr new file mode 100644 index 0000000000000..a97227e481efc --- /dev/null +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.error.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Yay` for type `Alias` + --> $DIR/implied_lifetime_wf_check.rs:26:1 + | +LL | impl Yay for <() as HideIt>::Assoc {} + | ---------------------------------- first implementation here +LL | #[cfg(error)] +LL | impl Yay for i32 {} + | ^^^^^^^^^^^^^^^^ conflicting implementation for `Alias` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.rs b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.rs index bc9d760cd2979..d85c7f60023ee 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.rs +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.rs @@ -1,8 +1,9 @@ #![feature(type_alias_impl_trait)] -//@ known-bug: #99840 -// this should not compile -//@ check-pass +//@ revisions: pass error + +//@[pass] check-pass +//@[error] check-fail type Alias = impl Sized; @@ -21,7 +22,8 @@ impl HideIt for () { pub trait Yay {} impl Yay for <() as HideIt>::Assoc {} -// impl Yay for i32 {} // this already errors -// impl Yay for u32 {} // this also already errors +#[cfg(error)] +impl Yay for i32 {} +//[error]~^ error conflicting implementations fn main() {}