Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9e60ab3

Browse files
committedMay 29, 2024·
Fix tests
1 parent 1fee709 commit 9e60ab3

File tree

5 files changed

+25
-82
lines changed

5 files changed

+25
-82
lines changed
 

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

-32
This file was deleted.

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

+1-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#![crate_type = "proc-macro"]
77

88
extern crate proc_macro;
9-
extern crate custom_quote;
109

1110
use proc_macro::{quote, TokenStream};
1211

@@ -15,21 +14,14 @@ macro_rules! expand_to_quote {
1514
quote! {
1615
let bang_error: bool = 25;
1716
}
18-
}
17+
};
1918
}
2019

2120
#[proc_macro]
2221
pub fn error_from_bang(_input: TokenStream) -> TokenStream {
2322
expand_to_quote!()
2423
}
2524

26-
#[proc_macro]
27-
pub fn other_error_from_bang(_input: TokenStream) -> TokenStream {
28-
custom_quote::custom_quote! {
29-
my_ident
30-
}
31-
}
32-
3325
#[proc_macro_attribute]
3426
pub fn error_from_attribute(_args: TokenStream, _input: TokenStream) -> TokenStream {
3527
quote! {

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ extern crate proc_macro;
2020

2121
fn main() {
2222
[crate::TokenStream::from(crate::TokenTree::Ident(crate::Ident::new("let",
23-
crate::Span::recover_proc_macro_span(0)))),
23+
crate::Span::def_site()))),
2424
crate::TokenStream::from(crate::TokenTree::Ident(crate::Ident::new("hello",
25-
crate::Span::recover_proc_macro_span(1)))),
25+
crate::Span::def_site()))),
2626
crate::TokenStream::from(crate::TokenTree::Punct(crate::Punct::new('=',
2727
crate::Spacing::Alone))),
2828
crate::TokenStream::from(crate::TokenTree::Literal({
2929
let mut iter =
3030
"\"world\"".parse::<crate::TokenStream>().unwrap().into_iter();
3131
if let (Some(crate::TokenTree::Literal(mut lit)), None) =
3232
(iter.next(), iter.next()) {
33-
lit.set_span(crate::Span::recover_proc_macro_span(2));
33+
lit.set_span(crate::Span::def_site());
3434
lit
3535
} else {
3636
::core::panicking::panic("internal error: entered unreachable code")

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

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ aux-build:custom-quote.rs
21
//@ aux-build: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
}
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:37:20
2+
--> $DIR/auxiliary/span-from-proc-macro.rs:26: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:46:21
16+
--> $DIR/auxiliary/span-from-proc-macro.rs:35: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:29: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:16:36
30+
--> $DIR/auxiliary/span-from-proc-macro.rs:21: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)
Please sign in to comment.