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

Fix: The alloc crate uses the Rust 2021 edition now #105

Merged
merged 2 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ fn flags(config: Option<&Config>, target: &str, tool: &str) -> Result<Vec<String
Err(anyhow!(
".cargo/config: target.{}.{} must be an \
array of strings",
target, tool
target,
tool
))?
}
} else {
Expand Down
15 changes: 8 additions & 7 deletions src/flock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ pub struct Filesystem {

impl Filesystem {
pub fn new(path: PathBuf, quiet: bool) -> Filesystem {
Filesystem { path: path, quiet: quiet }
Filesystem {
path: path,
quiet: quiet,
}
}

pub fn join<T>(&self, other: T) -> Filesystem
Expand Down Expand Up @@ -111,7 +114,9 @@ impl Filesystem {
})?;
}
State::Shared => {
acquire(msg, &path, self.quiet, &|| try_lock_shared(&f), &|| lock_shared(&f))?;
acquire(msg, &path, self.quiet, &|| try_lock_shared(&f), &|| {
lock_shared(&f)
})?;
}
}

Expand Down Expand Up @@ -183,11 +188,7 @@ fn acquire(
}

if !quiet {
eprintln!(
"{:>12} waiting for file lock on {}",
"Blocking",
msg
)
eprintln!("{:>12} waiting for file lock on {}", "Blocking", msg)
}

lock_block()
Expand Down
6 changes: 4 additions & 2 deletions src/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ impl Sysroot {
});
}

Err(anyhow!("`rust-src` component not found. Run `rustup component add \
rust-src`."))
Err(anyhow!(
"`rust-src` component not found. Run `rustup component add \
rust-src`."
))
}
}

Expand Down
21 changes: 10 additions & 11 deletions src/sysroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ fn build_crate(
td_lockfile.display()
)
})?;
let mut perms = fs::metadata(&td_lockfile).with_context(|| {
format!(
"failed to retrieve permissions for `{}`",
td_lockfile.display()
)
})?.permissions();
let mut perms = fs::metadata(&td_lockfile)
.with_context(|| {
format!(
"failed to retrieve permissions for `{}`",
td_lockfile.display()
)
})?
.permissions();
perms.set_readonly(false);
fs::set_permissions(&td_lockfile, perms).with_context(|| {
format!(
Expand Down Expand Up @@ -177,7 +179,7 @@ fn build_liballoc(
authors = ["The Rust Project Developers"]
name = "alloc"
version = "0.0.0"
edition = "2018"
edition = "2021"

[dependencies.compiler_builtins]
version = "0.1.0"
Expand All @@ -192,10 +194,7 @@ version = "0.1.0"
}

stoml.push_str("[dependencies.core]\n");
stoml.push_str(&format!(
"path = '{}'\n",
src.path().join("core").display()
));
stoml.push_str(&format!("path = '{}'\n", src.path().join("core").display()));

if config.panic_immediate_abort {
stoml.push_str("features = ['panic_immediate_abort']\n");
Expand Down
2 changes: 1 addition & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fs::File;
use std::io::{Read, Write};
use std::path::Path;

use anyhow::{anyhow, Result, Context};
use anyhow::{anyhow, Context, Result};
use toml::Value;
use walkdir::WalkDir;

Expand Down