Skip to content

Commit 897e375

Browse files
committed
Auto merge of #103859 - Mark-Simulacrum:stable-next, r=flip1995
[stable] Lower lint level for READ_ZERO_BYTE_VEC This avoids reporting false-positives; see rust-lang/rust-clippy#9274 for details. cc `@rust-lang/clippy` -- do we want a direct change landed on stable here? If so, please r+ this PR, otherwise we can just close it. Would appreciate confirmation this is the right change to make as well. cc `@joshtriplett` -- filing due to https://rust-lang.zulipchat.com/#narrow/stream/301329-t-devtools/topic/clippy.20false.20positive
2 parents d939e5a + 3100c85 commit 897e375

7 files changed

+22
-13
lines changed

src/bootstrap/config.rs

+16-6
Original file line numberDiff line numberDiff line change
@@ -1280,11 +1280,21 @@ impl Config {
12801280
git
12811281
}
12821282

1283-
pub(crate) fn artifact_channel(&self, commit: &str) -> String {
1283+
pub(crate) fn artifact_version_part(&self, commit: &str) -> String {
12841284
let mut channel = self.git();
12851285
channel.arg("show").arg(format!("{}:src/ci/channel", commit));
12861286
let channel = output(&mut channel);
1287-
channel.trim().to_owned()
1287+
1288+
let mut version = self.git();
1289+
version.arg("show").arg(format!("{}:src/version", commit));
1290+
let version = output(&mut version);
1291+
1292+
match channel.trim() {
1293+
"stable" => version.trim().to_owned(),
1294+
"beta" => channel.trim().to_owned(),
1295+
"nightly" => channel.trim().to_owned(),
1296+
other => unreachable!("{:?} is not recognized as a valid channel", other),
1297+
}
12881298
}
12891299

12901300
/// Try to find the relative path of `bindir`, otherwise return it in full.
@@ -1526,7 +1536,7 @@ fn maybe_download_rustfmt(builder: &Builder<'_>) -> Option<PathBuf> {
15261536

15271537
fn download_ci_rustc(builder: &Builder<'_>, commit: &str) {
15281538
builder.verbose(&format!("using downloaded stage2 artifacts from CI (commit {commit})"));
1529-
let channel = builder.config.artifact_channel(commit);
1539+
let version = builder.config.artifact_version_part(commit);
15301540
let host = builder.config.build.triple;
15311541
let bin_root = builder.out.join(host).join("ci-rustc");
15321542
let rustc_stamp = bin_root.join(".rustc-stamp");
@@ -1535,13 +1545,13 @@ fn download_ci_rustc(builder: &Builder<'_>, commit: &str) {
15351545
if bin_root.exists() {
15361546
t!(fs::remove_dir_all(&bin_root));
15371547
}
1538-
let filename = format!("rust-std-{channel}-{host}.tar.xz");
1548+
let filename = format!("rust-std-{version}-{host}.tar.xz");
15391549
let pattern = format!("rust-std-{host}");
15401550
download_ci_component(builder, filename, &pattern, commit);
1541-
let filename = format!("rustc-{channel}-{host}.tar.xz");
1551+
let filename = format!("rustc-{version}-{host}.tar.xz");
15421552
download_ci_component(builder, filename, "rustc", commit);
15431553
// download-rustc doesn't need its own cargo, it can just use beta's.
1544-
let filename = format!("rustc-dev-{channel}-{host}.tar.xz");
1554+
let filename = format!("rustc-dev-{version}-{host}.tar.xz");
15451555
download_ci_component(builder, filename, "rustc-dev", commit);
15461556

15471557
builder.fix_bin_or_dylib(&bin_root.join("bin").join("rustc"));

src/bootstrap/native.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ fn download_ci_llvm(builder: &Builder<'_>, llvm_sha: &str) {
260260
} else {
261261
&builder.config.stage0_metadata.config.artifacts_server
262262
};
263-
let channel = builder.config.artifact_channel(llvm_sha);
264-
let filename = format!("rust-dev-{}-{}.tar.xz", channel, builder.build.build.triple);
263+
let version = builder.config.artifact_version_part(llvm_sha);
264+
let filename = format!("rust-dev-{}-{}.tar.xz", version, builder.build.build.triple);
265265
let tarball = rustc_cache.join(&filename);
266266
if !tarball.exists() {
267267
let help_on_error = "error: failed to download llvm from ci

src/tools/clippy/clippy_lints/src/lib.register_all.rs

-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
289289
LintId::of(ranges::MANUAL_RANGE_CONTAINS),
290290
LintId::of(ranges::REVERSED_EMPTY_RANGES),
291291
LintId::of(rc_clone_in_vec_init::RC_CLONE_IN_VEC_INIT),
292-
LintId::of(read_zero_byte_vec::READ_ZERO_BYTE_VEC),
293292
LintId::of(redundant_clone::REDUNDANT_CLONE),
294293
LintId::of(redundant_closure_call::REDUNDANT_CLOSURE_CALL),
295294
LintId::of(redundant_field_names::REDUNDANT_FIELD_NAMES),

src/tools/clippy/clippy_lints/src/lib.register_correctness.rs

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ store.register_group(true, "clippy::correctness", Some("clippy_correctness"), ve
5959
LintId::of(ptr::INVALID_NULL_PTR_USAGE),
6060
LintId::of(ptr::MUT_FROM_REF),
6161
LintId::of(ranges::REVERSED_EMPTY_RANGES),
62-
LintId::of(read_zero_byte_vec::READ_ZERO_BYTE_VEC),
6362
LintId::of(regex::INVALID_REGEX),
6463
LintId::of(serde_api::SERDE_API_MISUSE),
6564
LintId::of(size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT),

src/tools/clippy/clippy_lints/src/lib.register_nursery.rs

+3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
2525
LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY),
2626
LintId::of(nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES),
2727
LintId::of(option_if_let_else::OPTION_IF_LET_ELSE),
28+
LintId::of(read_zero_byte_vec::READ_ZERO_BYTE_VEC),
2829
LintId::of(redundant_pub_crate::REDUNDANT_PUB_CRATE),
2930
LintId::of(regex::TRIVIAL_REGEX),
3031
LintId::of(strings::STRING_LIT_AS_BYTES),
3132
LintId::of(suspicious_operation_groupings::SUSPICIOUS_OPERATION_GROUPINGS),
3233
LintId::of(trailing_empty_array::TRAILING_EMPTY_ARRAY),
34+
LintId::of(trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS),
35+
LintId::of(trait_bounds::TYPE_REPETITION_IN_BOUNDS),
3336
LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR),
3437
LintId::of(unused_peekable::UNUSED_PEEKABLE),
3538
LintId::of(unused_rounding::UNUSED_ROUNDING),

src/tools/clippy/clippy_lints/src/lib.register_pedantic.rs

-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![
8888
LintId::of(return_self_not_must_use::RETURN_SELF_NOT_MUST_USE),
8989
LintId::of(semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED),
9090
LintId::of(strings::STRING_ADD_ASSIGN),
91-
LintId::of(trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS),
92-
LintId::of(trait_bounds::TYPE_REPETITION_IN_BOUNDS),
9391
LintId::of(transmute::TRANSMUTE_PTR_TO_PTR),
9492
LintId::of(types::LINKEDLIST),
9593
LintId::of(types::OPTION_OPTION),

src/tools/clippy/clippy_lints/src/read_zero_byte_vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ declare_clippy_lint! {
4343
/// ```
4444
#[clippy::version = "1.63.0"]
4545
pub READ_ZERO_BYTE_VEC,
46-
correctness,
46+
nursery,
4747
"checks for reads into a zero-length `Vec`"
4848
}
4949
declare_lint_pass!(ReadZeroByteVec => [READ_ZERO_BYTE_VEC]);

0 commit comments

Comments
 (0)