-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate check-fail tests for
proc_macro::quote!
from quote
crate
- Loading branch information
Showing
13 changed files
with
163 additions
and
0 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
17 changes: 17 additions & 0 deletions
17
tests/ui/proc-macro/quote/does-not-have-iter-interpolated-dup.rs
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,17 @@ | ||
// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is | ||
// expected to be incorrect. | ||
//@ known-bug: #54722 | ||
|
||
#![feature(proc_macro_quote)] | ||
|
||
extern crate proc_macro; | ||
|
||
use proc_macro::quote; | ||
|
||
fn main() { | ||
let nonrep = ""; | ||
|
||
// Without some protection against repetitions with no iterator somewhere | ||
// inside, this would loop infinitely. | ||
quote!($($nonrep $nonrep)*); | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/ui/proc-macro/quote/does-not-have-iter-interpolated-dup.stderr
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,10 @@ | ||
error: proc macro panicked | ||
--> $DIR/does-not-have-iter-interpolated-dup.rs:16:5 | ||
| | ||
LL | quote!($($nonrep $nonrep)*); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: message: `$` must be followed by an ident or `$` in `quote!` | ||
|
||
error: aborting due to 1 previous error | ||
|
17 changes: 17 additions & 0 deletions
17
tests/ui/proc-macro/quote/does-not-have-iter-interpolated.rs
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,17 @@ | ||
// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is | ||
// expected to be incorrect. | ||
//@ known-bug: #54722 | ||
|
||
#![feature(proc_macro_quote)] | ||
|
||
extern crate proc_macro; | ||
|
||
use proc_macro::quote; | ||
|
||
fn main() { | ||
let nonrep = ""; | ||
|
||
// Without some protection against repetitions with no iterator somewhere | ||
// inside, this would loop infinitely. | ||
quote!($($nonrep)*); | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/ui/proc-macro/quote/does-not-have-iter-interpolated.stderr
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,10 @@ | ||
error: proc macro panicked | ||
--> $DIR/does-not-have-iter-interpolated.rs:16:5 | ||
| | ||
LL | quote!($($nonrep)*); | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: message: `$` must be followed by an ident or `$` in `quote!` | ||
|
||
error: aborting due to 1 previous error | ||
|
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,13 @@ | ||
// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is | ||
// expected to be incorrect. | ||
//@ known-bug: #54722 | ||
|
||
#![feature(proc_macro_quote)] | ||
|
||
extern crate proc_macro; | ||
|
||
use proc_macro::quote; | ||
|
||
fn main() { | ||
quote!($(a b),*); | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/ui/proc-macro/quote/does-not-have-iter-separated.stderr
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,10 @@ | ||
error: proc macro panicked | ||
--> $DIR/does-not-have-iter-separated.rs:12:5 | ||
| | ||
LL | quote!($(a b),*); | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= help: message: `$` must be followed by an ident or `$` in `quote!` | ||
|
||
error: aborting due to 1 previous error | ||
|
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,13 @@ | ||
// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is | ||
// expected to be incorrect. | ||
//@ known-bug: #54722 | ||
|
||
#![feature(proc_macro_quote)] | ||
|
||
extern crate proc_macro; | ||
|
||
use proc_macro::quote; | ||
|
||
fn main() { | ||
quote!($(a b)*); | ||
} |
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,10 @@ | ||
error: proc macro panicked | ||
--> $DIR/does-not-have-iter.rs:12:5 | ||
| | ||
LL | quote!($(a b)*); | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= help: message: `$` must be followed by an ident or `$` in `quote!` | ||
|
||
error: aborting due to 1 previous error | ||
|
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,12 @@ | ||
#![feature(proc_macro_quote)] | ||
|
||
extern crate proc_macro; | ||
|
||
use std::net::Ipv4Addr; | ||
|
||
use proc_macro::quote; | ||
|
||
fn main() { | ||
let ip = Ipv4Addr::LOCALHOST; | ||
let _ = quote! { $ip }; //~ ERROR the trait bound `Ipv4Addr: ToTokens` 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,24 @@ | ||
error[E0277]: the trait bound `Ipv4Addr: ToTokens` is not satisfied | ||
--> $DIR/not-quotable.rs:11:13 | ||
| | ||
LL | let _ = quote! { $ip }; | ||
| ^^^^^^^^^^^^^^ | ||
| | | ||
| the trait `ToTokens` is not implemented for `Ipv4Addr` | ||
| required by a bound introduced by this call | ||
| | ||
= help: the following other types implement trait `ToTokens`: | ||
&T | ||
&mut T | ||
Box<T> | ||
CString | ||
Cow<'_, T> | ||
Option<T> | ||
Rc<T> | ||
bool | ||
and 24 others | ||
= note: this error originates in the macro `quote` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 1 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is | ||
// expected to be incorrect. | ||
//@ known-bug: #54722 | ||
|
||
#![feature(proc_macro_quote)] | ||
|
||
extern crate proc_macro; | ||
|
||
use proc_macro::quote; | ||
|
||
struct Ipv4Addr; | ||
|
||
fn main() { | ||
let ip = Ipv4Addr; | ||
let _ = quote! { $($ip)* }; | ||
} |
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,10 @@ | ||
error: proc macro panicked | ||
--> $DIR/not-repeatable.rs:15:13 | ||
| | ||
LL | let _ = quote! { $($ip)* }; | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: message: `$` must be followed by an ident or `$` in `quote!` | ||
|
||
error: aborting due to 1 previous error | ||
|