about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-12-27 04:23:10 +0000
committerbors <bors@rust-lang.org>2017-12-27 04:23:10 +0000
commite8098c5c4db081585e0dc12fe6a2e0defe92857f (patch)
tree581ec4f395d96af63de2a74038eb49374d62133e /src
parentcddc4a62d8e72c2bd303994752a7f8545ffb9c79 (diff)
parent502d570b8179c8dd198732daeaed833ed0035cea (diff)
downloadrust-e8098c5c4db081585e0dc12fe6a2e0defe92857f.tar.gz
rust-e8098c5c4db081585e0dc12fe6a2e0defe92857f.zip
Auto merge of #46803 - estebank:non-ascii-def-span, r=petrochenkov
Use def span for non-ascii ident feature gate error
Diffstat (limited to 'src')
-rw-r--r--src/libsyntax/feature_gate.rs4
-rw-r--r--src/test/ui/feature-gate-non_ascii_idents.stderr26
2 files changed, 11 insertions, 19 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index f8d6b419f7a..1676925989c 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -1446,7 +1446,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
 
     fn visit_name(&mut self, sp: Span, name: ast::Name) {
         if !name.as_str().is_ascii() {
-            gate_feature_post!(&self, non_ascii_idents, sp,
+            gate_feature_post!(&self,
+                               non_ascii_idents,
+                               self.context.parse_sess.codemap().def_span(sp),
                                "non-ascii idents are not fully supported.");
         }
     }
diff --git a/src/test/ui/feature-gate-non_ascii_idents.stderr b/src/test/ui/feature-gate-non_ascii_idents.stderr
index df6ce6b6162..90d0b8daee7 100644
--- a/src/test/ui/feature-gate-non_ascii_idents.stderr
+++ b/src/test/ui/feature-gate-non_ascii_idents.stderr
@@ -17,10 +17,8 @@ error: non-ascii idents are not fully supported. (see issue #28979)
 error: non-ascii idents are not fully supported. (see issue #28979)
   --> $DIR/feature-gate-non_ascii_idents.rs:15:1
    |
-15 | / mod föö { //~ ERROR non-ascii idents
-16 | |     pub fn bar() {}
-17 | | }
-   | |_^
+15 | mod föö { //~ ERROR non-ascii idents
+   | ^^^^^^^
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
@@ -65,10 +63,8 @@ error: non-ascii idents are not fully supported. (see issue #28979)
 error: non-ascii idents are not fully supported. (see issue #28979)
   --> $DIR/feature-gate-non_ascii_idents.rs:29:1
    |
-29 | / struct Föö { //~ ERROR non-ascii idents
-30 | |     föö: isize //~ ERROR non-ascii idents
-31 | | }
-   | |_^
+29 | struct Föö { //~ ERROR non-ascii idents
+   | ^^^^^^^^^^
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
@@ -83,22 +79,16 @@ error: non-ascii idents are not fully supported. (see issue #28979)
 error: non-ascii idents are not fully supported. (see issue #28979)
   --> $DIR/feature-gate-non_ascii_idents.rs:33:1
    |
-33 | / enum Bär { //~ ERROR non-ascii idents
-34 | |     Bäz { //~ ERROR non-ascii idents
-35 | |         qüx: isize //~ ERROR non-ascii idents
-36 | |     }
-37 | | }
-   | |_^
+33 | enum Bär { //~ ERROR non-ascii idents
+   | ^^^^^^^^
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
 error: non-ascii idents are not fully supported. (see issue #28979)
   --> $DIR/feature-gate-non_ascii_idents.rs:34:5
    |
-34 | /     Bäz { //~ ERROR non-ascii idents
-35 | |         qüx: isize //~ ERROR non-ascii idents
-36 | |     }
-   | |_____^
+34 |     Bäz { //~ ERROR non-ascii idents
+   |     ^^^
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable