Skip to content

Commit 55dc44a

Browse files
committed
Cleanup some known-bug issues
1 parent 8ed95d1 commit 55dc44a

18 files changed

+102
-21
lines changed

tests/ui/async-await/in-trait/async-generics-and-bounds.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
//@ check-fail
2-
//@ known-bug: #102682
32
//@ edition: 2021
43

54
use std::fmt::Debug;
65
use std::hash::Hash;
76

87
trait MyTrait<T, U> {
98
async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
9+
//~^ error the parameter
10+
//~| error the parameter
1011
}
1112

1213
impl<T, U> MyTrait<T, U> for (T, U) {

tests/ui/async-await/in-trait/async-generics-and-bounds.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0311]: the parameter type `T` may not live long enough
2-
--> $DIR/async-generics-and-bounds.rs:9:5
2+
--> $DIR/async-generics-and-bounds.rs:8:5
33
|
44
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
55
| ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -13,7 +13,7 @@ LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: Debug + Sized, U: Has
1313
| ++++ ++ ++ +++++++
1414

1515
error[E0311]: the parameter type `U` may not live long enough
16-
--> $DIR/async-generics-and-bounds.rs:9:5
16+
--> $DIR/async-generics-and-bounds.rs:8:5
1717
|
1818
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
1919
| ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/async-await/in-trait/async-generics.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
//@ check-fail
2-
//@ known-bug: #102682
32
//@ edition: 2021
43

54
trait MyTrait<T, U> {
65
async fn foo(&self) -> &(T, U);
6+
//~^ error the parameter
7+
//~| error the parameter
78
}
89

910
impl<T, U> MyTrait<T, U> for (T, U) {

tests/ui/async-await/in-trait/async-generics.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0311]: the parameter type `T` may not live long enough
2-
--> $DIR/async-generics.rs:6:5
2+
--> $DIR/async-generics.rs:5:5
33
|
44
LL | async fn foo(&self) -> &(T, U);
55
| ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^
@@ -13,7 +13,7 @@ LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: 'a;
1313
| ++++ ++ ++ +++++++++++
1414

1515
error[E0311]: the parameter type `U` may not live long enough
16-
--> $DIR/async-generics.rs:6:5
16+
--> $DIR/async-generics.rs:5:5
1717
|
1818
LL | async fn foo(&self) -> &(T, U);
1919
| ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
pub trait Trait0<T, U, V> {}
22
pub trait Trait1<T, U> {}
3+
pub trait Trait2<T, U> {
4+
type Assoc;
5+
}

tests/ui/coherence/occurs-check/associated-type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ revisions: old next
22
//@[next] compile-flags: -Znext-solver
33

4-
// A regression test for #105787
4+
// A (partial) regression test for #105787
55

66
// Using the higher ranked projection hack to prevent us from replacing the projection
77
// with an inference variable.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`B`)
2+
--> $DIR/orphan-check-alias.rs:21:6
3+
|
4+
LL | impl<T> foreign::Trait2<B, T> for <T as Id>::Assoc {
5+
| ^ type parameter `T` must be covered by another type when it appears before the first local type (`B`)
6+
|
7+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8+
= note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559>
9+
= 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
10+
= note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last
11+
= note: `#[warn(uncovered_param_in_projection)]` on by default
12+
13+
warning: 1 warning emitted
14+
15+
For more information about this error, try `rustc --explain E0210`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`B`)
2+
--> $DIR/orphan-check-alias.rs:21:6
3+
|
4+
LL | impl<T> foreign::Trait2<B, T> for <T as Id>::Assoc {
5+
| ^ type parameter `T` must be covered by another type when it appears before the first local type (`B`)
6+
|
7+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8+
= note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559>
9+
= 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
10+
= note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last
11+
= note: `#[warn(uncovered_param_in_projection)]` on by default
12+
13+
warning: 1 warning emitted
14+
15+
For more information about this error, try `rustc --explain E0210`.
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Alias might not cover type parameters.
2+
3+
//@ revisions: classic next
4+
//@[next] compile-flags: -Znext-solver
5+
6+
//@ aux-crate:foreign=parametrized-trait.rs
7+
//@ edition:2021
8+
9+
//@ known-bug: #99554
10+
//@ check-pass
11+
12+
trait Id {
13+
type Assoc;
14+
}
15+
16+
impl<T> Id for T {
17+
type Assoc = T;
18+
}
19+
20+
pub struct B;
21+
impl<T> foreign::Trait2<B, T> for <T as Id>::Assoc {
22+
type Assoc = usize;
23+
}
24+
25+
fn main() {}

tests/ui/generic-associated-types/bugs/issue-100013.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ check-fail
2-
//@ known-bug: unknown
2+
//@ known-bug: #100013
33
//@ edition: 2021
44

55
// We really should accept this, but we need implied bounds between the regions

tests/ui/generic-associated-types/bugs/issue-87735.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ check-fail
2-
//@ known-bug: #87735, #88526
2+
//@ known-bug: unknown
33

44
// This should pass, but we need an extension of implied bounds (probably).
55

tests/ui/generic-associated-types/bugs/issue-91762.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ check-fail
2-
//@ known-bug: unknown
2+
//@ known-bug: #91762
33

44
// We almost certainly want this to pass, but
55
// it's particularly difficult currently, because we need a way of specifying

tests/ui/never_type/exhaustive_patterns.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ check-fail
2-
//@ known-bug: #104034
32

43
#![feature(exhaustive_patterns, never_type)]
54

@@ -17,5 +16,8 @@ fn foo() -> Either<(), !> {
1716
}
1817

1918
fn main() {
19+
// We can't treat this a irrefutable, because `Either::B` could become
20+
// inhabited in the future because it's private.
2021
let Either::A(()) = foo();
22+
//~^ error refutable pattern in local binding
2123
}

tests/ui/never_type/exhaustive_patterns.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0005]: refutable pattern in local binding
2-
--> $DIR/exhaustive_patterns.rs:20:9
2+
--> $DIR/exhaustive_patterns.rs:21:9
33
|
44
LL | let Either::A(()) = foo();
55
| ^^^^^^^^^^^^^ pattern `Either::B(_)` not covered
66
|
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
88
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
99
note: `Either<(), !>` defined here
10-
--> $DIR/exhaustive_patterns.rs:10:6
10+
--> $DIR/exhaustive_patterns.rs:9:6
1111
|
1212
LL | enum Either<A, B> {
1313
| ^^^^^^

tests/ui/traits/next-solver/coherence/issue-102048.stderr renamed to tests/ui/traits/next-solver/coherence/issue-102048.next.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0119]: conflicting implementations of trait `Trait<for<'a> fn(<_ as WithAssoc1<'a>>::Assoc, <_ as WithAssoc2<'a>>::Assoc)>` for type `(_, _)`
2-
--> $DIR/issue-102048.rs:39:1
2+
--> $DIR/issue-102048.rs:44:1
33
|
44
LL | / impl<T, U> Trait<for<'a> fn(<T as WithAssoc1<'a>>::Assoc, <U as WithAssoc2<'a>>::Assoc)> for (T, U)
55
LL | | where

tests/ui/traits/next-solver/coherence/issue-102048.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
// that to `i32`. We then try to unify `i32` from `impl1` with `u32` from `impl2` which fails,
1818
// causing coherence to consider these two impls distinct.
1919

20-
//@ compile-flags: -Znext-solver
20+
//@ revisions: classic next
21+
//@[next] compile-flags: -Znext-solver
22+
23+
//@[classic] known-bug: #102048
24+
//@[classic] check-pass
25+
2126
pub trait Trait<T> {}
2227

2328
pub trait WithAssoc1<'a> {
@@ -37,7 +42,7 @@ where
3742

3843
// impl 2
3944
impl<T, U> Trait<for<'a> fn(<U as WithAssoc1<'a>>::Assoc, u32)> for (T, U) where
40-
U: for<'a> WithAssoc1<'a> //~^ ERROR conflicting implementations of trait
45+
U: for<'a> WithAssoc1<'a> //[next]~^ ERROR conflicting implementations of trait
4146
{
4247
}
4348

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0119]: conflicting implementations of trait `Yay` for type `Alias`
2+
--> $DIR/implied_lifetime_wf_check.rs:26:1
3+
|
4+
LL | impl Yay for <() as HideIt>::Assoc {}
5+
| ---------------------------------- first implementation here
6+
LL | #[cfg(error)]
7+
LL | impl Yay for i32 {}
8+
| ^^^^^^^^^^^^^^^^ conflicting implementation for `Alias`
9+
10+
error: aborting due to 1 previous error
11+
12+
For more information about this error, try `rustc --explain E0119`.

tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#![feature(type_alias_impl_trait)]
22

3-
//@ known-bug: #99840
4-
// this should not compile
5-
//@ check-pass
3+
//@ revisions: pass error
4+
5+
//@[pass] check-pass
6+
//@[error] check-fail
67

78
type Alias = impl Sized;
89

@@ -21,7 +22,8 @@ impl HideIt for () {
2122
pub trait Yay {}
2223

2324
impl Yay for <() as HideIt>::Assoc {}
24-
// impl Yay for i32 {} // this already errors
25-
// impl Yay for u32 {} // this also already errors
25+
#[cfg(error)]
26+
impl Yay for i32 {}
27+
//[error]~^ error conflicting implementations
2628

2729
fn main() {}

0 commit comments

Comments
 (0)