Skip to content

Commit fda0bb9

Browse files
authored
Merge pull request #713 from GuillaumeGomez/fix-warnings
Fix fuzz warnings and deny warnings by default in build system
2 parents 82d7cd4 + 8392a00 commit fda0bb9

File tree

19 files changed

+204
-180
lines changed

19 files changed

+204
-180
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,20 @@ jobs:
8282
#path: rust
8383
#key: ${{ runner.os }}-packages-${{ hashFiles('rust/.git/HEAD') }}
8484

85+
- name: Prepare
86+
run: ./y.sh prepare --only-libcore
87+
88+
- name: Check formatting
89+
run: ./y.sh fmt --check
90+
91+
- name: clippy
92+
run: |
93+
cargo clippy --all-targets -- -D warnings
94+
cargo clippy --all-targets --no-default-features -- -D warnings
95+
cargo clippy --manifest-path build_system/Cargo.toml --all-targets -- -D warnings
96+
8597
- name: Build
8698
run: |
87-
./y.sh prepare --only-libcore
8899
./y.sh build --sysroot
89100
./y.sh test --cargo-tests
90101
@@ -106,14 +117,6 @@ jobs:
106117
run: |
107118
./y.sh test --release --clean --build-sysroot ${{ matrix.commands }}
108119
109-
- name: Check formatting
110-
run: ./y.sh fmt --check
111-
112-
- name: clippy
113-
run: |
114-
cargo clippy --all-targets -- -D warnings
115-
cargo clippy --all-targets --features master -- -D warnings
116-
117120
duplicates:
118121
runs-on: ubuntu-24.04
119122
steps:

Cargo.lock

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ dependencies = [
8181
"unicode-width",
8282
]
8383

84+
[[package]]
85+
name = "getrandom"
86+
version = "0.3.3"
87+
source = "registry+https://github.com/rust-lang/crates.io-index"
88+
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
89+
dependencies = [
90+
"cfg-if",
91+
"libc",
92+
"r-efi",
93+
"wasi",
94+
]
95+
8496
[[package]]
8597
name = "hermit-abi"
8698
version = "0.3.1"
@@ -111,9 +123,9 @@ checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d"
111123

112124
[[package]]
113125
name = "linux-raw-sys"
114-
version = "0.4.14"
126+
version = "0.9.4"
115127
source = "registry+https://github.com/rust-lang/crates.io-index"
116-
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
128+
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
117129

118130
[[package]]
119131
name = "memchr"
@@ -137,6 +149,12 @@ version = "1.20.2"
137149
source = "registry+https://github.com/rust-lang/crates.io-index"
138150
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
139151

152+
[[package]]
153+
name = "r-efi"
154+
version = "5.2.0"
155+
source = "registry+https://github.com/rust-lang/crates.io-index"
156+
checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
157+
140158
[[package]]
141159
name = "regex"
142160
version = "1.8.4"
@@ -166,9 +184,9 @@ dependencies = [
166184

167185
[[package]]
168186
name = "rustix"
169-
version = "0.38.42"
187+
version = "1.0.7"
170188
source = "registry+https://github.com/rust-lang/crates.io-index"
171-
checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85"
189+
checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266"
172190
dependencies = [
173191
"bitflags",
174192
"errno",
@@ -188,12 +206,12 @@ dependencies = [
188206

189207
[[package]]
190208
name = "tempfile"
191-
version = "3.14.0"
209+
version = "3.20.0"
192210
source = "registry+https://github.com/rust-lang/crates.io-index"
193-
checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c"
211+
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
194212
dependencies = [
195-
"cfg-if",
196213
"fastrand",
214+
"getrandom",
197215
"once_cell",
198216
"rustix",
199217
"windows-sys",
@@ -242,6 +260,15 @@ dependencies = [
242260
"winapi-util",
243261
]
244262

263+
[[package]]
264+
name = "wasi"
265+
version = "0.14.2+wasi-0.2.4"
266+
source = "registry+https://github.com/rust-lang/crates.io-index"
267+
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
268+
dependencies = [
269+
"wit-bindgen-rt",
270+
]
271+
245272
[[package]]
246273
name = "winapi"
247274
version = "0.3.9"
@@ -345,3 +372,12 @@ name = "windows_x86_64_msvc"
345372
version = "0.52.6"
346373
source = "registry+https://github.com/rust-lang/crates.io-index"
347374
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
375+
376+
[[package]]
377+
name = "wit-bindgen-rt"
378+
version = "0.39.0"
379+
source = "registry+https://github.com/rust-lang/crates.io-index"
380+
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
381+
dependencies = [
382+
"bitflags",
383+
]

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ gccjit = "2.7"
3131
[dev-dependencies]
3232
boml = "0.3.1"
3333
lang_tester = "0.8.0"
34-
tempfile = "3.7.1"
34+
tempfile = "3.20"
3535

3636
[profile.dev]
3737
# By compiling dependencies with optimizations, performing tests gets much faster.

build_system/src/build.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl BuildArg {
3333
}
3434
arg => {
3535
if !build_arg.config_info.parse_argument(arg, &mut args)? {
36-
return Err(format!("Unknown argument `{}`", arg));
36+
return Err(format!("Unknown argument `{arg}`"));
3737
}
3838
}
3939
}
@@ -105,14 +105,14 @@ pub fn create_build_sysroot_content(start_dir: &Path) -> Result<(), String> {
105105
if !start_dir.is_dir() {
106106
create_dir(start_dir)?;
107107
}
108-
copy_file("build_system/build_sysroot/Cargo.toml", &start_dir.join("Cargo.toml"))?;
109-
copy_file("build_system/build_sysroot/Cargo.lock", &start_dir.join("Cargo.lock"))?;
108+
copy_file("build_system/build_sysroot/Cargo.toml", start_dir.join("Cargo.toml"))?;
109+
copy_file("build_system/build_sysroot/Cargo.lock", start_dir.join("Cargo.lock"))?;
110110

111111
let src_dir = start_dir.join("src");
112112
if !src_dir.is_dir() {
113113
create_dir(&src_dir)?;
114114
}
115-
copy_file("build_system/build_sysroot/lib.rs", &start_dir.join("src/lib.rs"))
115+
copy_file("build_system/build_sysroot/lib.rs", start_dir.join("src/lib.rs"))
116116
}
117117

118118
pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Result<(), String> {
@@ -169,7 +169,7 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
169169
run_command(&[&"cp", &"-r", &dir_to_copy, &sysroot_path], None).map(|_| ())
170170
};
171171
walk_dir(
172-
start_dir.join(&format!("target/{}/{}/deps", config.target_triple, channel)),
172+
start_dir.join(format!("target/{}/{}/deps", config.target_triple, channel)),
173173
&mut copier.clone(),
174174
&mut copier,
175175
false,

build_system/src/clean.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ enum CleanArg {
1717
impl CleanArg {
1818
fn new() -> Result<Self, String> {
1919
// We skip the binary and the "clean" option.
20-
for arg in std::env::args().skip(2) {
20+
if let Some(arg) = std::env::args().nth(2) {
2121
return match arg.as_str() {
2222
"all" => Ok(Self::All),
2323
"ui-tests" => Ok(Self::UiTests),
2424
"--help" => Ok(Self::Help),
25-
a => Err(format!("Unknown argument `{}`", a)),
25+
a => Err(format!("Unknown argument `{a}`")),
2626
};
2727
}
2828
Ok(Self::default())

build_system/src/clone_gcc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Args {
4343
}
4444
arg => {
4545
if !command_args.config_info.parse_argument(arg, &mut args)? {
46-
return Err(format!("Unknown option {}", arg));
46+
return Err(format!("Unknown option {arg}"));
4747
}
4848
}
4949
}
@@ -52,7 +52,7 @@ impl Args {
5252
Some(p) => p.into(),
5353
None => PathBuf::from("./gcc"),
5454
};
55-
return Ok(Some(command_args));
55+
Ok(Some(command_args))
5656
}
5757
}
5858

@@ -64,7 +64,7 @@ pub fn run() -> Result<(), String> {
6464
let result = git_clone("https://github.com/rust-lang/gcc", Some(&args.out_path), false)?;
6565
if result.ran_clone {
6666
let gcc_commit = args.config_info.get_gcc_commit()?;
67-
println!("Checking out GCC commit `{}`...", gcc_commit);
67+
println!("Checking out GCC commit `{gcc_commit}`...");
6868
run_command_with_output(
6969
&[&"git", &"checkout", &gcc_commit],
7070
Some(Path::new(&result.repo_dir)),

0 commit comments

Comments
 (0)