File tree 2 files changed +30
-5
lines changed
2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -5116,12 +5116,19 @@ impl<'a> Parser<'a> {
5116
5116
try!( self . expect ( & token:: Semi ) ) ;
5117
5117
5118
5118
let last_span = self . last_span ;
5119
+
5120
+ if visibility == ast:: Public {
5121
+ self . span_warn ( mk_sp ( lo, last_span. hi ) ,
5122
+ "`pub extern crate` does not work as expected and should not be used. \
5123
+ Likely to become an error. Prefer `extern crate` and `pub use`.") ;
5124
+ }
5125
+
5119
5126
Ok ( self . mk_item ( lo,
5120
- last_span. hi ,
5121
- ident,
5122
- ItemExternCrate ( maybe_path) ,
5123
- visibility,
5124
- attrs) )
5127
+ last_span. hi ,
5128
+ ident,
5129
+ ItemExternCrate ( maybe_path) ,
5130
+ visibility,
5131
+ attrs) )
5125
5132
}
5126
5133
5127
5134
/// Parse `extern` for foreign ABIs
Original file line number Diff line number Diff line change
1
+ // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // Check that `pub extern crate` gives a warning.
12
+
13
+
14
+ pub extern crate core; //~WARN `pub extern crate` does not work
15
+ //~^ ERROR core
16
+
17
+ fn main ( ) {
18
+ }
You can’t perform that action at this time.
0 commit comments