Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d0c53d4
view-types: don't pass view types by value in tests
scrabsha Nov 6, 2026
94add96
view-types: add `View` variant to `TyKind`
scrabsha Nov 6, 2026
8bb5d1d
outline `TyCtxt::new_adt`'s `DefKind` check
scrabsha Nov 6, 2026
292f9b1
view-types: lower view types from HIR types
scrabsha Nov 6, 2026
c74615e
view-types: remove FIXMEs reachable from the test suite
scrabsha Nov 6, 2026
6703460
Use an invariant lifetime brand for LLVM attributes
Zalathar Nov 12, 2026
b21e098
Update `sysinfo` version to `0.40.3`
GuillaumeGomez Nov 12, 2026
a804f3a
reflection: introduce reflect attribute as tool
Tess4552 Nov 11, 2026
8689b3e
reflection: reflect attributes from adts, fields, and variants
Tess4552 Nov 11, 2026
48ea8bc
compiletest: Add testing for lint machinery at runtime
jamie-osec Jun 10, 2026
9ac78f0
Document `aux-lint` in dev guide
jamie-osec Jun 10, 2026
99e44b1
move `rustc_pass_by_value` to `lint::pass_by_value`
mejrs Nov 12, 2026
698b870
move `rustc_no_implicit_autorefs` to `lint::no_implicit_autorefs`
mejrs Nov 12, 2026
5304d35
move `rustc_panics_when_zero` to `lint::panics_when_zero`
mejrs Nov 12, 2026
e06e6c6
move `rustc_must_match_exhaustively` to `lint::must_match_exhaustively`
mejrs Nov 12, 2026
65d368e
view-types: allow types that dereference to views to be receivers
scrabsha Nov 6, 2026
87f5568
view-types: add format tests
scrabsha Nov 11, 2026
af3705f
clippy: teach dereference lints about view types
scrabsha Nov 11, 2026
7080197
rustdoc: teach about view types
scrabsha Nov 11, 2026
6b054e7
Rollup merge of #157721 - clubby789:test-lint-machinery, r=Mark-Simul…
JonathanBrouwer Nov 12, 2026
c893f75
Rollup merge of #165565 - scrabsha:view-types/middle-lowering, r=oli-obk
JonathanBrouwer Nov 12, 2026
750f129
Rollup merge of #165810 - Tess4552:reflection-type-id-attributes, r=o…
JonathanBrouwer Nov 12, 2026
8708f63
Rollup merge of #165855 - GuillaumeGomez:update-sysinfo, r=jieyouxu
JonathanBrouwer Nov 12, 2026
4f4ae34
Rollup merge of #165861 - Zalathar:llattr, r=wesleywiser
JonathanBrouwer Nov 12, 2026
9ab9b80
Rollup merge of #165865 - mejrs:more_lint_attrs, r=oli-obk
JonathanBrouwer Nov 12, 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
12 changes: 10 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,13 @@ dependencies = [
"windows 0.61.3",
]

[[package]]
name = "compiletest-lint-driver"
version = "0.1.0"
dependencies = [
"libloading",
]

[[package]]
name = "console"
version = "0.16.3"
Expand Down Expand Up @@ -3905,6 +3912,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
"rustc_hir_pretty",
"rustc_index",
"rustc_infer",
"rustc_lint_defs",
Expand Down Expand Up @@ -5634,9 +5642,9 @@ dependencies = [

[[package]]
name = "sysinfo"
version = "0.39.2"
version = "0.40.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14311e7e9a03114cd4b65eedd54e8fed2945e17f08586ae97ef53bc0669f9581"
checksum = "a86bac2f7d06e6384984118ad727f5694110f0ec44d924d05c8fdec3d030bee6"
dependencies = [
"libc",
"objc2-core-foundation",
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ members = [
"src/tools/clippy/clippy_dev",
"src/tools/collect-license-metadata",
"src/tools/compiletest",
"src/tools/compiletest-lint-driver",
"src/tools/coverage-dump",
"src/tools/features-status-dump",
"src/tools/generate-copyright",
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_abi/src/layout/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ use crate::{
// Explicitly import `Float` to avoid ambiguity with `Primitive::Float`.

#[derive(Copy, Clone, PartialEq, Eq, Hash, StableHash)]
#[rustc_pass_by_value]
#[cfg_attr(bootstrap, rustc_pass_by_value)]
#[cfg_attr(not(bootstrap), lint::pass_by_value)]
pub struct Layout<'a>(pub Interned<'a, LayoutData<FieldIdx, VariantIdx>>);

impl<'a> fmt::Debug for Layout<'a> {
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// tidy-alphabetical-start
#![cfg_attr(feature = "nightly", allow(internal_features))]
#![cfg_attr(feature = "nightly", feature(register_tool))]
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
#![cfg_attr(feature = "nightly", feature(step_trait))]
#![cfg_attr(feature = "nightly", register_tool(lint))]
// tidy-alphabetical-end

/*! ABI handling for rustc
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#![feature(deref_patterns)]
#![feature(iter_order_by)]
#![feature(macro_metavar_expr)]
#![feature(register_tool)]
#![recursion_limit = "256"]
#![register_tool(lint)]
// tidy-alphabetical-end

pub mod util {
Expand Down
26 changes: 13 additions & 13 deletions compiler/rustc_attr_ir/src/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,22 @@ pub enum AttributeKind {
/// Represents `#[allow]`, `#[warn]`, `#[deny]`, `#[forbid]`, and `#[expect]`.
LintCheck(ThinVec<LintCheck>),

/// Represents `#[lint::must_match_exhaustively]` (used by the
/// `rustc::must_match_exhaustively` lint).
LintMustMatchExhaustively(Span),

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

/// Represents `#[lint::no_implicit_autorefs]` (used by the `dangerous_implicit_autorefs` lint).
LintNoImplicitAutorefs,

/// Represents `#[lint::panics_when_zero]` (used by the `unconditional_panic` lint).
LintPanicsWhenZero,

/// Represents `#[lint::pass_by_value)]` (used by the `rustc::disallowed_pass_by_ref` lint).
LintPassByValue,

/// Represents `#[lint::should_not_be_called_on_const_items]` (used by the
/// `const_item_interior_mutations` lint).
LintShouldNotBeCalledOnConstItems,
Expand Down Expand Up @@ -1394,13 +1407,6 @@ pub enum AttributeKind {
attr_span: Span,
fn_names: ThinVec<Ident>,
},

/// Represents `#[rustc_must_match_exhaustively]`
RustcMustMatchExhaustively(Span),

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

/// Represents `#[rustc_no_implicit_bounds]`
RustcNoImplicitBounds,

Expand Down Expand Up @@ -1432,15 +1438,9 @@ pub enum AttributeKind {
/// Represents `#[rustc_offload_kernel]`
RustcOffloadKernel,

/// Represents `#[rustc_panics_when_zero]` (used for linting).
RustcPanicsWhenZero,

/// Represents `#[rustc_paren_sugar]`.
RustcParenSugar,

/// Represents `#[rustc_pass_by_value]` (used by the `rustc_pass_by_value` lint).
RustcPassByValue,

/// Represents `#[rustc_pass_indirectly_in_non_rustic_abis]`
RustcPassIndirectlyInNonRusticAbis(Span),

Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_attr_ir/src/encode_cross_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ impl AttributeKind {
Linkage(..) => No,
LintAsPtr => Yes,
LintCheck(..) => No,
LintMustMatchExhaustively(..) => Yes,
LintNeverReturnsNullPtr => Yes,
LintNoImplicitAutorefs => Yes,
LintPanicsWhenZero => Yes,
LintPassByValue => Yes,
LintShouldNotBeCalledOnConstItems => Yes,
LoopMatch(..) => No,
MacroEscape => No,
Expand Down Expand Up @@ -168,8 +172,6 @@ impl AttributeKind {
RustcMain => No,
RustcMir(..) => Yes,
RustcMustImplementOneOf { .. } => No,
RustcMustMatchExhaustively(..) => Yes,
RustcNoImplicitAutorefs => Yes,
RustcNoImplicitBounds => No,
RustcNoMirInline => Yes,
RustcNoWritable => Yes,
Expand All @@ -179,9 +181,7 @@ impl AttributeKind {
RustcObjcClass { .. } => No,
RustcObjcSelector { .. } => No,
RustcOffloadKernel => Yes,
RustcPanicsWhenZero => Yes,
RustcParenSugar => No,
RustcPassByValue => Yes,
RustcPassIndirectlyInNonRusticAbis(..) => No,
RustcPreserveUbChecks => No,
RustcProcMacroDecls => No,
Expand Down Expand Up @@ -279,7 +279,11 @@ impl AttributeKind {
},
LintAsPtr => false,
LintCheck(_) => false,
LintMustMatchExhaustively(..) => false,
LintNeverReturnsNullPtr => false,
LintNoImplicitAutorefs => false,
LintPanicsWhenZero => false,
LintPassByValue => false,
LintShouldNotBeCalledOnConstItems => false,
LoopMatch(..) => false,
MacroEscape => false,
Expand Down Expand Up @@ -387,8 +391,6 @@ impl AttributeKind {
RustcMain => false,
RustcMir(..) => false,
RustcMustImplementOneOf { .. } => false,
RustcMustMatchExhaustively(..) => false,
RustcNoImplicitAutorefs => false,
RustcNoImplicitBounds => false,
RustcNoMirInline => false,
RustcNoWritable => false,
Expand All @@ -398,9 +400,7 @@ impl AttributeKind {
RustcObjcClass { .. } => false,
RustcObjcSelector { .. } => false,
RustcOffloadKernel => true,
RustcPanicsWhenZero => false,
RustcParenSugar => false,
RustcPassByValue => false,
RustcPassIndirectlyInNonRusticAbis(..) => false,
RustcPreserveUbChecks => false,
RustcProcMacroDecls => false,
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_attr_parsing/src/attributes/lint_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ impl NoArgsAttributeParser for RustcPubTransparentParser {
}
}

pub(crate) struct RustcPassByValueParser;
impl NoArgsAttributeParser for RustcPassByValueParser {
const PATH: &[Symbol] = &[sym::rustc_pass_by_value];
pub(crate) struct LintPassByValueParser;
impl NoArgsAttributeParser for LintPassByValueParser {
const PATH: &[Symbol] = &[sym::lint, sym::pass_by_value];
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Struct),
Allow(Target::Enum),
Allow(Target::TyAlias),
]);
const STABILITY: AttributeStability = unstable!(rustc_attrs);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcPassByValue;
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::LintPassByValue;
}

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

pub(crate) struct RustcPanicsWhenZeroParser;
pub(crate) struct LintPanicsWhenZeroParser;

impl NoArgsAttributeParser for RustcPanicsWhenZeroParser {
const PATH: &[Symbol] = &[sym::rustc_panics_when_zero];
impl NoArgsAttributeParser for LintPanicsWhenZeroParser {
const PATH: &[Symbol] = &[sym::lint, sym::panics_when_zero];
const ALLOWED_TARGETS: AllowedTargets<'_> =
AllowedTargets::AllowList(&[Allow(Target::ConstParam)]);
const STABILITY: AttributeStability = unstable!(rustc_attrs);

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

pub(crate) struct RustcNoImplicitAutorefsParser;
pub(crate) struct LintNoImplicitAutorefsParser;

impl NoArgsAttributeParser for RustcNoImplicitAutorefsParser {
const PATH: &[Symbol] = &[sym::rustc_no_implicit_autorefs];
impl NoArgsAttributeParser for LintNoImplicitAutorefsParser {
const PATH: &[Symbol] = &[sym::lint, sym::no_implicit_autorefs];
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Expand All @@ -113,7 +113,7 @@ impl NoArgsAttributeParser for RustcNoImplicitAutorefsParser {
]);
const STABILITY: AttributeStability = unstable!(rustc_attrs);

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

pub(crate) struct RustcLegacyConstGenericsParser;
Expand Down Expand Up @@ -1132,10 +1132,10 @@ impl NoArgsAttributeParser for RustcIntrinsicConstStableIndirectParser {
pub(crate) struct RustcExhaustiveParser;

impl NoArgsAttributeParser for RustcExhaustiveParser {
const PATH: &'static [Symbol] = &[sym::rustc_must_match_exhaustively];
const PATH: &'static [Symbol] = &[sym::lint, sym::must_match_exhaustively];
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[Allow(Target::Enum)]);
const STABILITY: AttributeStability = unstable!(rustc_attrs);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcMustMatchExhaustively;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::LintMustMatchExhaustively;
}

pub(crate) struct RustcCanonicalSymbolParser;
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 @@ -276,6 +276,9 @@ attribute_parsers!(
Single<WithoutArgs<FundamentalParser>>,
Single<WithoutArgs<LintAsPtrParser>>,
Single<WithoutArgs<LintNeverReturnsNullPtrParser>>,
Single<WithoutArgs<LintNoImplicitAutorefsParser>>,
Single<WithoutArgs<LintPanicsWhenZeroParser>>,
Single<WithoutArgs<LintPassByValueParser>>,
Single<WithoutArgs<LintShouldNotBeCalledOnConstItemsParser>>,
Single<WithoutArgs<LoopMatchParser>>,
Single<WithoutArgs<MacroEscapeParser>>,
Expand Down Expand Up @@ -337,17 +340,14 @@ attribute_parsers!(
Single<WithoutArgs<RustcLintQueryInstabilityParser>>,
Single<WithoutArgs<RustcLintUntrackedQueryInformationParser>>,
Single<WithoutArgs<RustcMainParser>>,
Single<WithoutArgs<RustcNoImplicitAutorefsParser>>,
Single<WithoutArgs<RustcNoImplicitBoundsParser>>,
Single<WithoutArgs<RustcNoMirInlineParser>>,
Single<WithoutArgs<RustcNoWritableParser>>,
Single<WithoutArgs<RustcNonConstTraitMethodParser>>,
Single<WithoutArgs<RustcNonnullOptimizationGuaranteedParser>>,
Single<WithoutArgs<RustcNounwindParser>>,
Single<WithoutArgs<RustcOffloadKernelParser>>,
Single<WithoutArgs<RustcPanicsWhenZeroParser>>,
Single<WithoutArgs<RustcParenSugarParser>>,
Single<WithoutArgs<RustcPassByValueParser>>,
Single<WithoutArgs<RustcPassIndirectlyInNonRusticAbisParser>>,
Single<WithoutArgs<RustcPreserveUbChecksParser>>,
Single<WithoutArgs<RustcProcMacroDeclsParser>>,
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
#![feature(file_buffered)]
#![feature(negative_impls)]
#![feature(option_into_flat_iter)]
#![feature(register_tool)]
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]
#![feature(try_blocks)]
#![register_tool(lint)]
// tidy-alphabetical-end

use std::borrow::Cow;
Expand Down Expand Up @@ -1948,6 +1950,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
| ty::Placeholder(_) => {
bug!("When Place is Deref it's type shouldn't be {place_ty:#?}")
}

// FIXME(scrabsha)
ty::View(..) => unimplemented!(),
},
ProjectionElem::Field(_, _) => match place_ty.ty.kind() {
ty::Adt(adt, _) => {
Expand Down Expand Up @@ -1990,6 +1995,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
| ty::Placeholder(_) => bug!(
"When Place contains ProjectionElem::Field it's type shouldn't be {place_ty:#?}"
),

// FIXME(scrabsha)
ty::View(..) => unimplemented!(),
},
ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } => {
match place_ty.ty.kind() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const CAPTURES_ATTRIBUTES: [(ArgAttribute, llvm::AttributeKind); 3] = [
(ArgAttribute::CapturesReadOnly, llvm::AttributeKind::CapturesReadOnly),
];

fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'ll Attribute; 8]> {
fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[Attribute<'ll>; 8]> {
let mut regular = this.regular;

let mut attrs = SmallVec::new();
Expand Down
Loading
Loading