Skip to content

Commit ab55731

Browse files
authored
Unrolled build for rust-lang#122942
Rollup merge of rust-lang#122942 - Luv-Ray:master, r=lcnr Add test in higher ranked subtype I'm a beginner in this repository, and there are some things I'm not sure about: - Is it okay that there is a warning: ``` 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) } ``` - Is it okay that there are two duplicate errors in the same line? - Did I put the test in the right place? Any suggestions would be appreciated. Fixes rust-lang#121649
2 parents 9b8d12c + 246f746 commit ab55731

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// regression test for issue #121649.
2+
3+
trait ToUnit<'a> {
4+
type Unit;
5+
}
6+
7+
trait Overlap<T> {}
8+
9+
type Assoc<'a, T> = <T as ToUnit<'a>>::Unit;
10+
11+
impl<T> Overlap<T> for T {}
12+
13+
impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
14+
//~^ ERROR 13:17: 13:49: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied [E0277]
15+
//~| ERROR 13:36: 13:48: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied [E0277]
16+
17+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
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) }
2+
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) }
3+
error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied
4+
--> $DIR/structually-relate-aliases.rs:13:36
5+
|
6+
LL | impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
7+
| ^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T`
8+
|
9+
help: consider restricting type parameter `T`
10+
|
11+
LL | impl<T: for<'a> ToUnit<'a>> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
12+
| ++++++++++++++++++++
13+
14+
error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied
15+
--> $DIR/structually-relate-aliases.rs:13:17
16+
|
17+
LL | impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
18+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T`
19+
|
20+
help: consider restricting type parameter `T`
21+
|
22+
LL | impl<T: for<'a> ToUnit<'a>> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
23+
| ++++++++++++++++++++
24+
25+
error: aborting due to 2 previous errors
26+
27+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)