forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#136458 - compiler-errors:fix-3, r=<try>
Do not deduplicate list of associated types provided by dyn principal r? `@ghost`
- Loading branch information
Showing
16 changed files
with
302 additions
and
62 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
14 changes: 8 additions & 6 deletions
14
tests/ui/associated-types/associated-types-overridden-binding-2.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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
error[E0271]: expected `IntoIter<u32>` to be an iterator that yields `i32`, but it yields `u32` | ||
--> $DIR/associated-types-overridden-binding-2.rs:6:43 | ||
error: conflicting associated type bounds for `Item` when expanding trait alias | ||
--> $DIR/associated-types-overridden-binding-2.rs:6:13 | ||
| | ||
LL | trait I32Iterator = Iterator<Item = i32>; | ||
| ---------- `Item` is specified to be `i32` here | ||
... | ||
LL | let _: &dyn I32Iterator<Item = u32> = &vec![42].into_iter(); | ||
| ^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32` | ||
| | ||
= note: required for the cast from `&std::vec::IntoIter<u32>` to `&dyn Iterator<Item = u32, Item = i32>` | ||
| ^^^^^^^^^^^^^^^^----------^ | ||
| | | ||
| `Item` is specified to be `u32` here | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0271`. |
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,15 @@ | ||
//@ check-pass | ||
|
||
trait Foo: Fn(Bar) {} | ||
impl<T> Foo for T where T: Fn(Bar) {} | ||
|
||
struct Bar; | ||
impl Bar { | ||
fn bar(&self) {} | ||
} | ||
|
||
fn main() { | ||
let x: &dyn Foo = &|x| { | ||
x.bar(); | ||
}; | ||
} |
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,18 @@ | ||
//@ check-pass | ||
|
||
trait Sup<T> { | ||
type Assoc; | ||
} | ||
|
||
impl<T> Sup<T> for () { | ||
type Assoc = T; | ||
} | ||
|
||
trait Trait<A, B>: Sup<A, Assoc = A> + Sup<B, Assoc = B> {} | ||
|
||
impl<T, U> Trait<T, U> for () {} | ||
|
||
fn main() { | ||
let x: &dyn Trait<(), _> = &(); | ||
let y: &dyn Trait<_, ()> = x; | ||
} |
Oops, something went wrong.