Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
829c314
Check proj's parent when checking dyn compatibility
mu001999 Jan 27, 2026
e12acb9
Forbid manual `Unpin` impls for structurally pinned types
frank-king Nov 24, 2025
c7c3266
error on unsized AnonConsts
khyperia Feb 2, 2026
1c4940b
Remove an unneeded `HashStable` derive.
nnethercote Feb 2, 2026
3a5d7df
Add a useful comment on `rustc_codegen_ssa::NativeLib`.
nnethercote Feb 3, 2026
079913e
disable socket tests in Miri
RalfJung Feb 3, 2026
6b3d1e0
Update Cargo.lock
Kobzol Feb 3, 2026
cb9c43b
Show largest job duration changes in hours and minutes, rather than j…
Kobzol Feb 3, 2026
0418f9a
coverage: Add a test case for a previously-unknown span mismatch
Zalathar Feb 3, 2026
b668057
Port `rustc_mir` to attribute parser
jamie-osec Jan 30, 2026
4e4192a
Try to fix `rustdoc-gui/globals.goml` flakyness
GuillaumeGomez Feb 3, 2026
6b89f67
Rollup merge of #152034 - Kobzol:ci-analysis-time, r=marcoieni
JonathanBrouwer Feb 3, 2026
46f5839
Rollup merge of #152039 - Zalathar:context-mismatch, r=chenyukang
JonathanBrouwer Feb 3, 2026
d7e48e4
Rollup merge of #149263 - frank-king:feature/unpin-check, r=BoxyUwU
JonathanBrouwer Feb 3, 2026
1407149
Rollup merge of #151754 - mu001999-contrib:fix/151708, r=BoxyUwU
JonathanBrouwer Feb 3, 2026
b14916b
Rollup merge of #151848 - clubby789:rustc-mir-port, r=JonathanBrouwer
JonathanBrouwer Feb 3, 2026
5df3d24
Rollup merge of #151874 - khyperia:error-unsized-anonconst, r=BoxyUwU
JonathanBrouwer Feb 3, 2026
f77f1df
Rollup merge of #152019 - nnethercote:rm-unneeded-HashStable-derives,…
JonathanBrouwer Feb 3, 2026
2b14307
Rollup merge of #152029 - RalfJung:miri-socket-tests, r=Mark-Simulacrum
JonathanBrouwer Feb 3, 2026
a67facb
Rollup merge of #152050 - GuillaumeGomez:try-fixing-flakyness, r=Guil…
JonathanBrouwer Feb 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
2 changes: 1 addition & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4337,11 +4337,11 @@ dependencies = [
"polonius-engine",
"regex",
"rustc_abi",
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_graphviz",
"rustc_hir",
"rustc_index",
"rustc_macros",
"rustc_middle",
Expand Down
93 changes: 91 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::path::PathBuf;

use rustc_ast::{LitIntType, LitKind, MetaItemLit};
use rustc_hir::attrs::RustcLayoutType;
use rustc_hir::attrs::{BorrowckGraphvizFormatKind, RustcLayoutType, RustcMirKind};
use rustc_session::errors;

use super::prelude::*;
Expand Down Expand Up @@ -357,7 +359,6 @@ impl<S: Stage> CombineAttributeParser<S> for RustcLayoutParser {

const TEMPLATE: AttributeTemplate =
template!(List: &["abi", "align", "size", "homogenous_aggregate", "debug"]);

fn extend(
cx: &mut AcceptContext<'_, '_, S>,
args: &ArgParser,
Expand Down Expand Up @@ -397,6 +398,94 @@ impl<S: Stage> CombineAttributeParser<S> for RustcLayoutParser {
}
}

pub(crate) struct RustcMirParser;

impl<S: Stage> CombineAttributeParser<S> for RustcMirParser {
const PATH: &[rustc_span::Symbol] = &[sym::rustc_mir];

type Item = RustcMirKind;

const CONVERT: ConvertFn<Self::Item> = |items, _| AttributeKind::RustcMir(items);

const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::TraitImpl)),
Allow(Target::Method(MethodKind::Trait { body: false })),
Allow(Target::Method(MethodKind::Trait { body: true })),
]);

const TEMPLATE: AttributeTemplate = template!(List: &["arg1, arg2, ..."]);

fn extend(
cx: &mut AcceptContext<'_, '_, S>,
args: &ArgParser,
) -> impl IntoIterator<Item = Self::Item> {
let Some(list) = args.list() else {
cx.expected_list(cx.attr_span, args);
return ThinVec::new();
};

list.mixed()
.filter_map(|arg| arg.meta_item())
.filter_map(|mi| {
if let Some(ident) = mi.ident() {
match ident.name {
sym::rustc_peek_maybe_init => Some(RustcMirKind::PeekMaybeInit),
sym::rustc_peek_maybe_uninit => Some(RustcMirKind::PeekMaybeUninit),
sym::rustc_peek_liveness => Some(RustcMirKind::PeekLiveness),
sym::stop_after_dataflow => Some(RustcMirKind::StopAfterDataflow),
sym::borrowck_graphviz_postflow => {
let Some(nv) = mi.args().name_value() else {
cx.expected_name_value(
mi.span(),
Some(sym::borrowck_graphviz_postflow),
);
return None;
};
let Some(path) = nv.value_as_str() else {
cx.expected_string_literal(nv.value_span, None);
return None;
};
let path = PathBuf::from(path.to_string());
if path.file_name().is_some() {
Some(RustcMirKind::BorrowckGraphvizPostflow { path })
} else {
cx.expected_filename_literal(nv.value_span);
None
}
}
sym::borrowck_graphviz_format => {
let Some(nv) = mi.args().name_value() else {
cx.expected_name_value(
mi.span(),
Some(sym::borrowck_graphviz_format),
);
return None;
};
let Some(format) = nv.value_as_ident() else {
cx.expected_identifier(nv.value_span);
return None;
};
match format.name {
sym::two_phase => Some(RustcMirKind::BorrowckGraphvizFormat {
format: BorrowckGraphvizFormatKind::TwoPhase,
}),
_ => {
cx.expected_specific_argument(format.span, &[sym::two_phase]);
None
}
}
}
_ => None,
}
} else {
None
}
})
.collect()
}
}
pub(crate) struct RustcNonConstTraitMethodParser;

impl<S: Stage> NoArgsAttributeParser<S> for RustcNonConstTraitMethodParser {
Expand Down
8 changes: 7 additions & 1 deletion compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ use crate::attributes::rustc_internal::{
RustcLayoutScalarValidRangeEndParser, RustcLayoutScalarValidRangeStartParser,
RustcLegacyConstGenericsParser, RustcLintOptDenyFieldAccessParser, RustcLintOptTyParser,
RustcLintQueryInstabilityParser, RustcLintUntrackedQueryInformationParser, RustcMainParser,
RustcMustImplementOneOfParser, RustcNeverReturnsNullPointerParser,
RustcMirParser, RustcMustImplementOneOfParser, RustcNeverReturnsNullPointerParser,
RustcNoImplicitAutorefsParser, RustcNonConstTraitMethodParser, RustcNounwindParser,
RustcObjectLifetimeDefaultParser, RustcOffloadKernelParser, RustcScalableVectorParser,
RustcSimdMonomorphizeLaneLimitParser,
Expand Down Expand Up @@ -202,6 +202,7 @@ attribute_parsers!(
Combine<LinkParser>,
Combine<ReprParser>,
Combine<RustcLayoutParser>,
Combine<RustcMirParser>,
Combine<TargetFeatureParser>,
Combine<UnstableFeatureBoundParser>,
// tidy-alphabetical-end
Expand Down Expand Up @@ -517,6 +518,11 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
)
}

/// Error that a filename string literal was expected.
pub(crate) fn expected_filename_literal(&self, span: Span) {
self.emit_parse_error(span, AttributeParseErrorReason::ExpectedFilenameLiteral);
}

pub(crate) fn expected_integer_literal(&self, span: Span) -> ErrorGuaranteed {
self.emit_parse_error(span, AttributeParseErrorReason::ExpectedIntegerLiteral)
}
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_attr_parsing/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ pub(crate) enum AttributeParseErrorReason<'a> {
ExpectedStringLiteral {
byte_string: Option<Span>,
},
ExpectedFilenameLiteral,
ExpectedIntegerLiteral,
ExpectedIntegerLiteralInRange {
lower_bound: isize,
Expand Down Expand Up @@ -597,6 +598,9 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError<'_> {
diag.span_label(self.span, "expected a string literal here");
}
}
AttributeParseErrorReason::ExpectedFilenameLiteral => {
diag.span_label(self.span, "expected a filename string literal here");
}
AttributeParseErrorReason::ExpectedIntegerLiteral => {
diag.span_label(self.span, "expected an integer literal here");
}
Expand Down
18 changes: 18 additions & 0 deletions compiler/rustc_hir/src/attrs/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,21 @@ pub enum RustcLayoutType {
Debug,
}

#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute, PartialEq, Eq)]
pub enum RustcMirKind {
PeekMaybeInit,
PeekMaybeUninit,
PeekLiveness,
StopAfterDataflow,
BorrowckGraphvizPostflow { path: PathBuf },
BorrowckGraphvizFormat { format: BorrowckGraphvizFormatKind },
}

#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute, PartialEq, Eq)]
pub enum BorrowckGraphvizFormatKind {
TwoPhase,
}

/// Represents parsed *built-in* inert attributes.
///
/// ## Overview
Expand Down Expand Up @@ -1090,6 +1105,9 @@ pub enum AttributeKind {
/// Represents `#[rustc_main]`.
RustcMain,

/// Represents `#[rustc_mir]`.
RustcMir(ThinVec<RustcMirKind>),

/// Represents `#[rustc_must_implement_one_of]`
RustcMustImplementOneOf { attr_span: Span, fn_names: ThinVec<Ident> },

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/attrs/encode_cross_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ impl AttributeKind {
RustcLintUntrackedQueryInformation => Yes,
RustcMacroTransparency(..) => Yes,
RustcMain => No,
RustcMir(..) => Yes,
RustcMustImplementOneOf { .. } => No,
RustcNeverReturnsNullPointer => Yes,
RustcNoImplicitAutorefs => Yes,
Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_hir/src/attrs/pretty_printing.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::num::NonZero;
use std::ops::Deref;
use std::path::PathBuf;

use rustc_abi::Align;
use rustc_ast::attr::data_structures::CfgEntry;
Expand Down Expand Up @@ -96,7 +97,15 @@ impl<T: PrintAttribute> PrintAttribute for FxIndexMap<T, Span> {
p.word("]");
}
}
impl PrintAttribute for PathBuf {
fn should_render(&self) -> bool {
true
}

fn print_attribute(&self, p: &mut Printer) {
p.word(self.display().to_string());
}
}
macro_rules! print_skip {
($($t: ty),* $(,)?) => {$(
impl PrintAttribute for $t {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ edition = "2024"
polonius-engine = "0.13.0"
regex = "1"
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_graphviz = { path = "../rustc_graphviz" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }
rustc_macros = { path = "../rustc_macros" }
rustc_middle = { path = "../rustc_middle" }
Expand Down
12 changes: 0 additions & 12 deletions compiler/rustc_mir_dataflow/messages.ftl
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
mir_dataflow_duplicate_values_for =
duplicate values for `{$name}`

mir_dataflow_path_must_end_in_filename =
path must end in a filename

mir_dataflow_peek_argument_not_a_local =
rustc_peek: argument was not a local

Expand All @@ -19,11 +13,5 @@ mir_dataflow_peek_must_be_not_temporary =
mir_dataflow_peek_must_be_place_or_ref_place =
rustc_peek: argument expression must be either `place` or `&place`

mir_dataflow_requires_an_argument =
`{$name}` requires an argument

mir_dataflow_stop_after_dataflow_ended_compilation =
stop_after_dataflow ended compilation

mir_dataflow_unknown_formatter =
unknown formatter
32 changes: 1 addition & 31 deletions compiler/rustc_mir_dataflow/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,35 +1,5 @@
use rustc_macros::Diagnostic;
use rustc_span::{Span, Symbol};

#[derive(Diagnostic)]
#[diag(mir_dataflow_path_must_end_in_filename)]
pub(crate) struct PathMustEndInFilename {
#[primary_span]
pub span: Span,
}

#[derive(Diagnostic)]
#[diag(mir_dataflow_unknown_formatter)]
pub(crate) struct UnknownFormatter {
#[primary_span]
pub span: Span,
}

#[derive(Diagnostic)]
#[diag(mir_dataflow_duplicate_values_for)]
pub(crate) struct DuplicateValuesFor {
#[primary_span]
pub span: Span,
pub name: Symbol,
}

#[derive(Diagnostic)]
#[diag(mir_dataflow_requires_an_argument)]
pub(crate) struct RequiresAnArgument {
#[primary_span]
pub span: Span,
pub name: Symbol,
}
use rustc_span::Span;

#[derive(Diagnostic)]
#[diag(mir_dataflow_stop_after_dataflow_ended_compilation)]
Expand Down
Loading