From 502d570b8179c8dd198732daeaed833ed0035cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 17 Dec 2017 22:51:57 -0800 Subject: [PATCH] Use def span for non-ascii ident feature gate error --- src/libsyntax/feature_gate.rs | 4 ++- .../ui/feature-gate-non_ascii_idents.stderr | 26 ++++++------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index ba534676324..757c4c1e5ab 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1341,7 +1341,9 @@ fn visit_attribute(&mut self, attr: &ast::Attribute) { 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 -- GitLab