Skip to content

syntax: fix span for obsolete extern visibility error #8060

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

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4196,7 +4196,7 @@ impl Parser {

// Do not allow visibility to be specified.
if visibility != ast::inherited {
self.obsolete(*self.span, ObsoleteExternVisibility);
self.obsolete(*self.last_span, ObsoleteExternVisibility);
}

let abis = opt_abis.get_or_default(AbiSet::C());
Expand Down
10 changes: 10 additions & 0 deletions src/test/compile-fail/obsolete-syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,14 @@ fn obsolete_moves() {
//~^ ERROR obsolete syntax: binary move
}

extern mod obsolete_name {
//~^ ERROR obsolete syntax: named external module
fn bar();
}

pub extern {
//~^ ERROR obsolete syntax: `pub extern`
pub fn bar();
}

fn main() { }