Skip to content

Commit c1b22f4

Browse files
committed
Auto merge of #158043 - JonathanBrouwer:rollup-dYC8IEa, r=JonathanBrouwer
Rollup of 6 pull requests Successful merges: - #157816 (make more slice mutable ref getters rustc_no_writable) - #156788 (Document that destructors in running threads are not run on program exit) - #157957 (Add documentation for the `must_use` attribute) - #158006 (Simplify `HardwiredLints` and `SoftLints`) - #158007 (Pin dependencies) - #158025 (Enable `symbol_intern_string_literal` lint for rustdoc)
2 parents 693b3e4 + ed85b5b commit c1b22f4

21 files changed

Lines changed: 394 additions & 230 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
run_type: ${{ steps.jobs.outputs.run_type }}
5353
steps:
5454
- name: Checkout the source code
55-
uses: actions/checkout@v5
55+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
5656
- name: Test citool
5757
# Only test citool on the auto branch, to reduce latency of the calculate matrix job
5858
# on PR/try builds.
@@ -117,7 +117,7 @@ jobs:
117117
run: git config --global core.autocrlf false
118118

119119
- name: checkout the source code
120-
uses: actions/checkout@v5
120+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
121121
with:
122122
fetch-depth: 2
123123

@@ -254,7 +254,7 @@ jobs:
254254
df -h
255255
256256
- name: upload artifacts to github
257-
uses: actions/upload-artifact@v7
257+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
258258
with:
259259
# name is set in previous step
260260
name: ${{ env.DOC_ARTIFACT_NAME }}
@@ -315,7 +315,7 @@ jobs:
315315
environment: ${{ (github.repository == 'rust-lang/rust' && 'bors') || '' }}
316316
steps:
317317
- name: checkout the source code
318-
uses: actions/checkout@v5
318+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
319319
with:
320320
fetch-depth: 2
321321
# Publish the toolstate if an auto build succeeds (just before push to the default branch)

.github/workflows/dependencies.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
runs-on: ubuntu-24.04
5252
steps:
5353
- name: checkout the source code
54-
uses: actions/checkout@v5
54+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
5555
with:
5656
submodules: recursive
5757
- name: install the bootstrap toolchain
@@ -66,7 +66,7 @@ jobs:
6666
run: ./src/tools/update-lockfile.sh
6767

6868
- name: upload Cargo.lock artifact for use in PR
69-
uses: actions/upload-artifact@v7
69+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
7070
with:
7171
name: Cargo-lock
7272
path: |
@@ -75,7 +75,7 @@ jobs:
7575
src/tools/rustbook/Cargo.lock
7676
retention-days: 1
7777
- name: upload cargo-update log artifact for use in PR
78-
uses: actions/upload-artifact@v7
78+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
7979
with:
8080
name: cargo-updates
8181
path: cargo_update.log
@@ -91,14 +91,14 @@ jobs:
9191
pull-requests: write
9292
steps:
9393
- name: checkout the source code
94-
uses: actions/checkout@v5
94+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
9595

9696
- name: download Cargo.lock from update job
97-
uses: actions/download-artifact@v8
97+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
9898
with:
9999
name: Cargo-lock
100100
- name: download cargo-update log from update job
101-
uses: actions/download-artifact@v8
101+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
102102
with:
103103
name: cargo-updates
104104

.github/workflows/ghcr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
# Needed to write to the ghcr.io registry
3030
packages: write
3131
steps:
32-
- uses: actions/checkout@v5
32+
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
3333
with:
3434
persist-credentials: false
3535

.github/workflows/post-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
permissions:
1616
pull-requests: write
1717
steps:
18-
- uses: actions/checkout@v5
18+
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
1919
with:
2020
# Make sure that we have enough commits to find the parent merge commit.
2121
# Since all merges should be through merge commits, fetching two commits

compiler/rustc_lint/src/builtin.rs

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,28 +1514,30 @@ impl EarlyLintPass for DoubleNegations {
15141514
}
15151515
}
15161516

1517-
declare_lint_pass!(
1518-
/// Does nothing as a lint pass, but registers some `Lint`s
1519-
/// which are used by other parts of the compiler.
1520-
SoftLints => [
1521-
WHILE_TRUE,
1522-
NON_SHORTHAND_FIELD_PATTERNS,
1523-
UNSAFE_CODE,
1524-
MISSING_DOCS,
1525-
MISSING_COPY_IMPLEMENTATIONS,
1526-
MISSING_DEBUG_IMPLEMENTATIONS,
1527-
ANONYMOUS_PARAMETERS,
1528-
UNUSED_DOC_COMMENTS,
1529-
NO_MANGLE_CONST_ITEMS,
1530-
NO_MANGLE_GENERIC_ITEMS,
1531-
MUTABLE_TRANSMUTES,
1532-
UNSTABLE_FEATURES,
1533-
UNREACHABLE_PUB,
1534-
TYPE_ALIAS_BOUNDS,
1535-
TRIVIAL_BOUNDS,
1536-
DOUBLE_NEGATIONS
1537-
]
1538-
);
1517+
pub mod soft {
1518+
use super::*;
1519+
1520+
pub fn lint_vec() -> crate::LintVec {
1521+
vec![
1522+
WHILE_TRUE,
1523+
NON_SHORTHAND_FIELD_PATTERNS,
1524+
UNSAFE_CODE,
1525+
MISSING_DOCS,
1526+
MISSING_COPY_IMPLEMENTATIONS,
1527+
MISSING_DEBUG_IMPLEMENTATIONS,
1528+
ANONYMOUS_PARAMETERS,
1529+
UNUSED_DOC_COMMENTS,
1530+
NO_MANGLE_CONST_ITEMS,
1531+
NO_MANGLE_GENERIC_ITEMS,
1532+
MUTABLE_TRANSMUTES,
1533+
UNSTABLE_FEATURES,
1534+
UNREACHABLE_PUB,
1535+
TYPE_ALIAS_BOUNDS,
1536+
TRIVIAL_BOUNDS,
1537+
DOUBLE_NEGATIONS,
1538+
]
1539+
}
1540+
}
15391541

15401542
declare_lint! {
15411543
/// The `ellipsis_inclusive_range_patterns` lint detects the [`...` range

compiler/rustc_lint/src/foreign_modules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(crate) fn provide(providers: &mut Providers) {
1717
*providers = Providers { clashing_extern_declarations, ..*providers };
1818
}
1919

20-
pub(crate) fn get_lints() -> LintVec {
20+
pub(crate) fn lint_vec() -> LintVec {
2121
vec![CLASHING_EXTERN_DECLARATIONS]
2222
}
2323

compiler/rustc_lint/src/internal.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,12 @@ declare_tool_lint! {
369369
report_in_external_macro: true
370370
}
371371

372-
declare_lint_pass!(TypeIr => [DIRECT_USE_OF_RUSTC_TYPE_IR, NON_GLOB_IMPORT_OF_TYPE_IR_INHERENT, USAGE_OF_TYPE_IR_INHERENT, USAGE_OF_TYPE_IR_TRAITS]);
372+
declare_lint_pass!(TypeIr => [
373+
DIRECT_USE_OF_RUSTC_TYPE_IR,
374+
NON_GLOB_IMPORT_OF_TYPE_IR_INHERENT,
375+
USAGE_OF_TYPE_IR_INHERENT,
376+
USAGE_OF_TYPE_IR_TRAITS
377+
]);
373378

374379
impl<'tcx> LateLintPass<'tcx> for TypeIr {
375380
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
@@ -561,8 +566,6 @@ fn is_span_ctxt_call(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> bool {
561566
declare_tool_lint! {
562567
/// The `symbol_intern_string_literal` detects `Symbol::intern` being called on a string literal
563568
pub rustc::SYMBOL_INTERN_STRING_LITERAL,
564-
// rustc_driver crates out of the compiler can't/shouldn't add preinterned symbols;
565-
// bootstrap will deny this manually
566569
Allow,
567570
"Forbid uses of string literals in `Symbol::intern`, suggesting preinterning instead",
568571
report_in_external_macro: true

compiler/rustc_lint/src/late.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use rustc_middle::hir::nested_filter;
1414
use rustc_middle::ty::{self, TyCtxt};
1515
use rustc_session::Session;
1616
use rustc_session::lint::LintPass;
17-
use rustc_session::lint::builtin::HardwiredLints;
1817
use rustc_span::Span;
1918
use tracing::debug;
2019

@@ -437,7 +436,6 @@ fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) {
437436
})
438437
.collect();
439438

440-
filtered_passes.push(Box::new(HardwiredLints));
441439
let pass = RuntimeCombinedLateLintPass { passes: &mut filtered_passes[..] };
442440
let mut cx = LateContextAndPass { context, pass };
443441

compiler/rustc_lint/src/lib.rs

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ use unused::must_use::*;
132132
use unused::*;
133133

134134
#[rustfmt::skip]
135-
pub use builtin::{MissingDoc, SoftLints};
135+
pub use builtin::MissingDoc;
136136
pub use context::{CheckLintNameResult, EarlyContext, LateContext, LintContext, LintStore};
137137
pub use early::diagnostics::DiagAndSess;
138138
pub use early::{EarlyCheckNode, check_ast_node};
@@ -281,11 +281,11 @@ fn register_builtins(store: &mut LintStore) {
281281
)
282282
}
283283

284-
store.register_lints(&BuiltinCombinedPreExpansionLintPass::get_lints());
285-
store.register_lints(&BuiltinCombinedEarlyLintPass::get_lints());
286-
store.register_lints(&BuiltinCombinedModuleLateLintPass::get_lints());
287-
store.register_lints(&foreign_modules::get_lints());
288-
store.register_lints(&HardwiredLints::lint_vec());
284+
store.register_lints(&BuiltinCombinedPreExpansionLintPass::lint_vec());
285+
store.register_lints(&BuiltinCombinedEarlyLintPass::lint_vec());
286+
store.register_lints(&BuiltinCombinedModuleLateLintPass::lint_vec());
287+
store.register_lints(&foreign_modules::lint_vec());
288+
store.register_lints(&hardwired::lint_vec());
289289

290290
add_lint_group!(
291291
"nonstandard_style",
@@ -665,6 +665,10 @@ fn register_builtins(store: &mut LintStore) {
665665
fn register_internals(store: &mut LintStore) {
666666
store.register_lints(&LintPassImpl::lint_vec());
667667
store.register_early_pass(|| Box::new(LintPassImpl));
668+
store.register_lints(&ImplicitSysrootCrateImport::lint_vec());
669+
store.register_early_pass(|| Box::new(ImplicitSysrootCrateImport));
670+
store.register_lints(&BadUseOfFindAttr::lint_vec());
671+
store.register_early_pass(|| Box::new(BadUseOfFindAttr));
668672
store.register_lints(&DefaultHashTypes::lint_vec());
669673
store.register_late_mod_pass(|_| Box::new(DefaultHashTypes));
670674
store.register_lints(&QueryStability::lint_vec());
@@ -681,32 +685,46 @@ fn register_internals(store: &mut LintStore) {
681685
store.register_late_mod_pass(|_| Box::new(SpanUseEqCtxt));
682686
store.register_lints(&SymbolInternStringLiteral::lint_vec());
683687
store.register_late_mod_pass(|_| Box::new(SymbolInternStringLiteral));
684-
store.register_lints(&ImplicitSysrootCrateImport::lint_vec());
685-
store.register_early_pass(|| Box::new(ImplicitSysrootCrateImport));
686-
store.register_lints(&BadUseOfFindAttr::lint_vec());
687-
store.register_early_pass(|| Box::new(BadUseOfFindAttr));
688688
store.register_lints(&RustcMustMatchExhaustively::lint_vec());
689689
store.register_late_pass(|_| Box::new(RustcMustMatchExhaustively));
690690
store.register_group(
691691
false,
692692
"rustc::internal",
693693
None,
694694
vec![
695+
// Early pass: LintPassImpl
696+
LintId::of(LINT_PASS_IMPL_WITHOUT_MACRO),
697+
// Early pass: ImplicitSysrootCrateImport
698+
LintId::of(IMPLICIT_SYSROOT_CRATE_IMPORT),
699+
// Early pass: BadUseOfFindAttr
700+
LintId::of(BAD_USE_OF_FIND_ATTR),
701+
// Late pass: DefaultHashTypes
695702
LintId::of(DEFAULT_HASH_TYPES),
703+
// Late pass: QueryStability
696704
LintId::of(POTENTIAL_QUERY_INSTABILITY),
697705
LintId::of(UNTRACKED_QUERY_INFORMATION),
706+
// Late pass: TyTyKind
698707
LintId::of(USAGE_OF_TY_TYKIND),
699-
LintId::of(DISALLOWED_PASS_BY_REF),
700-
LintId::of(LINT_PASS_IMPL_WITHOUT_MACRO),
701708
LintId::of(USAGE_OF_QUALIFIED_TY),
709+
// Late pass: TypeIr
710+
LintId::of(DIRECT_USE_OF_RUSTC_TYPE_IR),
702711
LintId::of(NON_GLOB_IMPORT_OF_TYPE_IR_INHERENT),
703712
LintId::of(USAGE_OF_TYPE_IR_INHERENT),
704713
LintId::of(USAGE_OF_TYPE_IR_TRAITS),
714+
// Late pass: BadOptAccess
705715
LintId::of(BAD_OPT_ACCESS),
716+
// Late pass: DisallowedPassByRef
717+
LintId::of(DISALLOWED_PASS_BY_REF),
718+
// Late pass: SpanUseEqCtxt
706719
LintId::of(SPAN_USE_EQ_CTXT),
707-
LintId::of(DIRECT_USE_OF_RUSTC_TYPE_IR),
708-
LintId::of(IMPLICIT_SYSROOT_CRATE_IMPORT),
709-
LintId::of(BAD_USE_OF_FIND_ATTR),
720+
// Late pass: SymbolInternStringLiteral
721+
// Note: this one is not included in rustc::internal because rustc_driver crates
722+
// outside the compiler can't/shouldn't add preinterned symbols. For rustc itself,
723+
// bootstrap enables this lint manually. For rustdoc,
724+
// `warn(symbol_intern_string_literal)` is used.
725+
// LintId::of(SYMBOL_INTERN_STRING_LITERAL),
726+
//
727+
// Late pass: RustcMustMatchExhaustively
710728
LintId::of(RUSTC_MUST_MATCH_EXHAUSTIVELY),
711729
],
712730
);

compiler/rustc_lint/src/passes.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use rustc_session::lint::LintPass;
2-
use rustc_session::lint::builtin::HardwiredLints;
32

43
use crate::context::{EarlyContext, LateContext};
54

@@ -71,8 +70,6 @@ macro_rules! declare_late_lint_pass {
7170
// for all the `check_*` methods.
7271
late_lint_methods!(declare_late_lint_pass, []);
7372

74-
impl LateLintPass<'_> for HardwiredLints {}
75-
7673
#[macro_export]
7774
macro_rules! expand_combined_late_lint_pass_method {
7875
([$($pass:ident),*], $self: ident, $name: ident, $params:tt) => ({
@@ -109,7 +106,7 @@ macro_rules! declare_combined_late_lint_pass {
109106
}
110107
}
111108

112-
$v fn get_lints() -> $crate::LintVec {
109+
$v fn lint_vec() -> $crate::LintVec {
113110
let mut lints = Vec::new();
114111
$(lints.extend_from_slice(&$pass::lint_vec());)*
115112
lints
@@ -126,7 +123,7 @@ macro_rules! declare_combined_late_lint_pass {
126123
stringify!($name)
127124
}
128125
fn get_lints(&self) -> LintVec {
129-
$name::get_lints()
126+
$name::lint_vec()
130127
}
131128
}
132129
)
@@ -226,7 +223,7 @@ macro_rules! declare_combined_early_lint_pass {
226223
}
227224
}
228225

229-
$v fn get_lints() -> $crate::LintVec {
226+
$v fn lint_vec() -> $crate::LintVec {
230227
let mut lints = Vec::new();
231228
$(lints.extend_from_slice(&$pass::lint_vec());)*
232229
lints

0 commit comments

Comments
 (0)