-
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.
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
tests/ui/higher-ranked/subtype/structually-relate-aliases.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,15 @@ | ||
trait ToUnit<'a> { | ||
type Unit; | ||
} | ||
|
||
trait Overlap<T> {} | ||
|
||
type Assoc<'a, T> = <T as ToUnit<'a>>::Unit; | ||
|
||
impl<T> Overlap<T> for T {} | ||
|
||
impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} | ||
//~^ ERROR 11:17: 11:49: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied [E0277] | ||
//~| ERROR 11:36: 11:48: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied [E0277] | ||
|
||
fn main() {} |
27 changes: 27 additions & 0 deletions
27
tests/ui/higher-ranked/subtype/structually-relate-aliases.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,27 @@ | ||
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) } | ||
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, !2_0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) } | ||
error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied | ||
--> $DIR/structually-relate-aliases.rs:11:36 | ||
| | ||
LL | impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} | ||
| ^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T` | ||
| | ||
help: consider restricting type parameter `T` | ||
| | ||
LL | impl<T: for<'a> ToUnit<'a>> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} | ||
| ++++++++++++++++++++ | ||
|
||
error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied | ||
--> $DIR/structually-relate-aliases.rs:11:17 | ||
| | ||
LL | impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T` | ||
| | ||
help: consider restricting type parameter `T` | ||
| | ||
LL | impl<T: for<'a> ToUnit<'a>> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} | ||
| ++++++++++++++++++++ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |