diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2015-09-18 18:07:05 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2015-09-18 18:07:05 +1200 |
| commit | 269c59d3414027c2194fb5deb1d26845d088afb9 (patch) | |
| tree | 6b3fece8e9078847e0034b6091c5ebed89787a16 /src/libsyntax/parse/parser.rs | |
| parent | d16129bca5f5c9f3a5bb66d3f757ec75ed0f9c7b (diff) | |
| download | rust-269c59d3414027c2194fb5deb1d26845d088afb9.tar.gz rust-269c59d3414027c2194fb5deb1d26845d088afb9.zip | |
Warn on `pub extern crate`.
Temporary 'fix' for #26775
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ff622859cf0..8d50cc099bd 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -5116,12 +5116,19 @@ impl<'a> Parser<'a> { try!(self.expect(&token::Semi)); let last_span = self.last_span; + + if visibility == ast::Public { + self.span_warn(mk_sp(lo, last_span.hi), + "`pub extern crate` does not work as expected and should not be used. \ + Likely to become an error. Prefer `extern crate` and `pub use`."); + } + Ok(self.mk_item(lo, - last_span.hi, - ident, - ItemExternCrate(maybe_path), - visibility, - attrs)) + last_span.hi, + ident, + ItemExternCrate(maybe_path), + visibility, + attrs)) } /// Parse `extern` for foreign ABIs |
