Skip to content
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

Rollup of 8 pull requests #50704

Merged
merged 18 commits into from
May 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
2ae8acc
fs::write: Add example writing a &str
adevore May 10, 2018
c3b23b3
AppVeyor: Dump crash log on failure.
kennytm May 11, 2018
fd85de1
Ignore non .rs files for tidy libcoretest
varkor May 11, 2018
0588bca
rustc: Allow an edition's feature on that edition
alexcrichton May 11, 2018
6de899f
rustc: Include semicolon when removing `extern crate`
alexcrichton May 11, 2018
12f92e9
rustc: Only suggest deleting `extern crate` if it works
alexcrichton May 11, 2018
16c088d
Display the name of the failed file in tidy/libcoretest
varkor May 11, 2018
4ce2426
Do not silently truncate offsets for `read_at`/`write_at` on emscripten
tbu- May 12, 2018
0bef240
openbsd-i686: use lld as linker by default
semarie May 12, 2018
f430d7c
add aarch64-unknown-openbsd support
semarie May 12, 2018
e0b7f42
Rollup merge of #50624 - adevore:fs-write-str-example, r=steveklabnik
kennytm May 13, 2018
55792a4
Rollup merge of #50634 - tbu-:pr_preadwrite_emscripten, r=kennytm
kennytm May 13, 2018
42939c5
Rollup merge of #50644 - kennytm:read-appveyor-dump, r=alexcrichton
kennytm May 13, 2018
0cf7be2
Rollup merge of #50661 - varkor:libcoretest-ignore-non-rs, r=alexcric…
kennytm May 13, 2018
34cec06
Rollup merge of #50663 - alexcrichton:no-removed-error, r=Manishearth
kennytm May 13, 2018
ededa9d
Rollup merge of #50667 - alexcrichton:no-remove-extern-crate-unless-w…
kennytm May 13, 2018
b0d3170
Rollup merge of #50670 - alexcrichton:remove-extern-crate-correct-spa…
kennytm May 13, 2018
98ce505
Rollup merge of #50678 - semarie:openbsd-targets, r=sanxiyn
kennytm May 13, 2018
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
4 changes: 2 additions & 2 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1568,10 +1568,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExternCrate {

if let Some(orig) = orig {
err.span_suggestion(it.span, &help,
format!("{}use {} as {}", pub_, orig, it.name));
format!("{}use {} as {};", pub_, orig, it.name));
} else {
err.span_suggestion(it.span, &help,
format!("{}use {}", pub_, it.name));
format!("{}use {};", pub_, it.name));
}
} else {
err.span_suggestion(it.span, "remove it", "".into());
Expand Down
31 changes: 31 additions & 0 deletions src/librustc_target/spec/aarch64_unknown_openbsd.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2018 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.

use spec::{LinkerFlavor, Target, TargetResult};

pub fn target() -> TargetResult {
let mut base = super::openbsd_base::opts();
base.max_atomic_width = Some(128);
base.abi_blacklist = super::arm_base::abi_blacklist();

Ok(Target {
llvm_target: "aarch64-unknown-openbsd".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "64".to_string(),
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "openbsd".to_string(),
target_env: "".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base,
})
}
1 change: 1 addition & 0 deletions src/librustc_target/spec/i686_unknown_openbsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub fn target() -> TargetResult {
base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-fuse-ld=lld".to_string());
base.stack_probes = true;

Ok(Target {
Expand Down
1 change: 1 addition & 0 deletions src/librustc_target/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ supported_targets! {

("x86_64-unknown-bitrig", x86_64_unknown_bitrig),

("aarch64-unknown-openbsd", aarch64_unknown_openbsd),
("i686-unknown-openbsd", i686_unknown_openbsd),
("x86_64-unknown-openbsd", x86_64_unknown_openbsd),

Expand Down
18 changes: 9 additions & 9 deletions src/test/ui-fulldeps/unnecessary-extern-crate.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,55 +14,55 @@ error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:19:1
|
LL | extern crate alloc as x;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x`
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x;`

error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:25:1
|
LL | pub extern crate test as y;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y;`

error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:28:1
|
LL | pub extern crate libc;
| ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use libc`
| ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use libc;`

error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:34:5
|
LL | extern crate alloc;
| ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc`
| ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc;`

error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:37:5
|
LL | extern crate alloc as x;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x`
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x;`

error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:40:5
|
LL | pub extern crate test;
| ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test`
| ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test;`

error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:43:5
|
LL | pub extern crate test as y;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y;`

error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:47:9
|
LL | extern crate alloc;
| ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc`
| ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc;`

error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:50:9
|
LL | extern crate alloc as x;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x`
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x;`

error: aborting due to 10 previous errors

11 changes: 11 additions & 0 deletions src/test/ui/suggestions/auxiliary/removing-extern-crate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2018 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.

// intentionally blank
27 changes: 27 additions & 0 deletions src/test/ui/suggestions/removing-extern-crate.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2018 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.

// compile-flags: --edition 2018
// aux-build:removing-extern-crate.rs
// run-rustfix
// compile-pass

#![warn(rust_2018_idioms)]
#![allow(unused_imports)]

use std as foo;


mod another {
use std as foo;
use std;
}

fn main() {}
27 changes: 27 additions & 0 deletions src/test/ui/suggestions/removing-extern-crate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2018 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.

// compile-flags: --edition 2018
// aux-build:removing-extern-crate.rs
// run-rustfix
// compile-pass

#![warn(rust_2018_idioms)]
#![allow(unused_imports)]

extern crate std as foo;
extern crate core;

mod another {
extern crate std as foo;
extern crate std;
}

fn main() {}
31 changes: 31 additions & 0 deletions src/test/ui/suggestions/removing-extern-crate.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
warning: `extern crate` is unnecessary in the new edition
--> $DIR/removing-extern-crate.rs:19:1
|
LL | extern crate std as foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use std as foo;`
|
note: lint level defined here
--> $DIR/removing-extern-crate.rs:16:9
|
LL | #![warn(rust_2018_idioms)]
| ^^^^^^^^^^^^^^^^
= note: #[warn(unnecessary_extern_crate)] implied by #[warn(rust_2018_idioms)]

warning: `extern crate` is unnecessary in the new edition
--> $DIR/removing-extern-crate.rs:20:1
|
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^ help: remove it

warning: `extern crate` is unnecessary in the new edition
--> $DIR/removing-extern-crate.rs:23:5
|
LL | extern crate std as foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use std as foo;`

warning: `extern crate` is unnecessary in the new edition
--> $DIR/removing-extern-crate.rs:24:5
|
LL | extern crate std;
| ^^^^^^^^^^^^^^^^^ help: use `use`: `use std;`