Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7cd081e
make the safety documentation consistent in Ptr module
yilin0518 Oct 13, 2026
5fbbf47
std: Use getexecpath() for current_exe() on OpenBSD
brad0 Oct 15, 2026
09026e0
avoid building a region map when erasing bound regions
TaKO8Ki Oct 29, 2026
f7755c8
Parallelize AST -> HIR lowering
aerooneqq Oct 29, 2026
5aabd6e
unstable-book: update default-visibility.md to link to tracking issue
DanielEScherzer Nov 1, 2026
380fd0d
Reuse CanonicalVarKinds if no new variables were added
Randl Nov 2, 2026
bec2190
inline and cold attributes on async fn and async closures affect the …
xacrimon Sep 26, 2026
1c517b2
Don't keep #[rustc_force_inline] on async/gen fn constructors
xacrimon Nov 2, 2026
765b3ac
ref: lookup source info in PackedRefChecker only when it's needed
panstromek Nov 2, 2026
2caedab
Adapt async fn inline attrs to #[inline(always)] + #[target_feature] …
xacrimon Nov 2, 2026
edf718d
ref: avoid unnecessary MIR traversals in CheckPackedRef
panstromek Nov 2, 2026
9bf6dcf
Add `let_underscore_drop_guard` lint.
theemathas Oct 16, 2026
9b1ceff
Reenable the cg_gcc tests that were disabled by accident
antoyo Nov 2, 2026
86fd101
rename sizedness_fast_path to implicit_fast_path
jdonszelmann Nov 2, 2026
1b8ce17
refactor implicit bounds addition
jdonszelmann Nov 2, 2026
7eb4e44
Implement AIX TLS destructor guard in std and update dynamic-loading-…
xingxue-ibm Oct 30, 2026
f0767bb
add is_implicit_trait to tcx
jdonszelmann Nov 2, 2026
3ad3b9a
Add codegen test for unused match arms removed after inlining
zakrad Nov 2, 2026
dbbdb56
make the `no_implicit_prelude` not suppress tool attributes
mejrs Nov 2, 2026
79520af
Avoid oscillating line wrapping due to symbol indices
aytey Sep 10, 2026
a72068e
Fix rigidity assertion ICE
lsunsi Nov 3, 2026
dedfa67
Make `ExpectedLint` more general
JonathanBrouwer Oct 26, 2026
58c0988
Use `ExpectedLint` in more places
JonathanBrouwer Oct 27, 2026
cdc3205
Make diagnostic title consistent with other attributes
JonathanBrouwer Nov 3, 2026
760fc7b
Insert probing adjustments before args check adjustments
aerooneqq Nov 3, 2026
86f5fdb
Implement lint helper namespace
mejrs Oct 1, 2026
6c51a7c
port over `rustc_never_returns_null_ptr` to lint helper namespace
mejrs Oct 1, 2026
a6443cb
Port over `rustc_should_not_be_called_on_const_items` to lint helper …
mejrs Oct 1, 2026
dc85ea8
Remove duplicate symbol
mejrs Oct 28, 2026
ce0826e
fix formatting
mejrs Nov 3, 2026
9f00412
Rework parallel reproducibility tests
aerooneqq Nov 3, 2026
b91648c
Rollup merge of #149245 - xacrimon:acrimon/async-fn-inline-attr, r=sa…
JonathanBrouwer Nov 3, 2026
4b04527
Rollup merge of #163495 - aerooneqq:parallel-ast-hir-lowering, r=petr…
JonathanBrouwer Nov 3, 2026
d53f054
Rollup merge of #164304 - Randl:perf-reuse, r=ShoyuVanilla
JonathanBrouwer Nov 3, 2026
907e6f3
Rollup merge of #165109 - TaKO8Ki:avoid-erased-region-map, r=lcnr
JonathanBrouwer Nov 3, 2026
3483cfd
Rollup merge of #163393 - brad0:std_src_sys_paths_unix, r=JohnTitor
JonathanBrouwer Nov 3, 2026
800a239
Rollup merge of #163625 - mejrs:lint_helper_namespace-, r=estebank
JonathanBrouwer Nov 3, 2026
9315e80
Rollup merge of #164414 - theemathas:let_underscore_drop_guard, r=pet…
JonathanBrouwer Nov 3, 2026
41aedcc
Rollup merge of #165342 - panstromek:check-packed-ref-cln, r=JohnTitor
JonathanBrouwer Nov 3, 2026
6a3378c
Rollup merge of #165351 - aerooneqq:delegation-broken-mir, r=petroche…
JonathanBrouwer Nov 3, 2026
df16c7a
Rollup merge of #165358 - antoyo:fix/reenable-cg_gcc-tests, r=Guillau…
JonathanBrouwer Nov 3, 2026
7db1a17
Rollup merge of #165377 - mejrs:no_implicit_prelude_tool_attr, r=petr…
JonathanBrouwer Nov 3, 2026
11dee93
Rollup merge of #165397 - zakrad:codegen-test-74183, r=petrochenkov
JonathanBrouwer Nov 3, 2026
6181d32
Rollup merge of #165398 - aerooneqq:parallel-repr-tests-unification, …
JonathanBrouwer Nov 3, 2026
73389e5
Rollup merge of #162608 - aytey:unpretty-hygiene-test-churn, r=fmease
JonathanBrouwer Nov 3, 2026
c271a91
Rollup merge of #164241 - yilin0518:fix_ptr_unsafe, r=JohnTitor
JonathanBrouwer Nov 3, 2026
c1fe0c0
Rollup merge of #165029 - JonathanBrouwer:expected-lint, r=fmease
JonathanBrouwer Nov 3, 2026
4f2526b
Rollup merge of #165203 - xingxue-ibm:aix-disable-test-dynamic-loadin…
JonathanBrouwer Nov 3, 2026
b0877fd
Rollup merge of #165230 - lsunsi:issue158773, r=adwinwhite
JonathanBrouwer Nov 3, 2026
946f22a
Rollup merge of #165293 - DanielEScherzer:default-visibility-link, r=…
JonathanBrouwer Nov 3, 2026
3b78a47
Rollup merge of #165374 - jdonszelmann:move-trait-splitouts, r=ShoyuV…
JonathanBrouwer Nov 3, 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
16 changes: 10 additions & 6 deletions compiler/rustc_attr_ir/src/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -986,9 +986,19 @@ pub enum AttributeKind {
/// Represents `#[linkage]`.
Linkage(Linkage, Span),

/// Represents `#[lint::as_ptr]` (used by the `dangling_pointers_from_temporaries` lint).
LintAsPtr,

/// Represents `#[allow]`, `#[warn]`, `#[deny]`, `#[forbid]`, and `#[expect]`.
LintCheck(ThinVec<LintCheck>),

/// Represents `#[lint::never_returns_null_ptr]` (used by the `useless_ptr_null_checks` lint).
LintNeverReturnsNullPtr,

/// Represents `#[lint::should_not_be_called_on_const_items]` (used by the
/// `const_item_interior_mutations` lint).
LintShouldNotBeCalledOnConstItems,

/// Represents `#[loop_match]`.
LoopMatch(Span),

Expand Down Expand Up @@ -1199,9 +1209,6 @@ pub enum AttributeKind {
/// Represents `#[rustc_allow_lifetime_dependent_specialization]`.
RustcAllowLifetimeDependentSpecialization,

/// Represents `#[rustc_as_ptr]` (used by the `dangling_pointers_from_temporaries` lint).
RustcAsPtr,

/// Represents `#[rustc_assert_variance]`.
RustcAssertVariance {
span: Span,
Expand Down Expand Up @@ -1396,9 +1403,6 @@ pub enum AttributeKind {
/// Represents `#[rustc_must_match_exhaustively]`
RustcMustMatchExhaustively(Span),

/// Represents `#[rustc_never_returns_null_ptr]`
RustcNeverReturnsNullPtr,

/// Represents `#[rustc_no_implicit_autorefs]`
RustcNoImplicitAutorefs,

Expand Down
10 changes: 6 additions & 4 deletions compiler/rustc_attr_ir/src/encode_cross_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ impl AttributeKind {
LinkOrdinal { .. } => No,
LinkSection { .. } => Yes, // Needed for rustdoc
Linkage(..) => No,
LintAsPtr => Yes,
LintCheck(..) => No,
LintNeverReturnsNullPtr => Yes,
LintShouldNotBeCalledOnConstItems => Yes,
LoopMatch(..) => No,
MacroEscape => No,
MacroExport { .. } => Yes,
Expand Down Expand Up @@ -109,7 +112,6 @@ impl AttributeKind {
RustcAllowConstFnUnstable(..) => No,
RustcAllowIncoherentImpl(..) => No,
RustcAllowLifetimeDependentSpecialization => No,
RustcAsPtr => Yes,
RustcAssertVariance { .. } => No,
RustcAutodiff(..) => Yes,
RustcBodyStability { .. } => No,
Expand Down Expand Up @@ -167,7 +169,6 @@ impl AttributeKind {
RustcMir(..) => Yes,
RustcMustImplementOneOf { .. } => No,
RustcMustMatchExhaustively(..) => Yes,
RustcNeverReturnsNullPtr => Yes,
RustcNoImplicitAutorefs => Yes,
RustcNoImplicitBounds => No,
RustcNoMirInline => Yes,
Expand Down Expand Up @@ -276,7 +277,10 @@ impl AttributeKind {
| crate::Linkage::WeakAny
| crate::Linkage::WeakODR => true,
},
LintAsPtr => false,
LintCheck(_) => false,
LintNeverReturnsNullPtr => false,
LintShouldNotBeCalledOnConstItems => false,
LoopMatch(..) => false,
MacroEscape => false,
MacroExport { .. } => false,
Expand Down Expand Up @@ -327,7 +331,6 @@ impl AttributeKind {
RustcAllowConstFnUnstable(..) => false,
RustcAllowIncoherentImpl(..) => false,
RustcAllowLifetimeDependentSpecialization => false,
RustcAsPtr => false,
RustcAssertVariance { .. } => false,
RustcAutodiff(..) => false,
RustcBodyStability { .. } => false,
Expand Down Expand Up @@ -385,7 +388,6 @@ impl AttributeKind {
RustcMir(..) => false,
RustcMustImplementOneOf { .. } => false,
RustcMustMatchExhaustively(..) => false,
RustcNeverReturnsNullPtr => false,
RustcNoImplicitAutorefs => false,
RustcNoImplicitBounds => false,
RustcNoMirInline => false,
Expand Down
23 changes: 14 additions & 9 deletions compiler/rustc_attr_parsing/src/attributes/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use thin_vec::ThinVec;

use crate::attributes::{AcceptMapping, AttributeParser, AttributeStability};
use crate::context::{AcceptContext, ExpectStringLiteral, FinalizeContext};
use crate::diagnostics::{MalformedLintAttributeInput, MalformedLintAttributeInputHelp};
use crate::parser::{ArgParser, MetaItemOrLitParser};
use crate::target_checking::AllowedTargets;
use crate::target_checking::Policy::{Allow, Warn};
Expand Down Expand Up @@ -36,9 +37,11 @@ impl LintParser {
let p = parsers.last()?.meta_item()?;
let nv = p.args().as_name_value()?;
if !p.path().word_is(sym::reason) {
cx.emit_err(diagnostics::MalformedAttribute {
// FIXME: We should recommend `reason` here
cx.emit_err(MalformedLintAttributeInput {
span: p.span(),
kind: diagnostics::MalformedAttributeKind::BadAttributeArgument(p.span()),
help: MalformedLintAttributeInputHelp::Other { kind: kind.sym() },
kind: kind.sym(),
});
} else {
parsers = &parsers[..(parsers.len() - 1)];
Expand Down Expand Up @@ -78,26 +81,28 @@ impl LintParser {
nv.expect_string_literal(cx);
}
ArgParser::NameValue(_) | ArgParser::List(_) => {
cx.emit_err(diagnostics::MalformedAttribute {
cx.emit_err(MalformedLintAttributeInput {
span: p.span(),
kind: diagnostics::MalformedAttributeKind::BadAttributeArgument(
item.span(),
),
help: MalformedLintAttributeInputHelp::Other {
kind: kind.sym(),
},
kind: kind.sym(),
});
}
}
}
MetaItemOrLitParser::Lit(lit) => {
cx.emit_err(diagnostics::BadAttributeLit {
cx.emit_err(MalformedLintAttributeInput {
span: item.span(),
help: if lit.kind.is_str() {
diagnostics::BadAttributeLitHelp::StrLit {
MalformedLintAttributeInputHelp::StrLit {
sym: lit.symbol,
kind: kind.sym(),
}
} else {
diagnostics::BadAttributeLitHelp::Other { kind: kind.sym() }
MalformedLintAttributeInputHelp::Other { kind: kind.sym() }
},
kind: kind.sym(),
});
}
}
Expand Down
32 changes: 24 additions & 8 deletions compiler/rustc_attr_parsing/src/attributes/lint_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use rustc_feature::AttributeStability;
use super::prelude::*;
use crate::diagnostics::RustcPubTransparent;

pub(crate) struct RustcAsPtrParser;
impl NoArgsAttributeParser for RustcAsPtrParser {
const PATH: &[Symbol] = &[sym::rustc_as_ptr];
pub(crate) struct LintAsPtrParser;
impl NoArgsAttributeParser for LintAsPtrParser {
const PATH: &[Symbol] = &[sym::lint, sym::as_ptr];
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Expand All @@ -15,7 +15,23 @@ impl NoArgsAttributeParser for RustcAsPtrParser {
Allow(Target::Method(MethodKind::TraitImpl)),
]);
const STABILITY: AttributeStability = unstable!(rustc_attrs);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcAsPtr;
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::LintAsPtr;
}

pub(crate) struct LintNeverReturnsNullPtrParser;

impl NoArgsAttributeParser for LintNeverReturnsNullPtrParser {
const PATH: &[Symbol] = &[sym::lint, sym::never_returns_null_ptr];
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: false })),
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Method(MethodKind::TraitImpl)),
]);
const STABILITY: AttributeStability = unstable!(rustc_attrs);

const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::LintNeverReturnsNullPtr;
}

pub(crate) struct RustcPubTransparentParser;
Expand Down Expand Up @@ -53,15 +69,15 @@ impl NoArgsAttributeParser for RustcPassByValueParser {
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcPassByValue;
}

pub(crate) struct RustcShouldNotBeCalledOnConstItemsParser;
impl NoArgsAttributeParser for RustcShouldNotBeCalledOnConstItemsParser {
const PATH: &[Symbol] = &[sym::rustc_should_not_be_called_on_const_items];
pub(crate) struct LintShouldNotBeCalledOnConstItemsParser;
impl NoArgsAttributeParser for LintShouldNotBeCalledOnConstItemsParser {
const PATH: &[Symbol] = &[sym::lint, sym::should_not_be_called_on_const_items];
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::TraitImpl)),
]);
const STABILITY: AttributeStability = unstable!(rustc_attrs);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcShouldNotBeCalledOnConstItems;
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::LintShouldNotBeCalledOnConstItems;
}

pub(crate) struct AutomaticallyDerivedParser;
Expand Down
16 changes: 0 additions & 16 deletions compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,6 @@ impl SingleAttributeParser for RustcMustImplementOneOfParser {
}
}

pub(crate) struct RustcNeverReturnsNullPtrParser;

impl NoArgsAttributeParser for RustcNeverReturnsNullPtrParser {
const PATH: &[Symbol] = &[sym::rustc_never_returns_null_ptr];
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: false })),
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Method(MethodKind::TraitImpl)),
]);
const STABILITY: AttributeStability = unstable!(rustc_attrs);

const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcNeverReturnsNullPtr;
}

pub(crate) struct RustcPanicsWhenZeroParser;

impl NoArgsAttributeParser for RustcPanicsWhenZeroParser {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ attribute_parsers!(
Single<WithoutArgs<FfiConstParser>>,
Single<WithoutArgs<FfiPureParser>>,
Single<WithoutArgs<FundamentalParser>>,
Single<WithoutArgs<LintAsPtrParser>>,
Single<WithoutArgs<LintNeverReturnsNullPtrParser>>,
Single<WithoutArgs<LintShouldNotBeCalledOnConstItemsParser>>,
Single<WithoutArgs<LoopMatchParser>>,
Single<WithoutArgs<MacroEscapeParser>>,
Single<WithoutArgs<MarkerParser>>,
Expand All @@ -299,7 +302,6 @@ attribute_parsers!(
Single<WithoutArgs<RustcAllocatorZeroedParser>>,
Single<WithoutArgs<RustcAllowIncoherentImplParser>>,
Single<WithoutArgs<RustcAllowLifetimeDependentSpecializationParser>>,
Single<WithoutArgs<RustcAsPtrParser>>,
Single<WithoutArgs<RustcCanonicalSymbolParser>>,
Single<WithoutArgs<RustcCaptureAnalysisParser>>,
Single<WithoutArgs<RustcCoherenceIsCoreParser>>,
Expand Down Expand Up @@ -335,7 +337,6 @@ attribute_parsers!(
Single<WithoutArgs<RustcLintQueryInstabilityParser>>,
Single<WithoutArgs<RustcLintUntrackedQueryInformationParser>>,
Single<WithoutArgs<RustcMainParser>>,
Single<WithoutArgs<RustcNeverReturnsNullPtrParser>>,
Single<WithoutArgs<RustcNoImplicitAutorefsParser>>,
Single<WithoutArgs<RustcNoImplicitBoundsParser>>,
Single<WithoutArgs<RustcNoMirInlineParser>>,
Expand All @@ -353,7 +354,6 @@ attribute_parsers!(
Single<WithoutArgs<RustcPubTransparentParser>>,
Single<WithoutArgs<RustcReallocatorParser>>,
Single<WithoutArgs<RustcRegionsParser>>,
Single<WithoutArgs<RustcShouldNotBeCalledOnConstItemsParser>>,
Single<WithoutArgs<RustcSpecializationTraitParser>>,
Single<WithoutArgs<RustcStdInternalSymbolParser>>,
Single<WithoutArgs<RustcStrictCoherenceParser>>,
Expand Down
19 changes: 13 additions & 6 deletions compiler/rustc_attr_parsing/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2196,24 +2196,23 @@ pub(crate) struct MalformedAttribute {

#[derive(Subdiagnostic)]
pub(crate) enum MalformedAttributeKind {
#[label("bad attribute argument")]
BadAttributeArgument(#[primary_span] Span),
#[label("reason in lint attribute must come last")]
ReasonMustComeLast(#[primary_span] Span),
}

#[derive(Diagnostic)]
#[diag("expected a lint, found literal")]
pub(crate) struct BadAttributeLit {
#[diag("malformed `{$kind}` attribute input")]
pub(crate) struct MalformedLintAttributeInput {
#[primary_span]
#[label("not the name of a lint")]
pub span: Span,
pub kind: Symbol,
#[subdiagnostic]
pub help: BadAttributeLitHelp,
pub help: MalformedLintAttributeInputHelp,
}

#[derive(Subdiagnostic)]
pub(crate) enum BadAttributeLitHelp {
pub(crate) enum MalformedLintAttributeInputHelp {
#[help("try using `#[{$kind}({$sym})]`")]
StrLit { sym: Symbol, kind: Symbol },
#[help("for example, write `#[{$kind}(dead_code)]` for `dead_code`")]
Expand Down Expand Up @@ -2248,3 +2247,11 @@ pub(crate) struct DocKeywordAttributeNotAnonConst {
pub span: Span,
pub attr_name: Symbol,
}

#[derive(Diagnostic)]
#[diag("the `lint::{$unknown}` attribute is not recognized")]
pub(crate) struct UnknownLintHelper {
#[primary_span]
pub span: Span,
pub unknown: Symbol,
}
19 changes: 18 additions & 1 deletion compiler/rustc_attr_parsing/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::diagnostics::ParsedDescription;
use crate::generated::GeneratedAttrState;
use crate::parser::{AllowExprMetavar, ArgParser, PathParser, RefPathParser};
use crate::synthetic::SyntheticAttrState;
use crate::{AttributeTemplate, ShouldEmit};
use crate::{AttributeTemplate, ShouldEmit, diagnostics};

pub struct EmitAttribute(
pub Box<
Expand Down Expand Up @@ -446,6 +446,23 @@ impl<'sess> AttributeParser<'sess> {
}
} else if let [sym::diagnostic, _unknown, ..] = &*parts {
self.unknown_diagnostic_attr(&n.item.path.segments[1], &mut emit_lint);
} else if let [sym::lint, unknown, ..] = &*parts {
// Avoid cascading errors. If the `lint` tool has not been registered,
// we could be here in the `#[lint::attribute_macro] not found` case,
// which recovers with a `NonMacroAttr` res.
if let Some(tools) = self.attr_tools
&& tools.iter().any(|i| i.name == sym::lint)
{
self.emit_err(diagnostics::UnknownLintHelper {
span: n.item.span,
unknown: *unknown,
});
} else {
self.dcx().span_delayed_bug(
n.item.span,
"encountered `lint` tool attribute but error not reported",
);
}
} else {
let attr = AttrItem {
path: attr_path.clone(),
Expand Down
Loading
Loading