Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
dcf3a6e
feat: show custom iter adapter in chaining inlayHints
A4-Tacks Oct 22, 2026
21ab4d5
Introduce StoredTerm
nicolas-guichard Oct 13, 2026
e786ac2
Introduce hir_ty::next_solver::TermRefId and TermRefIdPacked
nicolas-guichard Sep 22, 2025
a234c72
Record inferred const for type or const placeholders
nicolas-guichard Sep 22, 2025
86bcadc
Fix extract_type_alias with const generics
nicolas-guichard Sep 22, 2025
8c91870
add tests for `Pool` and fix atomic ordering issue
BenjaminBrienen Nov 16, 2026
3ee2c5d
Merge pull request #23459 from BenjaminBrienen/pool-tests
lnicola Nov 16, 2026
fde3f54
use trusted publishing
BenjaminBrienen Nov 13, 2026
b54f519
Merge pull request #23470 from BenjaminBrienen/trusted-publishing
lnicola Nov 17, 2026
217ada1
ops: Disable credential persistence
hashcatHitman Oct 31, 2026
8ca56db
ops: Prefer `GITHUB_REF` over `github.ref`
hashcatHitman Nov 1, 2026
2d1616c
ops: Prefer `GITHUB_RUN_ID` over `github.run_id`
hashcatHitman Nov 1, 2026
5dd5cfb
ops: Prefer `GITHUB_RUN_NUMBER` over `github.run_number`
hashcatHitman Nov 2, 2026
c76f9d5
ops: Prefer `GITHUB_REPOSITORY` over `github.repository`
hashcatHitman Nov 2, 2026
892e0c2
ops: Prefer shell expansion over template expansion
hashcatHitman Nov 2, 2026
3ab2eaa
ops: Expand `matrix.target` in `env`
hashcatHitman Nov 2, 2026
2c5f92b
ops: Expand `matrix.code-target` in `env`
hashcatHitman Nov 2, 2026
3843e7a
ops: Expand `matrix.names` in `env`
hashcatHitman Nov 2, 2026
b2d8193
ops: Expand `secrets.GITHUB_TOKEN` in `env`
hashcatHitman Nov 2, 2026
ff75e73
ops: Expand `secrets.METRICS_DEPLOY_KEY` in `env`
hashcatHitman Nov 2, 2026
2ae9409
ops: Expand `matrix.cmd` in `env`
hashcatHitman Nov 2, 2026
2a6e8c8
ops: Expand pre-release flag check in `env`
hashcatHitman Nov 2, 2026
ec2e3dc
ops: Expand `llvm-tools` component optional in `env`
hashcatHitman Nov 2, 2026
84455d4
ops: Expand PGO optional in `env`
hashcatHitman Nov 2, 2026
3d06c34
ops: Expand `toJson(needs)` in `env`
hashcatHitman Nov 2, 2026
c3e6cc6
ops: Deduplicate environment variables a bit
hashcatHitman Nov 4, 2026
b7198fe
ops: Expand `matrix.authentication` in `env`
hashcatHitman Nov 17, 2026
68d90ef
minor: short too long roots scanned std path
A4-Tacks Nov 17, 2026
29db7d5
Merge pull request #23672 from A4-Tacks/short-scanned-path
ChayimFriedman2 Nov 17, 2026
12af71a
fix: Accidentally quadratic performance in type inference
Wilfred Nov 16, 2026
71d8acb
Merge pull request #23678 from Wilfred/fix/well-formed-obligation-bui…
ChayimFriedman2 Nov 18, 2026
bf1a91e
Add `r? @ghost` Josh push PR suffix
Kobzol Nov 18, 2026
e694725
Merge pull request #23681 from Kobzol/josh-sync-msg
lnicola Nov 18, 2026
2423345
Prepare for merging from rust-lang/rust
invalid-email-address Nov 19, 2026
83d4957
Merge ref 'e3b9a8345a8a' from rust-lang/rust
invalid-email-address Nov 19, 2026
9a84cb5
Merge pull request #23684 from rust-lang/rustc-pull
lnicola Nov 19, 2026
4f4eae5
fix: allow notable_trait attr args
A4-Tacks Nov 19, 2026
d1b11ad
Enable static-pie on all Musl targets
bjorn3 Nov 19, 2026
6bd3a7f
Merge pull request #23685 from A4-Tacks/notable-trait-args
ChayimFriedman2 Nov 19, 2026
f110dbb
fix: make sure copied lock files are writable
nbdd0121 Nov 19, 2026
d064780
Exclude proc macro crates from lang item computations for their depen…
ChayimFriedman2 Nov 19, 2026
4956c69
Introduce a hack for `PartialEq` lang item attr change in core lib
ShoyuVanilla Nov 20, 2026
f2589b2
Merge pull request #23689 from ChayimFriedman2/lang-items-skip-proc-m…
ShoyuVanilla Nov 20, 2026
8fae9c1
Merge pull request #23594 from hashcatHitman/zizmor
ShoyuVanilla Nov 20, 2026
8abf316
Merge pull request #23691 from ShoyuVanilla/lang-eq
ChayimFriedman2 Nov 20, 2026
ebac758
Add a reason suggestion for malformed lint attributes
vsriramv Nov 20, 2026
b5ff004
Merge pull request #23688 from nbdd0121/master
ChayimFriedman2 Nov 20, 2026
724b27a
fix: Respect is_workspace_member for all crates in rust-project.json
Wilfred Nov 20, 2026
7745f18
Updated UI tests for malformed lint suggestions
vsriramv Nov 20, 2026
64b9abc
Merge pull request #23549 from A4-Tacks/custom-iter-adapter-hints
ShoyuVanilla Nov 20, 2026
d199306
Merge pull request #22211 from nicolas-guichard/push-qltvotzxsuqw
ShoyuVanilla Nov 20, 2026
2a965fd
rm from `Type::instaniate`
ada4a Nov 20, 2026
af81b91
rm from `Type::instaniate_with_errors`
ada4a Nov 20, 2026
13c67ef
rm from `Type::unknown`
ada4a Nov 20, 2026
e2086b9
rm from `Type::new_unit`
ada4a Nov 20, 2026
4a78389
Merge pull request #23694 from Wilfred/fix/sysroot-project-workspace-…
ChayimFriedman2 Nov 21, 2026
1a5a2d8
Merge pull request #23697 from ada4a/push-nlkwmoxmzznk
ChayimFriedman2 Nov 21, 2026
e0f9933
minor: add test for auto import carrying a cfg attr from a macro
shulaoda Nov 21, 2026
fe17b8c
Merge pull request #23704 from shulaoda/11-22-minor_add_test_for_auto…
ChayimFriedman2 Nov 21, 2026
eddfd50
internal: update generated lints and target features
workflows-rust-analyzer[bot] Nov 21, 2026
67d30f4
Merge pull request #23705 from rust-lang/ci/gen-sync
lnicola Nov 22, 2026
a6a7951
Pass both `attr_tools` and `lint_tools` into the attribute parser
JonathanBrouwer Oct 25, 2026
eb9dba4
Move lint validation from `Levels::add` to attribute parsing
JonathanBrouwer Nov 4, 2026
b3908c3
Remove span of `tool`
JonathanBrouwer Nov 1, 2026
9ddf128
Review
JonathanBrouwer Oct 30, 2026
42a2311
Move `LintName` to `rustc_lint_defs`
JonathanBrouwer Nov 1, 2026
09d7afc
Reduce code duplication in substs_from_args_and_bindings
nicolas-guichard Jun 4, 2026
dafb375
Drop references to codebuild
Mark-Simulacrum Nov 22, 2026
6600391
Merge pull request #23707 from nicolas-guichard/push-wxqvntuvmzyp
ShoyuVanilla Nov 23, 2026
fdccf0a
Suppressed a follow up unused lint warning
vsriramv Nov 23, 2026
5246b70
Rollup merge of #164918 - JonathanBrouwer:lint-id, r=mejrs
JonathanBrouwer Nov 23, 2026
84fde85
Rollup merge of #166381 - lnicola:sync-from-ra, r=lnicola
JonathanBrouwer Nov 23, 2026
859b517
Rollup merge of #166191 - bjorn3:musl_static_pie, r=petrochenkov
JonathanBrouwer Nov 23, 2026
095c490
Rollup merge of #166250 - vsriramv:improving_error_output, r=Jonathan…
JonathanBrouwer Nov 23, 2026
12dab99
Rollup merge of #166365 - Mark-Simulacrum:remove-codebuild, r=Kobzol
JonathanBrouwer Nov 23, 2026
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
1 change: 1 addition & 0 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
tcx.sess,
tcx.features(),
tcx.registered_attr_tools(()),
tcx.registered_lint_tools(()),
ShouldEmit::ErrorsAndLints { recovery: Recovery::Allowed },
),
}
Expand Down
10 changes: 7 additions & 3 deletions compiler/rustc_attr_ir/src/lint.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc_lint_defs::LintName;
use rustc_macros::{Decodable, Encodable, PrintAttribute, StableHash};
use rustc_span::{Span, Symbol, sym};
use rustc_structures::LintName;

use crate::{HashIgnoredAttrId, PrintAttribute};

Expand Down Expand Up @@ -45,7 +45,12 @@ impl LintCheckKind {
/// ```
#[derive(Clone, Debug, StableHash, Encodable, Decodable, PrintAttribute)]
pub struct LintCheck {
pub lint_name: LintName,
/// The full normalized lint name of an existing lint, including the tool name.
/// This may not be what the user wrote down, in case of renamed lints the new lint name is here.
/// The above implies that `LintStore::find_lints` is guaranteed to find this lint using this symbol.
///
/// For example, `single_use_lifetime` is changed to `single_use_lifetimes`.
pub lint_name_normalized: LintName,
pub kind: LintCheckKind,
pub reason: Option<Symbol>,
/// Needed by `LintExpectationId` to track fulfilled expectations
Expand All @@ -61,5 +66,4 @@ pub struct LintCheck {
/// #[deny(foo::bar::baz)]
/// ^^^^^^^^^^^^^
pub lint_span: Span,
pub tool_span: Option<Span>,
}
6 changes: 2 additions & 4 deletions compiler/rustc_attr_ir/src/pretty_printing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ use rustc_ast::token::{CommentKind, DocFragmentKind};
use rustc_ast::{AttrId, AttrStyle, IntTy, UintTy};
use rustc_ast_pretty::pp::Printer;
use rustc_data_structures::fx::FxIndexMap;
use rustc_lint_defs::{Reflectiveness, ToolOptions};
use rustc_lint_defs::{LintName, Reflectiveness, ToolOptions};
use rustc_span::def_id::DefId;
use rustc_span::hygiene::Transparency;
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol};
use rustc_structures::{
CollapseMacroDebuginfo, CrateType, Limit, LintName, NativeLibKind, SanitizerSet,
};
use rustc_structures::{CollapseMacroDebuginfo, CrateType, Limit, NativeLibKind, SanitizerSet};
use thin_vec::ThinVec;

use crate::HashIgnoredAttrId;
Expand Down
207 changes: 183 additions & 24 deletions compiler/rustc_attr_parsing/src/attributes/lint.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
use rustc_ast::join_path_syms;
use rustc_attr_ir::AttributeKind;
use rustc_attr_ir::lint::{LintCheck, LintCheckKind};
use rustc_attr_ir::target::{AssocCtxt, MethodKind, Target};
use rustc_lint_defs::builtin::UNUSED_ATTRIBUTES;
use rustc_span::sym;
use rustc_structures::LintName;
use rustc_lint_defs::builtin::{RENAMED_AND_REMOVED_LINTS, UNKNOWN_LINTS, UNUSED_ATTRIBUTES};
use rustc_lint_defs::{CheckLintNameResult, LintId, LintName};
use rustc_span::{Span, Symbol, sym};
use thin_vec::ThinVec;

use crate::attributes::{AcceptMapping, AttributeParser, AttributeStability};
use crate::context::{AcceptContext, ExpectStringLiteral, FinalizeContext};
use crate::diagnostics::{MalformedLintAttributeInput, MalformedLintAttributeInputHelp};
use crate::diagnostics::{
DeprecatedLintName, MalformedLintAttributeInput, MalformedLintAttributeInputHelp, RemovedLint,
RenamedLint, RenamedLintSuggestion, UnknownLint, UnknownLintSuggestion,
UnknownToolInScopedLint,
};
use crate::parser::{ArgParser, MetaItemOrLitParser};
use crate::target_checking::AllowedTargets;
use crate::target_checking::Policy::{Allow, Warn};
Expand All @@ -28,6 +33,7 @@ impl LintParser {
fn parse(&mut self, kind: LintCheckKind, cx: &mut AcceptContext<'_, '_>, args: &ArgParser) {
let attr_span = cx.attr_span;
let attr_id = cx.attr_id.expect("no `AttrId` for lint attribute");
let mut has_invalid_reason_key = false;

if let Some(list) = cx.expect_list(args, cx.attr_span) {
let mut parsers = list.sub_parsers();
Expand All @@ -37,16 +43,16 @@ impl LintParser {
let p = parsers.last()?.meta_item()?;
let nv = p.args().as_name_value()?;
if !p.path().word_is(sym::reason) {
// FIXME: We should recommend `reason` here
has_invalid_reason_key = true;
cx.emit_err(MalformedLintAttributeInput {
span: p.span(),
help: MalformedLintAttributeInputHelp::Other { kind: kind.sym() },
help: MalformedLintAttributeInputHelp::Reason {
reason_span: p.path().span(),
},
kind: kind.sym(),
});
} else {
parsers = &parsers[..(parsers.len() - 1)];
}

parsers = &parsers[..(parsers.len() - 1)];
let reason = nv.expect_string_literal(cx)?;
reason
};
Expand All @@ -55,21 +61,47 @@ impl LintParser {
match item {
MetaItemOrLitParser::MetaItemParser(p) => {
match p.args() {
ArgParser::NoArgs => self.lints.push(LintCheck {
lint_name: LintName::new(
p.path().0.segments.iter().map(|s| s.ident.name),
),
kind,
attr_id,
reason,
attr_span,
lint_span: p.span(),
tool_span: if let [tool, _, ..] = &*p.path().0.segments {
Some(tool.span())
ArgParser::NoArgs => {
let (tool, lint_name) = match &*p.path().0.segments {
[] => unreachable!(),
[lint_name] => (None, lint_name.ident.name),
[tool, lint_name] => (Some(tool.ident), lint_name.ident.name),
// Not reachable for any builtin lints,
// but reachable using `register_tool`.
[tool, multi_segment_lint_name @ ..] => (
Some(tool.ident),
Symbol::intern(&join_path_syms(
multi_segment_lint_name
.iter()
.map(|seg| seg.ident.name),
)),
),
};
let lint_name =
LintName { tool: tool.map(|tool| tool.name), name: lint_name };

let lint_name_normalized = if let Some((_lint_ids, new_lint_name)) =
LintParser::check_lint_name(
lint_name,
tool.map(|tool| tool.span),
p.span(),
cx,
) {
new_lint_name
} else {
None
},
}),
// Discard lint attributes with unknown lints in them
continue;
};

self.lints.push(LintCheck {
lint_name_normalized,
lint_span: p.span(),
kind,
attr_id,
reason,
attr_span,
})
}
// We've found a `reason = "reason"` but we're not the last element.
ArgParser::NameValue(nv) if p.path().word_is(sym::reason) => {
cx.emit_err(diagnostics::MalformedAttribute {
Expand Down Expand Up @@ -110,7 +142,7 @@ impl LintParser {

// FIXME(164898) Lint attributes are unique because they're parsed twice with `ShouldEmit::ErrorsAndLints`
// To avoid emitting the lint twice, we check `cx.parse_filter`, which will be `Some` during AST linting
if parsers.is_empty() && cx.parse_filter.is_none() {
if parsers.is_empty() && cx.parse_filter.is_none() && !has_invalid_reason_key {
cx.emit_lint(
UNUSED_ATTRIBUTES,
diagnostics::Unused {
Expand All @@ -126,6 +158,133 @@ impl LintParser {
}
}
}

fn check_lint_name<'sess>(
lint_name: LintName,
tool_span: Option<Span>,
lint_span: Span,
cx: &mut AcceptContext<'_, 'sess>,
) -> Option<(&'sess [LintId], LintName)> {
let lint_result = cx
.sess
.lint_store
.as_ref()
.unwrap()
.check_attribute_lint_name(lint_name, cx.lint_tools.unwrap());

// FIXME(164898) Lint attributes are parsed twice, once on the AST and once on the HIR
// Both times emit diagnostics, for historic reasons
// We only want to emit these lints once, on the HIR.
// On the AST the parse filter will be `Some` (since we're only parsing lint attributes then)
// #164898 will fix this, after that PR this check can be removed
let should_lint = cx.parse_filter.is_none();

let (ids, name) = match lint_result {
CheckLintNameResult::Ok(ids) => (ids, lint_name),

CheckLintNameResult::Tool(ids, new_lint_name) => {
let name = match new_lint_name {
None => lint_name,
Some(replacement) => {
if should_lint {
cx.emit_lint(
RENAMED_AND_REMOVED_LINTS,
DeprecatedLintName {
lint_name,
suggestion: lint_span,
replacement,
},
lint_span,
);
}
replacement
}
};
(ids, name)
}

CheckLintNameResult::MissingTool => {
// If `MissingTool` is returned, then either the lint does not
// exist in the tool or the code was not compiled with the tool and
// therefore the lint was never added to the `LintStore`. To detect
// this is the responsibility of the lint tool.
return None;
}

CheckLintNameResult::NoTool(tool_name) => {
if should_lint {
cx.emit_err(UnknownToolInScopedLint {
span: Some(tool_span.unwrap()),
tool_name,
lint_name,
is_nightly_build: cx.sess.is_nightly_build(),
});
}
return None;
}

CheckLintNameResult::Renamed(replacement) => {
if should_lint {
let suggestion =
RenamedLintSuggestion::WithSpan { suggestion: lint_span, replacement };
cx.emit_lint(
RENAMED_AND_REMOVED_LINTS,
RenamedLint { name: lint_name, replacement, suggestion },
lint_span,
);
}

// If this lint was renamed, apply the new lint instead of ignoring the
// attribute. Ignore any errors or warnings that happen because the new
// name is inaccurate.
let replace_check = cx
.sess
.lint_store
.as_ref()
.unwrap()
.check_attribute_lint_name(replacement, cx.lint_tools.unwrap());
let (CheckLintNameResult::Ok(ids) | CheckLintNameResult::Tool(ids, _)) =
replace_check
else {
panic!(
"renamed lint does not exist: {lint_name} => {replacement}\n{replace_check:?}"
);
};

(ids, replacement)
}

CheckLintNameResult::Removed(reason) => {
if should_lint {
cx.emit_lint(
RENAMED_AND_REMOVED_LINTS,
RemovedLint { name: lint_name, reason },
lint_span,
);
}
return None;
}

CheckLintNameResult::NoLint(suggestion) => {
if should_lint {
let suggestion = suggestion.map(|(replacement, from_rustc)| {
UnknownLintSuggestion::WithSpan {
suggestion: lint_span,
replacement,
from_rustc,
}
});
cx.emit_lint(
UNKNOWN_LINTS,
UnknownLint { name: lint_name, suggestion },
lint_span,
);
}
return None;
}
};
Some((ids, name))
}
}

impl AttributeParser for LintParser {
Expand Down
Loading
Loading