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 @@ -5101,12 +5101,19 @@ impl<'a> Parser<'a> {
5101
5101
try!( self . expect ( & token:: Semi ) ) ;
5102
5102
5103
5103
let last_span = self . last_span ;
5104
+
5105
+ if visibility == ast:: Public {
5106
+ self . span_warn ( mk_sp ( lo, last_span. hi ) ,
5107
+ "`pub extern crate` does not work as expected and should not be used. \
5108
+ Likely to become an error. Prefer `extern crate` and `pub use`.") ;
5109
+ }
5110
+
5104
5111
Ok ( self . mk_item ( lo,
5105
- last_span. hi ,
5106
- ident,
5107
- ItemExternCrate ( maybe_path) ,
5108
- visibility,
5109
- attrs) )
5112
+ last_span. hi ,
5113
+ ident,
5114
+ ItemExternCrate ( maybe_path) ,
5115
+ visibility,
5116
+ attrs) )
5110
5117
}
5111
5118
5112
5119
/// 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