Add tests for pretty-printing inherent projections
This commit is contained in:
parent
d5699874dc
commit
4a63b07d24
14
tests/ui/associated-inherent-types/issue-111879-0.rs
Normal file
14
tests/ui/associated-inherent-types/issue-111879-0.rs
Normal file
@ -0,0 +1,14 @@
|
||||
#![feature(inherent_associated_types)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
// Check that we don't crash when printing inherent projections in diagnostics.
|
||||
|
||||
pub struct Carrier<'a>(&'a ());
|
||||
|
||||
pub type User = for<'b> fn(Carrier<'b>::Focus<i32>);
|
||||
|
||||
impl<'a> Carrier<'a> {
|
||||
pub type Focus<T> = &'a mut User; //~ ERROR overflow evaluating associated type
|
||||
}
|
||||
|
||||
fn main() {}
|
8
tests/ui/associated-inherent-types/issue-111879-0.stderr
Normal file
8
tests/ui/associated-inherent-types/issue-111879-0.stderr
Normal file
@ -0,0 +1,8 @@
|
||||
error: overflow evaluating associated type `Carrier<'b>::Focus<i32>`
|
||||
--> $DIR/issue-111879-0.rs:11:25
|
||||
|
|
||||
LL | pub type Focus<T> = &'a mut User;
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
12
tests/ui/associated-inherent-types/issue-111879-1.rs
Normal file
12
tests/ui/associated-inherent-types/issue-111879-1.rs
Normal file
@ -0,0 +1,12 @@
|
||||
#![feature(inherent_associated_types)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
// Check that we don't crash when printing inherent projections in diagnostics.
|
||||
|
||||
struct Foo<T>(T);
|
||||
|
||||
impl<'a> Foo<fn(&'a ())> {
|
||||
type Assoc = &'a ();
|
||||
}
|
||||
|
||||
fn main(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {} //~ ERROR `main` function has wrong type
|
12
tests/ui/associated-inherent-types/issue-111879-1.stderr
Normal file
12
tests/ui/associated-inherent-types/issue-111879-1.stderr
Normal file
@ -0,0 +1,12 @@
|
||||
error[E0580]: `main` function has wrong type
|
||||
--> $DIR/issue-111879-1.rs:12:1
|
||||
|
|
||||
LL | fn main(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
||||
|
|
||||
= note: expected fn pointer `fn()`
|
||||
found fn pointer `fn(for<'a> fn(Foo<fn(&'a ())>::Assoc))`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0580`.
|
Loading…
Reference in New Issue
Block a user