Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
run_type: ${{ steps.jobs.outputs.run_type }}
steps:
- name: Checkout the source code
uses: actions/checkout@v5
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Test citool
# Only test citool on the auto branch, to reduce latency of the calculate matrix job
# on PR/try builds.
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
run: git config --global core.autocrlf false

- name: checkout the source code
uses: actions/checkout@v5
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
fetch-depth: 2

Expand Down Expand Up @@ -254,7 +254,7 @@ jobs:
df -h
- name: upload artifacts to github
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
# name is set in previous step
name: ${{ env.DOC_ARTIFACT_NAME }}
Expand Down Expand Up @@ -315,7 +315,7 @@ jobs:
environment: ${{ (github.repository == 'rust-lang/rust' && 'bors') || '' }}
steps:
- name: checkout the source code
uses: actions/checkout@v5
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
fetch-depth: 2
# Publish the toolstate if an auto build succeeds (just before push to the default branch)
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: checkout the source code
uses: actions/checkout@v5
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
submodules: recursive
- name: install the bootstrap toolchain
Expand All @@ -66,7 +66,7 @@ jobs:
run: ./src/tools/update-lockfile.sh

- name: upload Cargo.lock artifact for use in PR
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: Cargo-lock
path: |
Expand All @@ -75,7 +75,7 @@ jobs:
src/tools/rustbook/Cargo.lock
retention-days: 1
- name: upload cargo-update log artifact for use in PR
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: cargo-updates
path: cargo_update.log
Expand All @@ -91,14 +91,14 @@ jobs:
pull-requests: write
steps:
- name: checkout the source code
uses: actions/checkout@v5
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5

- name: download Cargo.lock from update job
uses: actions/download-artifact@v8
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: Cargo-lock
- name: download cargo-update log from update job
uses: actions/download-artifact@v8
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: cargo-updates

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
# Needed to write to the ghcr.io registry
packages: write
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
# Make sure that we have enough commits to find the parent merge commit.
# Since all merges should be through merge commits, fetching two commits
Expand Down
46 changes: 24 additions & 22 deletions compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1514,28 +1514,30 @@ impl EarlyLintPass for DoubleNegations {
}
}

declare_lint_pass!(
/// Does nothing as a lint pass, but registers some `Lint`s
/// which are used by other parts of the compiler.
SoftLints => [
WHILE_TRUE,
NON_SHORTHAND_FIELD_PATTERNS,
UNSAFE_CODE,
MISSING_DOCS,
MISSING_COPY_IMPLEMENTATIONS,
MISSING_DEBUG_IMPLEMENTATIONS,
ANONYMOUS_PARAMETERS,
UNUSED_DOC_COMMENTS,
NO_MANGLE_CONST_ITEMS,
NO_MANGLE_GENERIC_ITEMS,
MUTABLE_TRANSMUTES,
UNSTABLE_FEATURES,
UNREACHABLE_PUB,
TYPE_ALIAS_BOUNDS,
TRIVIAL_BOUNDS,
DOUBLE_NEGATIONS
]
);
pub mod soft {
use super::*;

pub fn lint_vec() -> crate::LintVec {
vec![
WHILE_TRUE,
NON_SHORTHAND_FIELD_PATTERNS,
UNSAFE_CODE,
MISSING_DOCS,
MISSING_COPY_IMPLEMENTATIONS,
MISSING_DEBUG_IMPLEMENTATIONS,
ANONYMOUS_PARAMETERS,
UNUSED_DOC_COMMENTS,
NO_MANGLE_CONST_ITEMS,
NO_MANGLE_GENERIC_ITEMS,
MUTABLE_TRANSMUTES,
UNSTABLE_FEATURES,
UNREACHABLE_PUB,
TYPE_ALIAS_BOUNDS,
TRIVIAL_BOUNDS,
DOUBLE_NEGATIONS,
]
}
}

declare_lint! {
/// The `ellipsis_inclusive_range_patterns` lint detects the [`...` range
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/foreign_modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { clashing_extern_declarations, ..*providers };
}

pub(crate) fn get_lints() -> LintVec {
pub(crate) fn lint_vec() -> LintVec {
vec![CLASHING_EXTERN_DECLARATIONS]
}

Expand Down
9 changes: 6 additions & 3 deletions compiler/rustc_lint/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,12 @@ declare_tool_lint! {
report_in_external_macro: true
}

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]);
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
]);

impl<'tcx> LateLintPass<'tcx> for TypeIr {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
Expand Down Expand Up @@ -561,8 +566,6 @@ fn is_span_ctxt_call(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> bool {
declare_tool_lint! {
/// The `symbol_intern_string_literal` detects `Symbol::intern` being called on a string literal
pub rustc::SYMBOL_INTERN_STRING_LITERAL,
// rustc_driver crates out of the compiler can't/shouldn't add preinterned symbols;
// bootstrap will deny this manually
Allow,
"Forbid uses of string literals in `Symbol::intern`, suggesting preinterning instead",
report_in_external_macro: true
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_lint/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use rustc_middle::hir::nested_filter;
use rustc_middle::ty::{self, TyCtxt};
use rustc_session::Session;
use rustc_session::lint::LintPass;
use rustc_session::lint::builtin::HardwiredLints;
use rustc_span::Span;
use tracing::debug;

Expand Down Expand Up @@ -437,7 +436,6 @@ fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) {
})
.collect();

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

Expand Down
48 changes: 33 additions & 15 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ use unused::must_use::*;
use unused::*;

#[rustfmt::skip]
pub use builtin::{MissingDoc, SoftLints};
pub use builtin::MissingDoc;
pub use context::{CheckLintNameResult, EarlyContext, LateContext, LintContext, LintStore};
pub use early::diagnostics::DiagAndSess;
pub use early::{EarlyCheckNode, check_ast_node};
Expand Down Expand Up @@ -281,11 +281,11 @@ fn register_builtins(store: &mut LintStore) {
)
}

store.register_lints(&BuiltinCombinedPreExpansionLintPass::get_lints());
store.register_lints(&BuiltinCombinedEarlyLintPass::get_lints());
store.register_lints(&BuiltinCombinedModuleLateLintPass::get_lints());
store.register_lints(&foreign_modules::get_lints());
store.register_lints(&HardwiredLints::lint_vec());
store.register_lints(&BuiltinCombinedPreExpansionLintPass::lint_vec());
store.register_lints(&BuiltinCombinedEarlyLintPass::lint_vec());
store.register_lints(&BuiltinCombinedModuleLateLintPass::lint_vec());
store.register_lints(&foreign_modules::lint_vec());
store.register_lints(&hardwired::lint_vec());

add_lint_group!(
"nonstandard_style",
Expand Down Expand Up @@ -665,6 +665,10 @@ fn register_builtins(store: &mut LintStore) {
fn register_internals(store: &mut LintStore) {
store.register_lints(&LintPassImpl::lint_vec());
store.register_early_pass(|| Box::new(LintPassImpl));
store.register_lints(&ImplicitSysrootCrateImport::lint_vec());
store.register_early_pass(|| Box::new(ImplicitSysrootCrateImport));
store.register_lints(&BadUseOfFindAttr::lint_vec());
store.register_early_pass(|| Box::new(BadUseOfFindAttr));
store.register_lints(&DefaultHashTypes::lint_vec());
store.register_late_mod_pass(|_| Box::new(DefaultHashTypes));
store.register_lints(&QueryStability::lint_vec());
Expand All @@ -681,32 +685,46 @@ fn register_internals(store: &mut LintStore) {
store.register_late_mod_pass(|_| Box::new(SpanUseEqCtxt));
store.register_lints(&SymbolInternStringLiteral::lint_vec());
store.register_late_mod_pass(|_| Box::new(SymbolInternStringLiteral));
store.register_lints(&ImplicitSysrootCrateImport::lint_vec());
store.register_early_pass(|| Box::new(ImplicitSysrootCrateImport));
store.register_lints(&BadUseOfFindAttr::lint_vec());
store.register_early_pass(|| Box::new(BadUseOfFindAttr));
store.register_lints(&RustcMustMatchExhaustively::lint_vec());
store.register_late_pass(|_| Box::new(RustcMustMatchExhaustively));
store.register_group(
false,
"rustc::internal",
None,
vec![
// Early pass: LintPassImpl
LintId::of(LINT_PASS_IMPL_WITHOUT_MACRO),
// Early pass: ImplicitSysrootCrateImport
LintId::of(IMPLICIT_SYSROOT_CRATE_IMPORT),
// Early pass: BadUseOfFindAttr
LintId::of(BAD_USE_OF_FIND_ATTR),
// Late pass: DefaultHashTypes
LintId::of(DEFAULT_HASH_TYPES),
// Late pass: QueryStability
LintId::of(POTENTIAL_QUERY_INSTABILITY),
LintId::of(UNTRACKED_QUERY_INFORMATION),
// Late pass: TyTyKind
LintId::of(USAGE_OF_TY_TYKIND),
LintId::of(DISALLOWED_PASS_BY_REF),
LintId::of(LINT_PASS_IMPL_WITHOUT_MACRO),
LintId::of(USAGE_OF_QUALIFIED_TY),
// Late pass: TypeIr
LintId::of(DIRECT_USE_OF_RUSTC_TYPE_IR),
LintId::of(NON_GLOB_IMPORT_OF_TYPE_IR_INHERENT),
LintId::of(USAGE_OF_TYPE_IR_INHERENT),
LintId::of(USAGE_OF_TYPE_IR_TRAITS),
// Late pass: BadOptAccess
LintId::of(BAD_OPT_ACCESS),
// Late pass: DisallowedPassByRef
LintId::of(DISALLOWED_PASS_BY_REF),
// Late pass: SpanUseEqCtxt
LintId::of(SPAN_USE_EQ_CTXT),
LintId::of(DIRECT_USE_OF_RUSTC_TYPE_IR),
LintId::of(IMPLICIT_SYSROOT_CRATE_IMPORT),
LintId::of(BAD_USE_OF_FIND_ATTR),
// Late pass: SymbolInternStringLiteral
// Note: this one is not included in rustc::internal because rustc_driver crates
// outside the compiler can't/shouldn't add preinterned symbols. For rustc itself,
// bootstrap enables this lint manually. For rustdoc,
// `warn(symbol_intern_string_literal)` is used.
// LintId::of(SYMBOL_INTERN_STRING_LITERAL),
//
// Late pass: RustcMustMatchExhaustively
LintId::of(RUSTC_MUST_MATCH_EXHAUSTIVELY),
],
);
Expand Down
9 changes: 3 additions & 6 deletions compiler/rustc_lint/src/passes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use rustc_session::lint::LintPass;
use rustc_session::lint::builtin::HardwiredLints;

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

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

impl LateLintPass<'_> for HardwiredLints {}

#[macro_export]
macro_rules! expand_combined_late_lint_pass_method {
([$($pass:ident),*], $self: ident, $name: ident, $params:tt) => ({
Expand Down Expand Up @@ -109,7 +106,7 @@ macro_rules! declare_combined_late_lint_pass {
}
}

$v fn get_lints() -> $crate::LintVec {
$v fn lint_vec() -> $crate::LintVec {
let mut lints = Vec::new();
$(lints.extend_from_slice(&$pass::lint_vec());)*
lints
Expand All @@ -126,7 +123,7 @@ macro_rules! declare_combined_late_lint_pass {
stringify!($name)
}
fn get_lints(&self) -> LintVec {
$name::get_lints()
$name::lint_vec()
}
}
)
Expand Down Expand Up @@ -226,7 +223,7 @@ macro_rules! declare_combined_early_lint_pass {
}
}

$v fn get_lints() -> $crate::LintVec {
$v fn lint_vec() -> $crate::LintVec {
let mut lints = Vec::new();
$(lints.extend_from_slice(&$pass::lint_vec());)*
lints
Expand Down
Loading
Loading