-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not constraint TAITs when checking impl/trait item compatibility
- Loading branch information
1 parent
d5e7f47
commit 23cb89e
Showing
3 changed files
with
56 additions
and
0 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
26 changes: 26 additions & 0 deletions
26
src/test/ui/impl-trait/issues/issue-99348-impl-compatibility.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,26 @@ | ||
#![feature(type_alias_impl_trait)] | ||
|
||
struct Concrete; | ||
|
||
type Tait = impl Sized; | ||
|
||
impl Foo for Concrete { | ||
type Item = Concrete; | ||
//~^ mismatched types | ||
} | ||
|
||
impl Bar for Concrete { | ||
type Other = Tait; | ||
} | ||
|
||
trait Foo { | ||
type Item: Bar<Other = Self>; | ||
} | ||
|
||
trait Bar { | ||
type Other; | ||
} | ||
|
||
fn tait() -> Tait {} | ||
|
||
fn main() {} |
15 changes: 15 additions & 0 deletions
15
src/test/ui/impl-trait/issues/issue-99348-impl-compatibility.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,15 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-99348-impl-compatibility.rs:8:17 | ||
| | ||
LL | type Tait = impl Sized; | ||
| ---------- the expected opaque type | ||
... | ||
LL | type Item = Concrete; | ||
| ^^^^^^^^ types differ | ||
| | ||
= note: expected opaque type `Tait` | ||
found struct `Concrete` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |