Skip to content

Commit 2ce7e2e

Browse files
committed
Fix tests
1 parent 6be355e commit 2ce7e2e

File tree

5 files changed

+8
-24
lines changed

5 files changed

+8
-24
lines changed

tests/ui/macros/auxiliary/proc_macro_sequence.rs

-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ extern crate proc_macro;
88

99
use proc_macro::{quote, Span, TokenStream, TokenTree};
1010

11-
fn assert_same_span(a: Span, b: Span) {
12-
assert_eq!(a.start(), b.start());
13-
assert_eq!(a.end(), b.end());
14-
}
15-
1611
// This macro generates a macro with the same macro definition as `manual_foo` in
1712
// `same-sequence-span.rs` but with the same span for all sequences.
1813
#[proc_macro]

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

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@ 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 | | }
21+
| |_________________________________^ not allowed after `expr` fragments
22+
LL |
2023
LL | proc_macro_sequence::make_foo!();
2124
| ^-------------------------------
2225
| |
2326
| _in this macro invocation
2427
| |
25-
LL | |
26-
LL | |
27-
LL | | fn main() {}
28-
| |_________________________________^ not allowed after `expr` fragments
2928
|
3029
= note: allowed there are: `=>`, `,` or `;`
3130
= note: this error originates in the macro `proc_macro_sequence::make_foo` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/ui/proc-macro/auxiliary/api/cmp.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1-
use proc_macro::{LineColumn, Punct, Spacing};
1+
use proc_macro::{Punct, Spacing};
22

33
pub fn test() {
4-
test_line_column_ord();
54
test_punct_eq();
65
}
76

8-
fn test_line_column_ord() {
9-
let line0_column0 = LineColumn { line: 0, column: 0 };
10-
let line0_column1 = LineColumn { line: 0, column: 1 };
11-
let line1_column0 = LineColumn { line: 1, column: 0 };
12-
assert!(line0_column0 < line0_column1);
13-
assert!(line0_column1 < line1_column0);
14-
}
15-
167
fn test_punct_eq() {
178
let colon_alone = Punct::new(':', Spacing::Alone);
189
assert_eq!(colon_alone, ':');

tests/ui/proc-macro/auxiliary/assert-span-pos.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ pub fn assert_span_pos(input: TokenStream) -> TokenStream {
2626
let line: usize = str1.parse().unwrap();
2727
let col: usize = str2.parse().unwrap();
2828

29-
let sp1s = sp1.start();
30-
if (line, col) != (sp1s.line, sp1s.column) {
29+
if (line, col) != (sp1.line(), sp1.column()) {
3130
let msg = format!("line/column mismatch: ({}, {}) != ({}, {})", line, col,
32-
sp1s.line, sp1s.column);
31+
sp1.line(), sp1.column());
3332
sp1.error(msg).emit();
3433
}
3534

tests/ui/proc-macro/auxiliary/macro-only-syntax.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// lossy string reparse hack (https://github.com/rust-lang/rust/issues/43081).
1111

1212
#![crate_type = "proc-macro"]
13-
#![feature(proc_macro_span)]
13+
#![feature(proc_macro_span, proc_macro_span_shrink)]
1414

1515
extern crate proc_macro;
1616
use proc_macro::{token_stream, Delimiter, TokenStream, TokenTree};
@@ -81,7 +81,7 @@ fn expect_brace(tokens: &mut token_stream::IntoIter) -> token_stream::IntoIter {
8181

8282
fn check_useful_span(token: TokenTree, expected_filename: &str) {
8383
let span = token.span();
84-
assert!(span.start().column < span.end().column);
84+
assert!(span.column() < span.end().column());
8585

8686
let source_path = span.source_file().path();
8787
let filename = source_path.components().last().unwrap();

0 commit comments

Comments
 (0)