Skip to content

Commit e8098c5

Browse files
committed
Auto merge of #46803 - estebank:non-ascii-def-span, r=petrochenkov
Use def span for non-ascii ident feature gate error
2 parents cddc4a6 + 502d570 commit e8098c5

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

src/libsyntax/feature_gate.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
14461446

14471447
fn visit_name(&mut self, sp: Span, name: ast::Name) {
14481448
if !name.as_str().is_ascii() {
1449-
gate_feature_post!(&self, non_ascii_idents, sp,
1449+
gate_feature_post!(&self,
1450+
non_ascii_idents,
1451+
self.context.parse_sess.codemap().def_span(sp),
14501452
"non-ascii idents are not fully supported.");
14511453
}
14521454
}

src/test/ui/feature-gate-non_ascii_idents.stderr

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ error: non-ascii idents are not fully supported. (see issue #28979)
1717
error: non-ascii idents are not fully supported. (see issue #28979)
1818
--> $DIR/feature-gate-non_ascii_idents.rs:15:1
1919
|
20-
15 | / mod föö { //~ ERROR non-ascii idents
21-
16 | | pub fn bar() {}
22-
17 | | }
23-
| |_^
20+
15 | mod föö { //~ ERROR non-ascii idents
21+
| ^^^^^^^
2422
|
2523
= help: add #![feature(non_ascii_idents)] to the crate attributes to enable
2624

@@ -65,10 +63,8 @@ error: non-ascii idents are not fully supported. (see issue #28979)
6563
error: non-ascii idents are not fully supported. (see issue #28979)
6664
--> $DIR/feature-gate-non_ascii_idents.rs:29:1
6765
|
68-
29 | / struct Föö { //~ ERROR non-ascii idents
69-
30 | | föö: isize //~ ERROR non-ascii idents
70-
31 | | }
71-
| |_^
66+
29 | struct Föö { //~ ERROR non-ascii idents
67+
| ^^^^^^^^^^
7268
|
7369
= help: add #![feature(non_ascii_idents)] to the crate attributes to enable
7470

@@ -83,22 +79,16 @@ error: non-ascii idents are not fully supported. (see issue #28979)
8379
error: non-ascii idents are not fully supported. (see issue #28979)
8480
--> $DIR/feature-gate-non_ascii_idents.rs:33:1
8581
|
86-
33 | / enum Bär { //~ ERROR non-ascii idents
87-
34 | | Bäz { //~ ERROR non-ascii idents
88-
35 | | qüx: isize //~ ERROR non-ascii idents
89-
36 | | }
90-
37 | | }
91-
| |_^
82+
33 | enum Bär { //~ ERROR non-ascii idents
83+
| ^^^^^^^^
9284
|
9385
= help: add #![feature(non_ascii_idents)] to the crate attributes to enable
9486

9587
error: non-ascii idents are not fully supported. (see issue #28979)
9688
--> $DIR/feature-gate-non_ascii_idents.rs:34:5
9789
|
98-
34 | / Bäz { //~ ERROR non-ascii idents
99-
35 | | qüx: isize //~ ERROR non-ascii idents
100-
36 | | }
101-
| |_____^
90+
34 | Bäz { //~ ERROR non-ascii idents
91+
| ^^^
10292
|
10393
= help: add #![feature(non_ascii_idents)] to the crate attributes to enable
10494

0 commit comments

Comments
 (0)