Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use def span for non-ascii ident feature gate error #46803

Merged
merged 1 commit into from
Dec 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,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.");
}
}
Expand Down
26 changes: 8 additions & 18 deletions src/test/ui/feature-gate-non_ascii_idents.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't this line give an error?

Copy link
Contributor Author

@estebank estebank Dec 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. It wasn't already, would have to check.
@bjorn3 that error is being emitted further down, it's just hidden in the diff because it didn't change in this PR :)

36 | | }
| |_____^
34 | Bäz { //~ ERROR non-ascii idents
| ^^^
|
= help: add #![feature(non_ascii_idents)] to the crate attributes to enable

Expand Down