Skip to content

Commit 6432959

Browse files
authored
Merge pull request #105 from rust-osdev/alloc-2021-edition
Fix: The `alloc` crate uses the Rust 2021 edition now
2 parents f6ce1e5 + 3a70441 commit 6432959

File tree

5 files changed

+25
-22
lines changed

5 files changed

+25
-22
lines changed

src/cargo.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ fn flags(config: Option<&Config>, target: &str, tool: &str) -> Result<Vec<String
123123
Err(anyhow!(
124124
".cargo/config: target.{}.{} must be an \
125125
array of strings",
126-
target, tool
126+
target,
127+
tool
127128
))?
128129
}
129130
} else {

src/flock.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ pub struct Filesystem {
5252

5353
impl Filesystem {
5454
pub fn new(path: PathBuf, quiet: bool) -> Filesystem {
55-
Filesystem { path: path, quiet: quiet }
55+
Filesystem {
56+
path: path,
57+
quiet: quiet,
58+
}
5659
}
5760

5861
pub fn join<T>(&self, other: T) -> Filesystem
@@ -111,7 +114,9 @@ impl Filesystem {
111114
})?;
112115
}
113116
State::Shared => {
114-
acquire(msg, &path, self.quiet, &|| try_lock_shared(&f), &|| lock_shared(&f))?;
117+
acquire(msg, &path, self.quiet, &|| try_lock_shared(&f), &|| {
118+
lock_shared(&f)
119+
})?;
115120
}
116121
}
117122

@@ -183,11 +188,7 @@ fn acquire(
183188
}
184189

185190
if !quiet {
186-
eprintln!(
187-
"{:>12} waiting for file lock on {}",
188-
"Blocking",
189-
msg
190-
)
191+
eprintln!("{:>12} waiting for file lock on {}", "Blocking", msg)
191192
}
192193

193194
lock_block()

src/rustc.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ impl Sysroot {
7373
});
7474
}
7575

76-
Err(anyhow!("`rust-src` component not found. Run `rustup component add \
77-
rust-src`."))
76+
Err(anyhow!(
77+
"`rust-src` component not found. Run `rustup component add \
78+
rust-src`."
79+
))
7880
}
7981
}
8082

src/sysroot.rs

+10-11
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,14 @@ fn build_crate(
9393
td_lockfile.display()
9494
)
9595
})?;
96-
let mut perms = fs::metadata(&td_lockfile).with_context(|| {
97-
format!(
98-
"failed to retrieve permissions for `{}`",
99-
td_lockfile.display()
100-
)
101-
})?.permissions();
96+
let mut perms = fs::metadata(&td_lockfile)
97+
.with_context(|| {
98+
format!(
99+
"failed to retrieve permissions for `{}`",
100+
td_lockfile.display()
101+
)
102+
})?
103+
.permissions();
102104
perms.set_readonly(false);
103105
fs::set_permissions(&td_lockfile, perms).with_context(|| {
104106
format!(
@@ -177,7 +179,7 @@ fn build_liballoc(
177179
authors = ["The Rust Project Developers"]
178180
name = "alloc"
179181
version = "0.0.0"
180-
edition = "2018"
182+
edition = "2021"
181183
182184
[dependencies.compiler_builtins]
183185
version = "0.1.0"
@@ -192,10 +194,7 @@ version = "0.1.0"
192194
}
193195

194196
stoml.push_str("[dependencies.core]\n");
195-
stoml.push_str(&format!(
196-
"path = '{}'\n",
197-
src.path().join("core").display()
198-
));
197+
stoml.push_str(&format!("path = '{}'\n", src.path().join("core").display()));
199198

200199
if config.panic_immediate_abort {
201200
stoml.push_str("features = ['panic_immediate_abort']\n");

src/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fs::File;
33
use std::io::{Read, Write};
44
use std::path::Path;
55

6-
use anyhow::{anyhow, Result, Context};
6+
use anyhow::{anyhow, Context, Result};
77
use toml::Value;
88
use walkdir::WalkDir;
99

0 commit comments

Comments
 (0)