-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recover from fn ptr tys with generic param list
- Loading branch information
Showing
6 changed files
with
228 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
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,31 @@ | ||
fn main() { | ||
type Predicate = fn<'a>(&'a str) -> bool; | ||
//~^ ERROR function pointer types may not have generic parameters | ||
|
||
type Identity = fn<T>(T) -> T; | ||
//~^ ERROR function pointer types may not have generic parameters | ||
//~| ERROR cannot find type `T` in this scope | ||
//~| ERROR cannot find type `T` in this scope | ||
|
||
let _: fn<const N: usize, 'e, Q, 'f>(); | ||
//~^ ERROR function pointer types may not have generic parameters | ||
|
||
let _: for<'outer> fn<'inner>(); | ||
//~^ ERROR function pointer types may not have generic parameters | ||
|
||
let _: for<> fn<'r>(); | ||
//~^ ERROR function pointer types may not have generic parameters | ||
|
||
type Hmm = fn<>(); | ||
//~^ ERROR function pointer types may not have generic parameters | ||
|
||
let _: extern fn<'a: 'static>(); | ||
//~^ ERROR function pointer types may not have generic parameters | ||
//~| ERROR lifetime bounds cannot be used in this context | ||
|
||
let _: for<'any> extern "C" fn<'u>(); | ||
//~^ ERROR function pointer types may not have generic parameters | ||
|
||
type QuiteBroken = fn<const>(); | ||
//~^ ERROR expected identifier, found `>` | ||
} |
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,111 @@ | ||
error: function pointer types may not have generic parameters | ||
--> $DIR/recover-fn-ptr-with-generics.rs:2:24 | ||
| | ||
LL | type Predicate = fn<'a>(&'a str) -> bool; | ||
| ^^^^ | ||
| | ||
help: consider moving the lifetime parameter to a `for` parameter list | ||
| | ||
LL - type Predicate = fn<'a>(&'a str) -> bool; | ||
LL + type Predicate = for<'a> fn(&'a str) -> bool; | ||
| | ||
|
||
error: function pointer types may not have generic parameters | ||
--> $DIR/recover-fn-ptr-with-generics.rs:5:23 | ||
| | ||
LL | type Identity = fn<T>(T) -> T; | ||
| ^^^ | ||
|
||
error: function pointer types may not have generic parameters | ||
--> $DIR/recover-fn-ptr-with-generics.rs:10:14 | ||
| | ||
LL | let _: fn<const N: usize, 'e, Q, 'f>(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
help: consider moving the lifetime parameters to a `for` parameter list | ||
| | ||
LL - let _: fn<const N: usize, 'e, Q, 'f>(); | ||
LL + let _: for<'e, 'f> fn(); | ||
| | ||
|
||
error: function pointer types may not have generic parameters | ||
--> $DIR/recover-fn-ptr-with-generics.rs:13:26 | ||
| | ||
LL | let _: for<'outer> fn<'inner>(); | ||
| ^^^^^^^^ | ||
| | ||
help: consider moving the lifetime parameter to the `for` parameter list | ||
| | ||
LL - let _: for<'outer> fn<'inner>(); | ||
LL + let _: for<'outer, 'inner> fn(); | ||
| | ||
|
||
error: function pointer types may not have generic parameters | ||
--> $DIR/recover-fn-ptr-with-generics.rs:16:20 | ||
| | ||
LL | let _: for<> fn<'r>(); | ||
| ^^^^ | ||
| | ||
help: consider moving the lifetime parameter to the `for` parameter list | ||
| | ||
LL - let _: for<> fn<'r>(); | ||
LL + let _: for<'r> fn(); | ||
| | ||
|
||
error: function pointer types may not have generic parameters | ||
--> $DIR/recover-fn-ptr-with-generics.rs:19:18 | ||
| | ||
LL | type Hmm = fn<>(); | ||
| ^^ | ||
|
||
error: function pointer types may not have generic parameters | ||
--> $DIR/recover-fn-ptr-with-generics.rs:22:21 | ||
| | ||
LL | let _: extern fn<'a: 'static>(); | ||
| ^^^^^^^^^^^^^ | ||
| | ||
help: consider moving the lifetime parameter to a `for` parameter list | ||
| | ||
LL - let _: extern fn<'a: 'static>(); | ||
LL + let _: for<'a> extern fn(); | ||
| | ||
|
||
error: function pointer types may not have generic parameters | ||
--> $DIR/recover-fn-ptr-with-generics.rs:26:35 | ||
| | ||
LL | let _: for<'any> extern "C" fn<'u>(); | ||
| ^^^^ | ||
| | ||
help: consider moving the lifetime parameter to the `for` parameter list | ||
| | ||
LL - let _: for<'any> extern "C" fn<'u>(); | ||
LL + let _: for<'any, 'u> extern "C" fn(); | ||
| | ||
|
||
error: expected identifier, found `>` | ||
--> $DIR/recover-fn-ptr-with-generics.rs:29:32 | ||
| | ||
LL | type QuiteBroken = fn<const>(); | ||
| ^ expected identifier | ||
|
||
error: lifetime bounds cannot be used in this context | ||
--> $DIR/recover-fn-ptr-with-generics.rs:22:26 | ||
| | ||
LL | let _: extern fn<'a: 'static>(); | ||
| ^^^^^^^ | ||
|
||
error[E0412]: cannot find type `T` in this scope | ||
--> $DIR/recover-fn-ptr-with-generics.rs:5:27 | ||
| | ||
LL | type Identity = fn<T>(T) -> T; | ||
| ^ not found in this scope | ||
|
||
error[E0412]: cannot find type `T` in this scope | ||
--> $DIR/recover-fn-ptr-with-generics.rs:5:33 | ||
| | ||
LL | type Identity = fn<T>(T) -> T; | ||
| ^ not found in this scope | ||
|
||
error: aborting due to 12 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0412`. |