2018-05-04 13:25:31 -05:00
|
|
|
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2018-05-11 13:31:08 -05:00
|
|
|
// compile-flags: --edition 2018
|
|
|
|
|
2018-05-25 15:53:49 -05:00
|
|
|
#![deny(unused_extern_crates)]
|
2018-05-04 13:25:31 -05:00
|
|
|
#![feature(alloc, test, libc)]
|
|
|
|
|
|
|
|
extern crate alloc;
|
2018-05-25 15:53:49 -05:00
|
|
|
//~^ ERROR unused extern crate
|
2018-05-04 13:25:31 -05:00
|
|
|
//~| HELP remove
|
|
|
|
extern crate alloc as x;
|
2018-05-25 15:53:49 -05:00
|
|
|
//~^ ERROR unused extern crate
|
|
|
|
//~| HELP remove
|
2018-05-04 13:25:31 -05:00
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
extern crate test;
|
2018-05-25 15:53:49 -05:00
|
|
|
|
2018-05-04 13:25:31 -05:00
|
|
|
pub extern crate test as y;
|
2018-05-25 15:53:49 -05:00
|
|
|
//~^ ERROR `extern crate` is not idiomatic in the new edition
|
|
|
|
//~| HELP convert it to a `pub use`
|
|
|
|
|
2018-05-04 13:25:31 -05:00
|
|
|
pub extern crate libc;
|
2018-05-25 15:53:49 -05:00
|
|
|
//~^ ERROR `extern crate` is not idiomatic in the new edition
|
|
|
|
//~| HELP convert it to a `pub use`
|
|
|
|
|
|
|
|
pub(crate) extern crate libc as a;
|
|
|
|
//~^ ERROR `extern crate` is not idiomatic in the new edition
|
|
|
|
//~| HELP convert it to a `pub(crate) use`
|
2018-05-04 13:25:31 -05:00
|
|
|
|
2018-05-25 15:53:49 -05:00
|
|
|
crate extern crate libc as b;
|
|
|
|
//~^ ERROR `extern crate` is not idiomatic in the new edition
|
|
|
|
//~| HELP convert it to a `crate use`
|
2018-05-04 13:25:31 -05:00
|
|
|
|
|
|
|
mod foo {
|
2018-05-25 15:53:49 -05:00
|
|
|
pub(in crate::foo) extern crate libc as c;
|
|
|
|
//~^ ERROR `extern crate` is not idiomatic in the new edition
|
|
|
|
//~| HELP convert it to a `pub(in crate::foo) use`
|
|
|
|
|
|
|
|
pub(super) extern crate libc as d;
|
|
|
|
//~^ ERROR `extern crate` is not idiomatic in the new edition
|
|
|
|
//~| HELP convert it to a `pub(super) use`
|
|
|
|
|
2018-05-04 13:25:31 -05:00
|
|
|
extern crate alloc;
|
2018-05-25 15:53:49 -05:00
|
|
|
//~^ ERROR unused extern crate
|
|
|
|
//~| HELP remove
|
|
|
|
|
2018-05-04 13:25:31 -05:00
|
|
|
extern crate alloc as x;
|
2018-05-25 15:53:49 -05:00
|
|
|
//~^ ERROR unused extern crate
|
|
|
|
//~| HELP remove
|
|
|
|
|
2018-05-04 13:25:31 -05:00
|
|
|
pub extern crate test;
|
2018-05-25 15:53:49 -05:00
|
|
|
//~^ ERROR `extern crate` is not idiomatic in the new edition
|
|
|
|
//~| HELP convert it
|
|
|
|
|
2018-05-04 13:25:31 -05:00
|
|
|
pub extern crate test as y;
|
2018-05-25 15:53:49 -05:00
|
|
|
//~^ ERROR `extern crate` is not idiomatic in the new edition
|
|
|
|
//~| HELP convert it
|
|
|
|
|
2018-05-04 13:25:31 -05:00
|
|
|
mod bar {
|
|
|
|
extern crate alloc;
|
2018-05-25 15:53:49 -05:00
|
|
|
//~^ ERROR unused extern crate
|
|
|
|
//~| HELP remove
|
|
|
|
|
2018-05-04 13:25:31 -05:00
|
|
|
extern crate alloc as x;
|
2018-05-25 15:53:49 -05:00
|
|
|
//~^ ERROR unused extern crate
|
|
|
|
//~| HELP remove
|
|
|
|
|
|
|
|
pub(in crate::foo::bar) extern crate libc as e;
|
|
|
|
//~^ ERROR `extern crate` is not idiomatic in the new edition
|
|
|
|
//~| HELP convert it to a `pub(in crate::foo::bar) use`
|
|
|
|
|
|
|
|
fn dummy() {
|
|
|
|
unsafe {
|
|
|
|
e::getpid();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn dummy() {
|
|
|
|
unsafe {
|
|
|
|
c::getpid();
|
|
|
|
d::getpid();
|
|
|
|
}
|
2018-05-04 13:25:31 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-25 15:53:49 -05:00
|
|
|
fn main() {
|
|
|
|
unsafe { a::getpid(); }
|
|
|
|
unsafe { b::getpid(); }
|
|
|
|
}
|