Skip to content

Commit ae070ae

Browse files
committed
Fix tests
1 parent 8695d31 commit ae070ae

File tree

7 files changed

+37
-90
lines changed

7 files changed

+37
-90
lines changed

tests/ui/macros/same-sequence-span.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ LL | $(= $z:tt)*
1717
error: `$x:expr` may be followed by `$y:tt`, which is not allowed for `expr` fragments
1818
--> $DIR/same-sequence-span.rs:19:1
1919
|
20-
LL | | macro_rules! manual_foo {
21-
| |__________________________^not allowed after `expr` fragments
20+
LL | |
21+
| |_^not allowed after `expr` fragments
2222
...
2323
LL | proc_macro_sequence::make_foo!();
2424
| ^-------------------------------

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

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/ui/proc-macro/auxiliary/span-from-proc-macro.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#![feature(proc_macro_quote)]
2-
#![feature(proc_macro_internals)] // FIXME - this shouldn't be necessary
32

43
extern crate proc_macro;
5-
extern crate custom_quote;
64

75
use proc_macro::{quote, TokenStream};
86

@@ -19,13 +17,6 @@ pub fn error_from_bang(_input: TokenStream) -> TokenStream {
1917
expand_to_quote!()
2018
}
2119

22-
#[proc_macro]
23-
pub fn other_error_from_bang(_input: TokenStream) -> TokenStream {
24-
custom_quote::custom_quote! {
25-
my_ident
26-
}
27-
}
28-
2920
#[proc_macro_attribute]
3021
pub fn error_from_attribute(_args: TokenStream, _input: TokenStream) -> TokenStream {
3122
quote! {

tests/ui/proc-macro/mixed-site-span.stderr

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,11 @@ LL | invoke_with_ident!{krate input TokenItem}
127127
|
128128
= note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
129129
help: consider importing this struct instead
130-
--> $DIR/auxiliary/mixed-site-span.rs:59:34
130+
--> $DIR/auxiliary/mixed-site-span.rs:40:1
131+
|
132+
LL - pub fn with_crate(input: TokenStream) -> TokenStream {
133+
LL + token_site_span::TokenItem as _ {
131134
|
132-
LL | quote!(use $krate::$ident as token_site_span::TokenItem as _;)
133-
| +++++++++++++++++++++++++++++
134135

135136
error[E0432]: unresolved import `$crate::TokenItem`
136137
--> $DIR/mixed-site-span.rs:88:5
@@ -140,10 +141,11 @@ LL | with_crate!{krate input TokenItem}
140141
|
141142
= note: this error originates in the macro `with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
142143
help: consider importing this struct instead
143-
--> $DIR/auxiliary/mixed-site-span.rs:59:34
144+
--> $DIR/auxiliary/mixed-site-span.rs:40:1
145+
|
146+
LL - pub fn with_crate(input: TokenStream) -> TokenStream {
147+
LL + token_site_span::TokenItem as _ {
144148
|
145-
LL | quote!(use $krate::$ident as token_site_span::TokenItem as _;)
146-
| +++++++++++++++++++++++++++++
147149

148150
error[E0432]: unresolved import `$crate`
149151
--> $DIR/mixed-site-span.rs:89:5

tests/ui/proc-macro/quote/debug.stdout

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ fn main() {
2323
{
2424
let mut ts = crate::TokenStream::new();
2525
crate::ToTokens::to_tokens(&crate::TokenTree::Ident(crate::Ident::new("let",
26-
crate::Span::recover_proc_macro_span(0))), &mut ts);
26+
crate::Span::def_site())), &mut ts);
2727
crate::ToTokens::to_tokens(&crate::TokenTree::Ident(crate::Ident::new("hello",
28-
crate::Span::recover_proc_macro_span(1))), &mut ts);
28+
crate::Span::def_site())), &mut ts);
2929
crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new('=',
3030
crate::Spacing::Alone)), &mut ts);
3131
crate::ToTokens::to_tokens(&crate::TokenTree::Literal({
3232
let mut iter =
3333
"\"world\"".parse::<crate::TokenStream>().unwrap().into_iter();
3434
if let (Some(crate::TokenTree::Literal(mut lit)), None) =
3535
(iter.next(), iter.next()) {
36-
lit.set_span(crate::Span::recover_proc_macro_span(2));
36+
lit.set_span(crate::Span::def_site());
3737
lit
3838
} else {
3939
::core::panicking::panic("internal error: entered unreachable code")
@@ -42,17 +42,17 @@ fn main() {
4242
crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new(';',
4343
crate::Spacing::Alone)), &mut ts);
4444
crate::ToTokens::to_tokens(&crate::TokenTree::Ident(crate::Ident::new("let",
45-
crate::Span::recover_proc_macro_span(3))), &mut ts);
45+
crate::Span::def_site())), &mut ts);
4646
crate::ToTokens::to_tokens(&crate::TokenTree::Ident(crate::Ident::new_raw("raw_ident",
47-
crate::Span::recover_proc_macro_span(4))), &mut ts);
47+
crate::Span::def_site())), &mut ts);
4848
crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new('=',
4949
crate::Spacing::Alone)), &mut ts);
5050
crate::ToTokens::to_tokens(&crate::TokenTree::Literal({
5151
let mut iter =
5252
"r#\"raw\"literal\"#".parse::<crate::TokenStream>().unwrap().into_iter();
5353
if let (Some(crate::TokenTree::Literal(mut lit)), None) =
5454
(iter.next(), iter.next()) {
55-
lit.set_span(crate::Span::recover_proc_macro_span(5));
55+
lit.set_span(crate::Span::def_site());
5656
lit
5757
} else {
5858
::core::panicking::panic("internal error: entered unreachable code")

tests/ui/proc-macro/span-from-proc-macro.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ proc-macro: custom-quote.rs
21
//@ proc-macro: span-from-proc-macro.rs
32
//@ compile-flags: -Z macro-backtrace
43

@@ -13,5 +12,4 @@ struct Kept;
1312

1413
fn main() {
1514
error_from_bang!(); //~ ERROR mismatched types
16-
other_error_from_bang!(); //~ ERROR cannot find value `my_ident`
1715
}
Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,47 @@
11
error[E0412]: cannot find type `MissingType` in this scope
2-
--> $DIR/auxiliary/span-from-proc-macro.rs:33:20
2+
--> $DIR/auxiliary/span-from-proc-macro.rs:21:1
33
|
44
LL | pub fn error_from_attribute(_args: TokenStream, _input: TokenStream) -> TokenStream {
5-
| ----------------------------------------------------------------------------------- in this expansion of `#[error_from_attribute]`
6-
...
7-
LL | field: MissingType
8-
| ^^^^^^^^^^^ not found in this scope
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
| |
7+
| not found in this scope
8+
| in this expansion of `#[error_from_attribute]`
99
|
10-
::: $DIR/span-from-proc-macro.rs:8:1
10+
::: $DIR/span-from-proc-macro.rs:7:1
1111
|
1212
LL | #[error_from_attribute]
1313
| ----------------------- in this procedural macro expansion
1414

1515
error[E0412]: cannot find type `OtherMissingType` in this scope
16-
--> $DIR/auxiliary/span-from-proc-macro.rs:42:21
16+
--> $DIR/auxiliary/span-from-proc-macro.rs:30:1
1717
|
1818
LL | pub fn error_from_derive(_input: TokenStream) -> TokenStream {
19-
| ------------------------------------------------------------ in this expansion of `#[derive(ErrorFromDerive)]`
20-
...
21-
LL | Variant(OtherMissingType)
22-
| ^^^^^^^^^^^^^^^^ not found in this scope
19+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20+
| |
21+
| not found in this scope
22+
| in this expansion of `#[derive(ErrorFromDerive)]`
2323
|
24-
::: $DIR/span-from-proc-macro.rs:11:10
24+
::: $DIR/span-from-proc-macro.rs:10:10
2525
|
2626
LL | #[derive(ErrorFromDerive)]
2727
| --------------- in this derive macro expansion
2828

29-
error[E0425]: cannot find value `my_ident` in this scope
30-
--> $DIR/auxiliary/span-from-proc-macro.rs:25:9
31-
|
32-
LL | pub fn other_error_from_bang(_input: TokenStream) -> TokenStream {
33-
| ---------------------------------------------------------------- in this expansion of `other_error_from_bang!`
34-
LL | custom_quote::custom_quote! {
35-
LL | my_ident
36-
| ^^^^^^^^ not found in this scope
37-
|
38-
::: $DIR/span-from-proc-macro.rs:16:5
39-
|
40-
LL | other_error_from_bang!();
41-
| ------------------------ in this macro invocation
42-
4329
error[E0308]: mismatched types
44-
--> $DIR/auxiliary/span-from-proc-macro.rs:12:36
30+
--> $DIR/auxiliary/span-from-proc-macro.rs:16:1
4531
|
46-
LL | let bang_error: bool = 25;
47-
| ---- ^^ expected `bool`, found integer
48-
| |
49-
| expected due to this
50-
...
5132
LL | pub fn error_from_bang(_input: TokenStream) -> TokenStream {
52-
| ---------------------------------------------------------- in this expansion of `error_from_bang!`
33+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
34+
| |
35+
| expected `bool`, found integer
36+
| expected due to this
37+
| in this expansion of `error_from_bang!`
5338
|
54-
::: $DIR/span-from-proc-macro.rs:15:5
39+
::: $DIR/span-from-proc-macro.rs:14:5
5540
|
5641
LL | error_from_bang!();
5742
| ------------------ in this macro invocation
5843

59-
error: aborting due to 4 previous errors
44+
error: aborting due to 3 previous errors
6045

61-
Some errors have detailed explanations: E0308, E0412, E0425.
46+
Some errors have detailed explanations: E0308, E0412.
6247
For more information about an error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)