Skip to content

Commit d49d347

Browse files
authored
Rollup merge of #111887 - fmease:inh-proj-pp-tests, r=compiler-errors
Add regression tests for pretty-printing inherent projections Tests for #111486. Fixes #111879. r? `@matthiaskrgr`
2 parents 8227c4f + 4a63b07 commit d49d347

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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`.

0 commit comments

Comments
 (0)