Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
69f75db
Move the foreign module #[link] ABI check to attribute parsing
hizyyo Sep 5, 2026
0c182d6
Fix finalize_check signatures
hizyyo Sep 12, 2026
89da863
Address link attribute finalization invariants
hizyyo Sep 19, 2026
6846fe9
Fix `Diverges`
nnethercote Sep 23, 2026
0f125fa
Ensure llvm worker threads have sufficient stack space
pmur Sep 24, 2026
999b4aa
Fix maximum read/write/send length on non-{Mac, Windows} platforms
fs-rachel Sep 17, 2026
4326cf7
Remove `PartialOrd`/`Ord` impls for `Span`/`SpanData`
nnethercote Sep 23, 2026
1b8ac47
Remove `Span::source_equal`
nnethercote Sep 24, 2026
7c10734
regression test for inherent associated const ICE
malezjaa Sep 15, 2026
0159429
update feature name
malezjaa Sep 27, 2026
54e09fa
skip registering type outlives when non region infers exist
adwinwhite Sep 18, 2026
7809ec4
remove `None` assumptions
adwinwhite Sep 18, 2026
d1f102f
force ambiguity when no assumptions
adwinwhite Sep 18, 2026
c901622
yeet `propagate_ambiguity`
adwinwhite Sep 18, 2026
4d0e645
triagebot: Subscribe me to changes in test-float-parse
tgross35 Sep 28, 2026
af8125b
x perf takes database path
jdonszelmann Sep 23, 2026
dce48c6
emit UnresolvedDelegationCallee for TypeRelativeDelegationRes::Error
paradoxicalguy Sep 28, 2026
b0ce557
Rollup merge of #162915 - fs-rachel:fix-max-send-length, r=fs-rachel
JonathanBrouwer Sep 28, 2026
28fa669
Rollup merge of #162917 - paradoxicalguy:delegation-ice-fix, r=petroc…
JonathanBrouwer Sep 28, 2026
cd929c5
Rollup merge of #163209 - jdonszelmann:x-perf-database-path, r=jieyouxu
JonathanBrouwer Sep 28, 2026
cad878b
Rollup merge of #162373 - hizyyo:check-link-153101, r=JonathanBrouwer
JonathanBrouwer Sep 28, 2026
fcef316
Rollup merge of #162829 - malezjaa:regression-test-142722, r=folkertdev
JonathanBrouwer Sep 28, 2026
7987cc7
Rollup merge of #162935 - adwinwhite:abby-ambig, r=BoxyUwU
JonathanBrouwer Sep 28, 2026
b36d575
Rollup merge of #163289 - pmur:murp/llvm-stack-size, r=oli-obk
JonathanBrouwer Sep 28, 2026
773bab3
Rollup merge of #163303 - nnethercote:fix-Span-eq-ord, r=oli-obk
JonathanBrouwer Sep 28, 2026
232360b
Rollup merge of #163421 - tgross35:triagebot-test-float-parse, r=jiey…
JonathanBrouwer Sep 28, 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: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4826,7 +4826,6 @@ version = "0.0.0"
dependencies = [
"bitflags",
"blake3",
"derive-where",
"indexmap",
"itoa",
"md-5",
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_ast_lowering/src/delegation/resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ impl<'tcx> DelegationResolver<'_, 'tcx> {
match tcx.resolve_type_relative_delegations(()).get(&def_id) {
Some(res) => match *res {
TypeRelativeDelegationRes::Ok(sig_id) => Ok(sig_id),
TypeRelativeDelegationRes::Error(err) => Err(err),
TypeRelativeDelegationRes::Error(_) => {
Err(tcx.dcx().emit_err(UnresolvedDelegationCallee { span }))
}
TypeRelativeDelegationRes::Ambig(_) => {
Err(tcx.dcx().emit_err(AmbiguousDelegationToInherentImpl { span }))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl CombineAttributeParser for AllowInternalUnstableParser {
.zip(iter::repeat(cx.attr_span))
}

fn finalize_check(cx: &FinalizeCheckContext<'_, '_>, attr_span: Span) {
fn finalize_check(cx: &mut FinalizeCheckContext<'_, '_>, attr_span: Span) {
check_macro_only(cx, attr_span);
}
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ impl NoArgsAttributeParser for TrackCallerParser {
const STABILITY: AttributeStability = AttributeStability::Stable;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::TrackCaller;

fn finalize_check(cx: &FinalizeCheckContext<'_, '_>, attr_span: Span) {
fn finalize_check(cx: &mut FinalizeCheckContext<'_, '_>, attr_span: Span) {
match cx.target {
Target::Fn => {
// `#[track_caller]` is not valid on weak lang items because they are called via
Expand Down Expand Up @@ -571,7 +571,7 @@ impl CombineAttributeParser for TargetFeatureParser {
parse_tf_attribute(cx, args)
}

fn finalize_check(cx: &FinalizeCheckContext<'_, '_>, attr_span: Span) {
fn finalize_check(cx: &mut FinalizeCheckContext<'_, '_>, attr_span: Span) {
// `#[target_feature]` is incompatible with lang item functions,
// except on WASM where calling target-feature functions is safe (see #84988).
if !cx.sess().target.is_like_wasm && !cx.sess().opts.actually_rustdoc {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl SingleAttributeParser for RustcForceInlineParser {
))
}

fn finalize_check(cx: &FinalizeCheckContext<'_, '_>, attr_span: Span) {
fn finalize_check(cx: &mut FinalizeCheckContext<'_, '_>, attr_span: Span) {
let Some(inline_span) = find_attr!(cx.parsed_attrs, Inline(attr, span) if !matches!(attr, InlineAttr::Force { .. }) => span)
else {
return;
Expand Down
31 changes: 28 additions & 3 deletions compiler/rustc_attr_parsing/src/attributes/link_attrs.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use rustc_abi::ExternAbi;
use rustc_ast::ItemKind;
use rustc_attr_ir::AttributeKind::{LinkName, LinkOrdinal, LinkSection};
use rustc_attr_ir::*;
use rustc_errors::msg;
use rustc_feature::{AttributeStability, Features};
use rustc_lint_defs::builtin::ILL_FORMED_ATTRIBUTE_INPUT;
use rustc_lint_defs::builtin::{ILL_FORMED_ATTRIBUTE_INPUT, UNUSED_ATTRIBUTES};
use rustc_session::Session;
use rustc_session::diagnostics::feature_err;
use rustc_span::edition::Edition::Edition2024;
Expand All @@ -17,7 +19,7 @@ use crate::attributes::cfg::parse_cfg_entry;
use crate::diagnostics::{
AsNeededCompatibility, BothFfiConstAndPure, BundleNeedsStatic, EmptyLinkName,
ExportSymbolsNeedsStatic, ImportNameTypeRaw, ImportNameTypeX86, IncompatibleWasmLink,
InvalidLinkModifier, InvalidMachoSection, InvalidMachoSectionReason, LinkFrameworkApple,
InvalidLinkModifier, InvalidMachoSection, InvalidMachoSectionReason, Link, LinkFrameworkApple,
LinkOrdinalOutOfRange, LinkRequiresName, MultipleModifiers, NullOnLinkName, NullOnLinkSection,
RawDylibOnlyWindows, WholeArchiveNeedsStatic,
};
Expand Down Expand Up @@ -258,6 +260,29 @@ impl CombineAttributeParser for LinkParser {
import_name_type,
})
}

fn finalize_check(cx: &mut FinalizeCheckContext<'_, '_>, attr_span: Span) {
if cx.target != Target::ForeignMod {
return;
}

let item = cx.target_item.expect("missing AST target item for Target::ForeignMod");
let ItemKind::ForeignMod(fm) = &item.kind else {
panic!("expected foreign module AST target item for Target::ForeignMod");
};
let abi = fm.abi.map_or(ExternAbi::FALLBACK, |abi| {
abi.symbol_unescaped.as_str().parse().unwrap_or_else(|_| {
cx.dcx().span_delayed_bug(
abi.span,
"LinkParser::finalize_check was unable to pre-detect the ABI, so it continues to use the recovery value solely to check for unused_attributes in the lint; a user error E0703 will be reported later in lower_abi",
);
ExternAbi::Rust
})
});
if matches!(abi, ExternAbi::Rust) {
cx.emit_lint(UNUSED_ATTRIBUTES, Link, attr_span);
}
}
}

impl LinkParser {
Expand Down Expand Up @@ -584,7 +609,7 @@ impl NoArgsAttributeParser for FfiPureParser {
const STABILITY: AttributeStability = unstable!(ffi_pure);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::FfiPure;

fn finalize_check(cx: &FinalizeCheckContext<'_, '_>, attr_span: Span) {
fn finalize_check(cx: &mut FinalizeCheckContext<'_, '_>, attr_span: Span) {
// `#[ffi_const]` functions cannot be `#[ffi_pure]`.
if cx.all_attrs.iter().any(|a| a.word_is(sym::ffi_const)) {
cx.emit_err(BothFfiConstAndPure { attr_span });
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/lint_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl NoArgsAttributeParser for RustcPubTransparentParser {
const STABILITY: AttributeStability = unstable!(rustc_attrs);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcPubTransparent;

fn finalize_check(cx: &FinalizeCheckContext<'_, '_>, attr_span: Span) {
fn finalize_check(cx: &mut FinalizeCheckContext<'_, '_>, attr_span: Span) {
// `#[rustc_pub_transparent]` may only be applied to `#[repr(transparent)]` types.
let is_transparent = find_attr!(
cx.parsed_attrs,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl NoArgsAttributeParser for AllowInternalUnsafeParser {
const STABILITY: AttributeStability = unstable!(allow_internal_unsafe);
const CREATE: fn(Span) -> AttributeKind = |span| AttributeKind::AllowInternalUnsafe(span);

fn finalize_check(cx: &FinalizeCheckContext<'_, '_>, attr_span: Span) {
fn finalize_check(cx: &mut FinalizeCheckContext<'_, '_>, attr_span: Span) {
check_macro_only(cx, attr_span);
}
}
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_attr_parsing/src/attributes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ pub(crate) trait SingleAttributeParser: 'static {
/// combinations. `attr_span` is the span of this attribute.
///
/// Defaults to a no-op.
fn finalize_check(_cx: &FinalizeCheckContext<'_, '_>, _attr_span: Span) {}
fn finalize_check(_cx: &mut FinalizeCheckContext<'_, '_>, _attr_span: Span) {}
}

/// Use in combination with [`SingleAttributeParser`].
Expand Down Expand Up @@ -287,7 +287,7 @@ pub(crate) trait NoArgsAttributeParser: 'static {
/// `attr_span` is the span of this attribute.
///
/// Defaults to a no-op.
fn finalize_check(_cx: &FinalizeCheckContext<'_, '_>, _attr_span: Span) {}
fn finalize_check(_cx: &mut FinalizeCheckContext<'_, '_>, _attr_span: Span) {}
}

pub(crate) struct WithoutArgs<T: NoArgsAttributeParser>(PhantomData<T>);
Expand All @@ -311,7 +311,7 @@ impl<T: NoArgsAttributeParser> SingleAttributeParser for WithoutArgs<T> {
Some(T::CREATE(cx.attr_span))
}

fn finalize_check(cx: &FinalizeCheckContext<'_, '_>, attr_span: Span) {
fn finalize_check(cx: &mut FinalizeCheckContext<'_, '_>, attr_span: Span) {
T::finalize_check(cx, attr_span)
}
}
Expand Down Expand Up @@ -355,7 +355,7 @@ pub(crate) trait CombineAttributeParser: 'static {
/// `attr_span` is the span of the first attribute that was encountered.
///
/// Defaults to a no-op.
fn finalize_check(_cx: &FinalizeCheckContext<'_, '_>, _attr_span: Span) {}
fn finalize_check(_cx: &mut FinalizeCheckContext<'_, '_>, _attr_span: Span) {}
}

/// Use in combination with [`CombineAttributeParser`].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl NoArgsAttributeParser for NonExhaustiveParser {
const STABILITY: AttributeStability = AttributeStability::Stable;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::NonExhaustive;

fn finalize_check(cx: &FinalizeCheckContext<'_, '_>, attr_span: Span) {
fn finalize_check(cx: &mut FinalizeCheckContext<'_, '_>, attr_span: Span) {
if cx.target != Target::Struct {
return;
}
Expand Down
9 changes: 5 additions & 4 deletions compiler/rustc_attr_parsing/src/attributes/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use rustc_attr_ir::IntType::{SignedInt, UnsignedInt};
use rustc_attr_ir::ReprAttr;
use rustc_feature::AttributeStability;
use rustc_session::diagnostics::feature_err;
use rustc_span::OrdSpan;

use super::prelude::*;
use crate::diagnostics;
Expand Down Expand Up @@ -272,7 +273,7 @@ fn parse_alignment(node: &LitKind, cx: &AcceptContext<'_, '_>) -> Result<Align,

/// Parse #[align(N)].
#[derive(Default)]
pub(crate) struct RustcAlignParser(Option<(Align, Span)>);
pub(crate) struct RustcAlignParser(Option<(Align, OrdSpan)>);

impl RustcAlignParser {
const PATH: &[Symbol] = &[sym::rustc_align];
Expand All @@ -293,7 +294,7 @@ impl RustcAlignParser {
};

match parse_alignment(&lit.kind, cx) {
Ok(literal) => self.0 = Ord::max(self.0, Some((literal, cx.attr_span))),
Ok(literal) => self.0 = Ord::max(self.0, Some((literal, OrdSpan(cx.attr_span)))),
Err(message) => {
cx.emit_err(diagnostics::InvalidAlignmentValue {
span: lit.span,
Expand All @@ -318,7 +319,7 @@ impl AttributeParser for RustcAlignParser {

fn finalize(self, _cx: &FinalizeContext<'_, '_>) -> Option<AttributeKind> {
let (align, span) = self.0?;
Some(AttributeKind::RustcAlign { align, span })
Some(AttributeKind::RustcAlign { align, span: span.0 })
}
}

Expand All @@ -342,6 +343,6 @@ impl AttributeParser for RustcAlignStaticParser {

fn finalize(self, _cx: &FinalizeContext<'_, '_>) -> Option<AttributeKind> {
let (align, span) = self.0.0?;
Some(AttributeKind::RustcAlign { align, span })
Some(AttributeKind::RustcAlign { align, span: span.0 })
}
}
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub(crate) type FinalizeFn = fn(&mut FinalizeContext<'_, '_>) -> FinalizeOutput;
/// finalized, so it can inspect the fully parsed attributes via
/// [`FinalizeCheckContext::parsed_attrs`]. The [`Span`] is the span of the attribute the
/// check is associated with, used for diagnostics.
pub(crate) type FinalizeCheckFn = fn(&FinalizeCheckContext<'_, '_>, Span);
pub(crate) type FinalizeCheckFn = fn(&mut FinalizeCheckContext<'_, '_>, Span);

/// The result of finalizing a single attribute parser.
pub(crate) struct FinalizeOutput {
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_attr_parsing/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1825,6 +1825,13 @@ pub(crate) struct EmptyLinkName {
pub span: Span,
}

#[derive(Diagnostic)]
#[diag("attribute should be applied to an `extern` block with non-Rust ABI")]
#[warning(
"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
)]
pub(crate) struct Link;

#[derive(Diagnostic)]
#[diag("link kind `framework` is only supported on Apple targets", code = E0455)]
pub(crate) struct LinkFrameworkApple {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ impl<'sess> AttributeParser<'sess> {
// inspect the fully parsed attributes via `FinalizeCheckContext::parsed_attrs`.
for (check, attr_span) in deferred_checks {
check(
&FinalizeCheckContext {
&mut FinalizeCheckContext {
shared: SharedContext {
cx: self,
target_span,
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
.errors
.iter()
.map(|error| error.span)
.any(|sp| span < sp && !sp.contains(span))
.any(|sp| span.lo_hi() < sp.lo_hi() && !sp.contains(span))
}) {
show_assign_sugg = true;
if all_init_spans.iter().any(|init_span| !init_span.contains(span))
Expand Down Expand Up @@ -930,7 +930,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
let mut shown = false;
let mut shown_condition_value = false;
for error in visitor.errors {
if error.span < span && !error.span.overlaps(span) {
if error.span.lo_hi() < span.lo_hi() && !error.span.overlaps(span) {
// When we have a case like `match-cfg-fake-edges.rs`, we don't want to mention
// match arms coming after the primary span because they aren't relevant:
// ```
Expand All @@ -951,7 +951,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
}
if !shown {
for sp in &reachable_spans {
if *sp < span && !sp.overlaps(span) {
if sp.lo_hi() < span.lo_hi() && !sp.overlaps(span) {
err.span_label(*sp, "binding initialized here in some conditions");
}
}
Expand Down Expand Up @@ -2545,7 +2545,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {

if let hir::ExprKind::MethodCall(body_call, recv, ..) = ex.kind
&& body_call.ident.name == sym::next
&& recv.span.source_equal(self.expr_span)
&& recv.span.lo_hi() == self.expr_span.lo_hi()
{
self.body_expr = Some(ex);
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ impl<'tcx> BorrowExplanation<'tcx> {
_ => None,
})
.collect::<Vec<Span>>();
preds.sort();
preds.dedup();
preds.sort_by_key(|span| span.lo_hi());
preds.dedup_by_key(|span| span.lo_hi());
if !preds.is_empty() {
let s = if preds.len() == 1 { "" } else { "s" };
err.span_note(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl<'diag, 'tcx> BorrowckDiagnosticsBuffer<'diag, 'tcx> {
}

if !self.buffered_diags.is_empty() {
self.buffered_diags.sort_by_key(|(sort_span, _)| *sort_span);
self.buffered_diags.sort_by_key(|(sort_span, _)| sort_span.lo_hi());
for (_, diag) in self.buffered_diags.drain(..) {
diag.emit();
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/move_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,8 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
suggestions.push((binding_span.shrink_to_lo(), msg, "ref ".to_string()));
}
}
suggestions.sort_unstable_by_key(|&(span, _, _)| span);
suggestions.dedup_by_key(|&mut (span, _, _)| span);
suggestions.sort_unstable_by_key(|&(span, _, _)| span.lo_hi());
suggestions.dedup_by_key(|&mut (span, _, _)| span.lo_hi());
for (span, msg, suggestion) in suggestions {
err.span_suggestion_verbose(span, msg, suggestion, Applicability::MachineApplicable);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ impl<'tcx> MirTypeckRegionConstraints<'tcx> {
/// required to hold. Normally, this is at a particular point which
/// created the obligation, but for constraints that the user gave, we
/// want the constraint to hold at all points.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub enum Locations {
/// Indicates that a type constraint should always be true. This
/// is particularly important in the new borrowck analysis for
Expand Down
Loading
Loading