-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize trait ref before orphan check
- Loading branch information
Showing
11 changed files
with
202 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub trait Trait<T, U, V> {} |
21 changes: 21 additions & 0 deletions
21
tests/ui/coherence/orphan-check-projections-dont-cover.classic.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | ||
--> $DIR/orphan-check-projections-dont-cover.rs:20:6 | ||
| | ||
LL | impl<T> foreign::Trait<Local, T, ()> for <T as Identity>::Output {} | ||
| ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | ||
| | ||
= 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<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last | ||
|
||
error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | ||
--> $DIR/orphan-check-projections-dont-cover.rs:23:6 | ||
| | ||
LL | impl<T> foreign::Trait<<T as Identity>::Output, Local, T> for Option<T> {} | ||
| ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | ||
| | ||
= 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<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0210`. |
21 changes: 21 additions & 0 deletions
21
tests/ui/coherence/orphan-check-projections-dont-cover.next.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | ||
--> $DIR/orphan-check-projections-dont-cover.rs:20:6 | ||
| | ||
LL | impl<T> foreign::Trait<Local, T, ()> for <T as Identity>::Output {} | ||
| ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | ||
| | ||
= 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<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last | ||
|
||
error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | ||
--> $DIR/orphan-check-projections-dont-cover.rs:23:6 | ||
| | ||
LL | impl<T> foreign::Trait<<T as Identity>::Output, Local, T> for Option<T> {} | ||
| ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | ||
| | ||
= 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<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0210`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Regression test for issue #99554. | ||
// Don't consider projections to cover type parameters. | ||
|
||
// revisions: classic next | ||
//[next] -Ztrait-solver=next | ||
|
||
// aux-crate:foreign=parametrized-trait.rs | ||
// edition:2021 | ||
|
||
trait Identity { | ||
type Output; | ||
} | ||
|
||
impl<T> Identity for T { | ||
type Output = T; | ||
} | ||
|
||
struct Local; | ||
|
||
impl<T> foreign::Trait<Local, T, ()> for <T as Identity>::Output {} | ||
//~^ ERROR type parameter `T` must be covered by another type | ||
|
||
impl<T> foreign::Trait<<T as Identity>::Output, Local, T> for Option<T> {} | ||
//~^ ERROR type parameter `T` must be covered by another type | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
tests/ui/coherence/orphan-check-weak-aliases-dont-cover.classic.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | ||
--> $DIR/orphan-check-weak-aliases-dont-cover.rs:16:6 | ||
| | ||
LL | impl<T> foreign::Trait<Local, T, ()> for Identity<T> {} | ||
| ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | ||
| | ||
= 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<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0210`. |
12 changes: 12 additions & 0 deletions
12
tests/ui/coherence/orphan-check-weak-aliases-dont-cover.next.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | ||
--> $DIR/orphan-check-weak-aliases-dont-cover.rs:16:6 | ||
| | ||
LL | impl<T> foreign::Trait<Local, T, ()> for Identity<T> {} | ||
| ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | ||
| | ||
= 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<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0210`. |
19 changes: 19 additions & 0 deletions
19
tests/ui/coherence/orphan-check-weak-aliases-dont-cover.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Don't consider weak aliases to cover type parameters. | ||
|
||
// revisions: classic next | ||
//[next] -Ztrait-solver=next | ||
|
||
// aux-crate:foreign=parametrized-trait.rs | ||
// edition:2021 | ||
|
||
#![feature(lazy_type_alias)] | ||
#![allow(incomplete_features)] | ||
|
||
type Identity<T> = T; | ||
|
||
struct Local; | ||
|
||
impl<T> foreign::Trait<Local, T, ()> for Identity<T> {} | ||
//~^ ERROR type parameter `T` must be covered by another type | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters