Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 2ab9db5

Browse files
committed
Migrate check-fail tests for proc_macro::quote! from quote crate
1 parent e9063c3 commit 2ab9db5

13 files changed

+163
-0
lines changed

tests/ui/proc-macro/quote/auxiliary/basic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pub fn run_tests(_: TokenStream) -> TokenStream {
4747
// - quote_spanned:
4848
// - fn test_quote_spanned_impl
4949
// - fn test_type_inference_for_span
50+
// - wrong-type-span.rs
5051
// - format_ident:
5152
// - fn test_format_ident
5253
// - fn test_format_ident_strip_raw
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is
2+
// expected to be incorrect.
3+
//@ known-bug: #54722
4+
5+
#![feature(proc_macro_quote)]
6+
7+
extern crate proc_macro;
8+
9+
use proc_macro::quote;
10+
11+
fn main() {
12+
let nonrep = "";
13+
14+
// Without some protection against repetitions with no iterator somewhere
15+
// inside, this would loop infinitely.
16+
quote!($($nonrep $nonrep)*);
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: proc macro panicked
2+
--> $DIR/does-not-have-iter-interpolated-dup.rs:16:5
3+
|
4+
LL | quote!($($nonrep $nonrep)*);
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: message: `$` must be followed by an ident or `$` in `quote!`
8+
9+
error: aborting due to 1 previous error
10+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is
2+
// expected to be incorrect.
3+
//@ known-bug: #54722
4+
5+
#![feature(proc_macro_quote)]
6+
7+
extern crate proc_macro;
8+
9+
use proc_macro::quote;
10+
11+
fn main() {
12+
let nonrep = "";
13+
14+
// Without some protection against repetitions with no iterator somewhere
15+
// inside, this would loop infinitely.
16+
quote!($($nonrep)*);
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: proc macro panicked
2+
--> $DIR/does-not-have-iter-interpolated.rs:16:5
3+
|
4+
LL | quote!($($nonrep)*);
5+
| ^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: message: `$` must be followed by an ident or `$` in `quote!`
8+
9+
error: aborting due to 1 previous error
10+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is
2+
// expected to be incorrect.
3+
//@ known-bug: #54722
4+
5+
#![feature(proc_macro_quote)]
6+
7+
extern crate proc_macro;
8+
9+
use proc_macro::quote;
10+
11+
fn main() {
12+
quote!($(a b),*);
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: proc macro panicked
2+
--> $DIR/does-not-have-iter-separated.rs:12:5
3+
|
4+
LL | quote!($(a b),*);
5+
| ^^^^^^^^^^^^^^^^
6+
|
7+
= help: message: `$` must be followed by an ident or `$` in `quote!`
8+
9+
error: aborting due to 1 previous error
10+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is
2+
// expected to be incorrect.
3+
//@ known-bug: #54722
4+
5+
#![feature(proc_macro_quote)]
6+
7+
extern crate proc_macro;
8+
9+
use proc_macro::quote;
10+
11+
fn main() {
12+
quote!($(a b)*);
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: proc macro panicked
2+
--> $DIR/does-not-have-iter.rs:12:5
3+
|
4+
LL | quote!($(a b)*);
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
= help: message: `$` must be followed by an ident or `$` in `quote!`
8+
9+
error: aborting due to 1 previous error
10+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![feature(proc_macro_quote)]
2+
3+
extern crate proc_macro;
4+
5+
use std::net::Ipv4Addr;
6+
7+
use proc_macro::quote;
8+
9+
fn main() {
10+
let ip = Ipv4Addr::LOCALHOST;
11+
let _ = quote! { $ip }; //~ ERROR the trait bound `Ipv4Addr: ToTokens` is not satisfied
12+
}

0 commit comments

Comments
 (0)