forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify proc macro signature validity check
- Loading branch information
1 parent
669e751
commit 9eae773
Showing
17 changed files
with
188 additions
and
284 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
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,15 @@ | ||
// force-host | ||
// no-prefer-dynamic | ||
|
||
#![crate_type = "proc-macro"] | ||
#![allow(warnings)] | ||
|
||
extern crate proc_macro; | ||
|
||
trait Project { | ||
type Assoc; | ||
} | ||
|
||
#[proc_macro] | ||
pub fn uwu() -> <() as Project>::Assoc {} | ||
//~^ ERROR the trait bound `(): Project` is not satisfied |
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,9 @@ | ||
error[E0277]: the trait bound `(): Project` is not satisfied | ||
--> $DIR/bad-projection.rs:14:17 | ||
| | ||
LL | pub fn uwu() -> <() as Project>::Assoc {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Project` is not implemented for `()` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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 |
---|---|---|
@@ -1,20 +1,29 @@ | ||
error: proc macro functions may not be `extern "C"` | ||
error: function-like proc macro has incorrect signature | ||
--> $DIR/proc-macro-abi.rs:11:1 | ||
| | ||
LL | pub extern "C" fn abi(a: TokenStream) -> TokenStream { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn | ||
| | ||
= note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` | ||
found signature `extern "C" fn(proc_macro::TokenStream) -> proc_macro::TokenStream` | ||
|
||
error: proc macro functions may not be `extern "system"` | ||
error: function-like proc macro has incorrect signature | ||
--> $DIR/proc-macro-abi.rs:17:1 | ||
| | ||
LL | pub extern "system" fn abi2(a: TokenStream) -> TokenStream { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "Rust" fn, found "system" fn | ||
| | ||
= note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` | ||
found signature `extern "system" fn(proc_macro::TokenStream) -> proc_macro::TokenStream` | ||
|
||
error: proc macro functions may not be `extern "C"` | ||
error: function-like proc macro has incorrect signature | ||
--> $DIR/proc-macro-abi.rs:23:1 | ||
| | ||
LL | pub extern fn abi3(a: TokenStream) -> TokenStream { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn | ||
| | ||
= note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` | ||
found signature `extern "C" fn(proc_macro::TokenStream) -> proc_macro::TokenStream` | ||
|
||
error: aborting due to 3 previous errors | ||
|
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
Oops, something went wrong.