-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2540c2b
commit ed30eff
Showing
3 changed files
with
87 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// compile-flags: -Ztrait-solver=next | ||
// From #80800 | ||
|
||
trait SuperTrait { | ||
type A; | ||
type B; | ||
} | ||
|
||
trait Trait: SuperTrait<A = <Self as SuperTrait>::B> {} | ||
|
||
fn transmute<A, B>(x: A) -> B { | ||
foo::<A, B, dyn Trait<A = A, B = B>>(x) | ||
//~^ ERROR type annotations needed: cannot satisfy `dyn Trait<A = A, B = B>: Trait` | ||
} | ||
|
||
fn foo<A, B, T: ?Sized>(x: T::A) -> B | ||
where | ||
T: Trait<B = B>, | ||
{ | ||
x | ||
} | ||
|
||
static X: u8 = 0; | ||
fn main() { | ||
let x = transmute::<&u8, &[u8; 1_000_000]>(&X); | ||
println!("{:?}", x[100_000]); | ||
} |
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 @@ | ||
error[E0283]: type annotations needed: cannot satisfy `dyn Trait<A = A, B = B>: Trait` | ||
--> $DIR/more-object-bound.rs:12:5 | ||
| | ||
LL | foo::<A, B, dyn Trait<A = A, B = B>>(x) | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: cannot satisfy `dyn Trait<A = A, B = B>: Trait` | ||
note: required by a bound in `foo` | ||
--> $DIR/more-object-bound.rs:18:8 | ||
| | ||
LL | fn foo<A, B, T: ?Sized>(x: T::A) -> B | ||
| --- required by a bound in this function | ||
LL | where | ||
LL | T: Trait<B = B>, | ||
| ^^^^^^^^^^^^ required by this bound in `foo` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0283`. |