Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8ace346

Browse files
committed
Auto merge of rust-lang#120209 - TaKO8Ki:rollup-sicsyig, r=TaKO8Ki
Rollup of 12 pull requests Successful merges: - rust-lang#118639 (Undeprecate lint `unstable_features` and make use of it in the compiler) - rust-lang#118714 ( Explanation that fields are being used when deriving `(Partial)Ord` on enums) - rust-lang#119801 (Fix deallocation with wrong allocator in (A)Rc::from_box_in) - rust-lang#119948 (Make `unsafe_op_in_unsafe_fn` migrated in edition 2024) - rust-lang#119999 (remote-test: use u64 to represent file size) - rust-lang#120058 (bootstrap: improvements for compiler builds) - rust-lang#120160 (Manually implement derived `NonZero` traits.) - rust-lang#120177 (Remove duplicate dependencies for rustc) - rust-lang#120185 (coverage: Don't instrument `#[automatically_derived]` functions) - rust-lang#120194 (Shorten `#[must_use]` Diagnostic Message for `Option::is_none`) - rust-lang#120200 (Correct the anchor of an URL in an error message) - rust-lang#120203 (Replace `#!/bin/bash` with `#!/usr/bin/env bash` in rust-installer tests) r? `@ghost` `@rustbot` modify labels: rollup
2 parents ef71f10 + 1024093 commit 8ace346

40 files changed

+383
-226
lines changed

Cargo.lock

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,12 @@ dependencies = [
310310

311311
[[package]]
312312
name = "bstr"
313-
version = "1.5.0"
313+
version = "1.9.0"
314314
source = "registry+https://github.com/rust-lang/crates.io-index"
315-
checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5"
315+
checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc"
316316
dependencies = [
317317
"memchr",
318-
"once_cell",
319-
"regex-automata 0.1.10",
318+
"regex-automata 0.4.3",
320319
"serde",
321320
]
322321

@@ -1589,11 +1588,11 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
15891588

15901589
[[package]]
15911590
name = "globset"
1592-
version = "0.4.10"
1591+
version = "0.4.13"
15931592
source = "registry+https://github.com/rust-lang/crates.io-index"
1594-
checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
1593+
checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d"
15951594
dependencies = [
1596-
"aho-corasick 0.7.20",
1595+
"aho-corasick 1.0.2",
15971596
"bstr",
15981597
"fnv",
15991598
"log",
@@ -2370,9 +2369,9 @@ dependencies = [
23702369

23712370
[[package]]
23722371
name = "memchr"
2373-
version = "2.5.0"
2372+
version = "2.7.1"
23742373
source = "registry+https://github.com/rust-lang/crates.io-index"
2375-
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
2374+
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
23762375
dependencies = [
23772376
"compiler_builtins",
23782377
"rustc-std-workspace-core",
@@ -3183,6 +3182,12 @@ dependencies = [
31833182
"memchr",
31843183
]
31853184

3185+
[[package]]
3186+
name = "regex-automata"
3187+
version = "0.4.3"
3188+
source = "registry+https://github.com/rust-lang/crates.io-index"
3189+
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
3190+
31863191
[[package]]
31873192
name = "regex-syntax"
31883193
version = "0.6.29"
@@ -5424,7 +5429,7 @@ name = "tidy"
54245429
version = "0.1.0"
54255430
dependencies = [
54265431
"cargo-platform",
5427-
"cargo_metadata 0.15.4",
5432+
"cargo_metadata 0.18.0",
54285433
"ignore",
54295434
"lazy_static",
54305435
"miropt-test-tools",

compiler/rustc_codegen_ssa/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ codegen_ssa_unsupported_arch = unsupported arch `{$arch}` for os `{$os}`
325325
326326
codegen_ssa_unsupported_link_self_contained = option `-C link-self-contained` is not supported on this target
327327
328-
codegen_ssa_use_cargo_directive = use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
328+
codegen_ssa_use_cargo_directive = use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)
329329
330330
codegen_ssa_version_script_write_failure = failed to write version script: {$error}
331331

compiler/rustc_lexer/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
//! [`rustc_parse::lexer`]: ../rustc_parse/lexer/index.html
2121
#![deny(rustc::untranslatable_diagnostic)]
2222
#![deny(rustc::diagnostic_outside_of_impl)]
23-
// We want to be able to build this crate with a stable compiler, so no
24-
// `#![feature]` attributes should be added.
23+
// We want to be able to build this crate with a stable compiler,
24+
// so no `#![feature]` attributes should be added.
25+
#![deny(unstable_features)]
2526

2627
mod cursor;
2728
pub mod unescape;

compiler/rustc_lint/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ lint_builtin_unsafe_impl = implementation of an `unsafe` trait
148148
149149
lint_builtin_unsafe_trait = declaration of an `unsafe` trait
150150
151-
lint_builtin_unstable_features = unstable feature
151+
lint_builtin_unstable_features = use of an unstable feature
152152
153153
lint_builtin_unused_doc_comment = unused doc comment
154154
.label = rustdoc does not generate documentation for {$kind}

compiler/rustc_lint/src/builtin.rs

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,10 +1233,30 @@ impl<'tcx> LateLintPass<'tcx> for MutableTransmutes {
12331233
}
12341234

12351235
declare_lint! {
1236-
/// The `unstable_features` is deprecated and should no longer be used.
1236+
/// The `unstable_features` lint detects uses of `#![feature]`.
1237+
///
1238+
/// ### Example
1239+
///
1240+
/// ```rust,compile_fail
1241+
/// #![deny(unstable_features)]
1242+
/// #![feature(test)]
1243+
/// ```
1244+
///
1245+
/// {{produces}}
1246+
///
1247+
/// ### Explanation
1248+
///
1249+
/// In larger nightly-based projects which
1250+
///
1251+
/// * consist of a multitude of crates where a subset of crates has to compile on
1252+
/// stable either unconditionally or depending on a `cfg` flag to for example
1253+
/// allow stable users to depend on them,
1254+
/// * don't use nightly for experimental features but for, e.g., unstable options only,
1255+
///
1256+
/// this lint may come in handy to enforce policies of these kinds.
12371257
UNSTABLE_FEATURES,
12381258
Allow,
1239-
"enabling unstable features (deprecated. do not use)"
1259+
"enabling unstable features"
12401260
}
12411261

12421262
declare_lint_pass!(
@@ -1246,11 +1266,11 @@ declare_lint_pass!(
12461266

12471267
impl<'tcx> LateLintPass<'tcx> for UnstableFeatures {
12481268
fn check_attribute(&mut self, cx: &LateContext<'_>, attr: &ast::Attribute) {
1249-
if attr.has_name(sym::feature) {
1250-
if let Some(items) = attr.meta_item_list() {
1251-
for item in items {
1252-
cx.emit_spanned_lint(UNSTABLE_FEATURES, item.span(), BuiltinUnstableFeatures);
1253-
}
1269+
if attr.has_name(sym::feature)
1270+
&& let Some(items) = attr.meta_item_list()
1271+
{
1272+
for item in items {
1273+
cx.emit_spanned_lint(UNSTABLE_FEATURES, item.span(), BuiltinUnstableFeatures);
12541274
}
12551275
}
12561276
}

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2755,6 +2755,11 @@ declare_lint! {
27552755
pub UNSAFE_OP_IN_UNSAFE_FN,
27562756
Allow,
27572757
"unsafe operations in unsafe functions without an explicit unsafe block are deprecated",
2758+
@future_incompatible = FutureIncompatibleInfo {
2759+
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
2760+
reference: "issue #71668 <https://github.com/rust-lang/rust/issues/71668>",
2761+
explain_reason: false
2762+
};
27582763
@edition Edition2024 => Warn;
27592764
}
27602765

compiler/rustc_mir_build/src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ impl AddToDiagnostic for UnsafeNotInheritedLintNote {
430430
diag.tool_only_multipart_suggestion(
431431
fluent::mir_build_wrap_suggestion,
432432
vec![(body_start, "{ unsafe ".into()), (body_end, "}".into())],
433-
Applicability::MaybeIncorrect,
433+
Applicability::MachineApplicable,
434434
);
435435
}
436436
}

compiler/rustc_mir_transform/src/coverage/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,18 @@ fn is_eligible_for_coverage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
351351
return false;
352352
}
353353

354+
// Don't instrument functions with `#[automatically_derived]` on their
355+
// enclosing impl block, on the assumption that most users won't care about
356+
// coverage for derived impls.
357+
if let Some(impl_of) = tcx.impl_of_method(def_id.to_def_id())
358+
&& tcx.is_automatically_derived(impl_of)
359+
{
360+
trace!("InstrumentCoverage skipped for {def_id:?} (automatically derived)");
361+
return false;
362+
}
363+
354364
if tcx.codegen_fn_attrs(def_id).flags.contains(CodegenFnAttrFlags::NO_COVERAGE) {
365+
trace!("InstrumentCoverage skipped for {def_id:?} (`#[coverage(off)]`)");
355366
return false;
356367
}
357368

compiler/rustc_parse_format/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
)]
1212
#![deny(rustc::untranslatable_diagnostic)]
1313
#![deny(rustc::diagnostic_outside_of_impl)]
14-
// WARNING: We want to be able to build this crate with a stable compiler,
15-
// so no `#![feature]` attributes should be added!
14+
// We want to be able to build this crate with a stable compiler,
15+
// so no `#![feature]` attributes should be added.
16+
#![deny(unstable_features)]
1617

1718
use rustc_lexer::unescape;
1819
pub use Alignment::*;

library/alloc/src/rc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1924,7 +1924,7 @@ impl<T: ?Sized, A: Allocator> Rc<T, A> {
19241924

19251925
// Free the allocation without dropping its contents
19261926
let (bptr, alloc) = Box::into_raw_with_allocator(src);
1927-
let src = Box::from_raw(bptr as *mut mem::ManuallyDrop<T>);
1927+
let src = Box::from_raw_in(bptr as *mut mem::ManuallyDrop<T>, alloc.by_ref());
19281928
drop(src);
19291929

19301930
Self::from_ptr_in(ptr, alloc)

0 commit comments

Comments
 (0)