This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed
tests/ui/associated-inherent-types Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( inherent_associated_types) ]
2+ #![ allow( incomplete_features) ]
3+
4+ // Check that we don't crash when printing inherent projections in diagnostics.
5+
6+ pub struct Carrier < ' a > ( & ' a ( ) ) ;
7+
8+ pub type User = for <' b > fn ( Carrier < ' b > :: Focus < i32 > ) ;
9+
10+ impl < ' a > Carrier < ' a > {
11+ pub type Focus < T > = & ' a mut User ; //~ ERROR overflow evaluating associated type
12+ }
13+
14+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error: overflow evaluating associated type `Carrier<'b>::Focus<i32>`
2+ --> $DIR/issue-111879-0.rs:11:25
3+ |
4+ LL | pub type Focus<T> = &'a mut User;
5+ | ^^^^^^^^^^^^
6+
7+ error: aborting due to previous error
8+
Original file line number Diff line number Diff line change 1+ #![ feature( inherent_associated_types) ]
2+ #![ allow( incomplete_features) ]
3+
4+ // Check that we don't crash when printing inherent projections in diagnostics.
5+
6+ struct Foo < T > ( T ) ;
7+
8+ impl < ' a > Foo < fn ( & ' a ( ) ) > {
9+ type Assoc = & ' a ( ) ;
10+ }
11+
12+ fn main ( _: for <' a > fn ( Foo < fn ( & ' a ( ) ) > :: Assoc ) ) { } //~ ERROR `main` function has wrong type
Original file line number Diff line number Diff line change 1+ error[E0580]: `main` function has wrong type
2+ --> $DIR/issue-111879-1.rs:12:1
3+ |
4+ LL | fn main(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
6+ |
7+ = note: expected fn pointer `fn()`
8+ found fn pointer `fn(for<'a> fn(Foo<fn(&'a ())>::Assoc))`
9+
10+ error: aborting due to previous error
11+
12+ For more information about this error, try `rustc --explain E0580`.
You can’t perform that action at this time.
0 commit comments