Skip to content

Commit

Permalink
Auto merge of #6054 - steveklabnik:rust-1.30.0, r=alexcrichton
Browse files Browse the repository at this point in the history
No longer warn about #![feature(rust_2018_preview)]

Backport of #6052 to 1.30
  • Loading branch information
bors committed Sep 19, 2018
2 parents b917e35 + bcd6ca7 commit 308b1ea
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 57 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ crates-io = { path = "src/crates-io", version = "0.19" }
crossbeam-utils = "0.5"
crypto-hash = "0.3.1"
curl = "0.4.13"
env_logger = "0.5.4"
env_logger = "0.5.11"
failure = "0.1.2"
filetime = "0.2"
flate2 = "1.0"
Expand Down
33 changes: 0 additions & 33 deletions src/cargo/ops/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ fn rustfix_crate(lock_addr: &str, rustc: &Path, filename: &Path, args: &FixArgs)
-> Result<FixedCrate, Error>
{
args.verify_not_preparing_for_enabled_edition()?;
args.warn_if_preparing_probably_inert()?;

// First up we want to make sure that each crate is only checked by one
// process at a time. If two invocations concurrently check a crate then
Expand Down Expand Up @@ -596,38 +595,6 @@ impl FixArgs {
process::exit(1);
}

/// If we're preparing for an edition and we *don't* find the
/// `rust_2018_preview` feature, for example, in the entry point file then
/// it probably means that the edition isn't actually enabled, so we can't
/// actually fix anything.
///
/// If this is the case, issue a warning.
fn warn_if_preparing_probably_inert(&self) -> CargoResult<()> {
let edition = match self.prepare_for_edition_resolve() {
Some(s) => s,
None => return Ok(()),
};
let path = match &self.file {
Some(s) => s,
None => return Ok(()),
};
let contents = match fs::read_to_string(path) {
Ok(s) => s,
Err(_) => return Ok(())
};

let feature_name = format!("rust_{}_preview", edition);
if contents.contains(&feature_name) {
return Ok(())
}
Message::PreviewNotFound {
file: path.display().to_string(),
edition: edition.to_string(),
}.post()?;

Ok(())
}

fn prepare_for_edition_resolve(&self) -> Option<&str> {
match &self.prepare_for_edition {
PrepareFor::Edition(s) => Some(s),
Expand Down
23 changes: 0 additions & 23 deletions tests/testsuite/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,6 @@ fn local_paths_no_fix() {

let stderr = "\
[CHECKING] foo v0.0.1 ([..])
warning: failed to find `#![feature(rust_2018_preview)]` in `src/lib.rs`
this may cause `cargo fix` to not be able to fix all
issues in preparation for the 2018 edition
[FINISHED] [..]
";
p.cargo("fix --edition --allow-no-vcs")
Expand Down Expand Up @@ -853,26 +850,6 @@ information about transitioning to the 2018 edition see:
.run();
}

#[test]
fn prepare_for_without_feature_issues_warning() {
if !is_nightly() {
return;
}
let p = project().file("src/lib.rs", "").build();

let stderr = "\
[CHECKING] foo v0.0.1 ([..])
warning: failed to find `#![feature(rust_2018_preview)]` in `src/lib.rs`
this may cause `cargo fix` to not be able to fix all
issues in preparation for the 2018 edition
[FINISHED] [..]
";
p.cargo("fix --edition --allow-no-vcs")
.masquerade_as_nightly_cargo()
.with_stderr(stderr)
.run();
}

#[test]
fn fix_overlapping() {
if !is_nightly() {
Expand Down

0 comments on commit 308b1ea

Please sign in to comment.