Skip to content

Commit

Permalink
Merge pull request #105 from rust-osdev/alloc-2021-edition
Browse files Browse the repository at this point in the history
Fix: The `alloc` crate uses the Rust 2021 edition now
  • Loading branch information
phil-opp authored Jun 21, 2022
2 parents f6ce1e5 + 3a70441 commit 6432959
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
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

0 comments on commit 6432959

Please sign in to comment.