Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
ea475ff
add test which should pass
bit-aloo Jul 14, 2026
62e3e3d
Add helper for equality-constrainable assoc items
bit-aloo Jul 18, 2026
f86e9f6
Allow associated const equality constraints with MGCA
bit-aloo Jul 18, 2026
cd57bc3
Correct the statments
bit-aloo Jul 20, 2026
faebca4
Remove NonType assocConstViolation variant, as we don't need it anymore
bit-aloo Jul 20, 2026
a8087a3
Gate non-type assoc const equality on generic_const_args
bit-aloo Jul 21, 2026
4077496
add dyn generic non type assoc const
bit-aloo Jul 23, 2026
ad7e5e2
add lack_of_wfcheck for gca
bit-aloo Jul 23, 2026
2191fc1
Revise generic const args WF test and split GAT case
bit-aloo Jul 25, 2026
bb33041
Account for desugaring in method call move errors
estebank Jul 27, 2026
d27f45a
Tweak wording
estebank Jul 28, 2026
2713b5f
Account for `for await` in move errors
estebank Jul 30, 2026
bdbfee0
Split `aarch64-apple{,-macos-26}` => `aarch64-apple{,-macos-26}-{1,2}…
jieyouxu Aug 3, 2026
e90ed38
Remove unused args from `ConstAnalysis` methods
nnethercote Aug 4, 2026
6377970
Split `apply_primary_terminator_effect`
nnethercote Aug 4, 2026
099db74
Update error message in documentation comments
SzilvasiPeter Aug 5, 2026
e6b1e68
Cap socket send length to c_int::MAX on Apple targets
devnexen Jul 18, 2026
cefe30f
Return EMSGSIZE for oversized datagram sends
devnexen Jul 18, 2026
4507211
Expose EMSGSIZE in the Windows netc shim
devnexen Jul 18, 2026
28e1c85
Add test for oversized datagram sends
devnexen Jul 18, 2026
6477fb5
address feedbacks
devnexen Jul 25, 2026
08f76dd
Share the zeroed-mmap test buffer between the TCP and UDP tests
devnexen Aug 5, 2026
0ae62fb
Add regression test for array type recovery in generic arguments
zakrad Aug 5, 2026
0aa333d
Add tests for new solver issues
Randl Aug 5, 2026
7eac635
fix: use fully qualified paths in `walk_visitable_list!`
ada4a Aug 5, 2026
fee8922
rustc_abi: Add `LayoutData::is_variant_uninhabited` method
moulins Aug 2, 2026
187cf5d
Add a doc comment to `TyAndLayout` discouraging its uses when possible
moulins Aug 5, 2026
3a7ae70
use `VisitorResult` helper macros
ada4a Aug 5, 2026
640032d
fix: Check the fallback map before queueing child in `visible_parent_…
zalanlevai Aug 3, 2026
354cedd
add test showing difference between datalog polonius and alpha
lqd Aug 5, 2026
0a0f6df
Rename `#[unroll]` => `#[rustc_unroll]` to mitigate nameres ambiguity
jieyouxu Aug 6, 2026
44d291e
Update attr name in `#[unroll]` codegen-llvm tests
jieyouxu Jul 30, 2026
91ee1f3
Update attr name in `#[unroll]` ui tests
jieyouxu Jul 30, 2026
945d2f3
Rebless `rustc-attrs` feature gate test
jieyouxu Jul 30, 2026
d1265b7
Update attr name for `#[unroll]` in Unstable Book
jieyouxu Jul 30, 2026
39b3ad8
Suggest if-let chain continuation on unclosed delimiter
Diacod-I Aug 5, 2026
f207c16
Avoid the std DLL copy alongside rustc
Zoxc Aug 6, 2026
6db9132
Add a suggestion to MissingUnsafeOnExtern diagnostic
funsafemath Aug 6, 2026
71b8456
check_consts: exhaustively match on CastKind
RalfJung Jul 29, 2026
bb0f117
Rollup merge of #159530 - devnexen:gh115325, r=Darksonn
JonathanBrouwer Aug 6, 2026
237d7aa
Rollup merge of #159506 - bit-aloo:2026-07-14-dyn-compatible-non-type…
JonathanBrouwer Aug 6, 2026
3657c82
Rollup merge of #160006 - estebank:issue-89567, r=chenyukang
JonathanBrouwer Aug 6, 2026
5c531f0
Rollup merge of #160415 - jieyouxu:jieyouxu/ci/macos-fission, r=Mark-…
JonathanBrouwer Aug 6, 2026
c5549dd
Rollup merge of #160464 - zalanlevai:fix-visible-parent-map-fallback-…
JonathanBrouwer Aug 6, 2026
84127af
Rollup merge of #160555 - nnethercote:split-apply_terminator, r=cjgillot
JonathanBrouwer Aug 6, 2026
8355006
Rollup merge of #160592 - Diacod-I:if-let-chain-unclosed-delim-hint, …
JonathanBrouwer Aug 6, 2026
f34343d
Rollup merge of #160600 - Zoxc:no-extra-std-dll, r=Kobzol
JonathanBrouwer Aug 6, 2026
852afd5
Rollup merge of #160156 - RalfJung:cast-kind-const-check, r=oli-obk
JonathanBrouwer Aug 6, 2026
25fd483
Rollup merge of #160211 - jieyouxu:froot-loops, r=mati865
JonathanBrouwer Aug 6, 2026
aa94d21
Rollup merge of #160304 - Randl:new_tests, r=adwinwhite
JonathanBrouwer Aug 6, 2026
592096b
Rollup merge of #160398 - moulins:layout-is-variant-uninhabited, r=ol…
JonathanBrouwer Aug 6, 2026
6a7a60a
Rollup merge of #160546 - SzilvasiPeter:main, r=JohnTitor
JonathanBrouwer Aug 6, 2026
8f7de4e
Rollup merge of #160568 - ada4a:ada/push-vklwmykymnxk, r=jdonszelmann
JonathanBrouwer Aug 6, 2026
f4210f1
Rollup merge of #160571 - zakrad:regr-test-81097, r=jieyouxu
JonathanBrouwer Aug 6, 2026
1d412e0
Rollup merge of #160588 - lqd:nighty-wheat-thins, r=jackh726
JonathanBrouwer Aug 6, 2026
ce8e8ee
Rollup merge of #160617 - funsafemath:unsafe-block-diag, r=petrochenkov
JonathanBrouwer Aug 6, 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
7 changes: 7 additions & 0 deletions compiler/rustc_abi/src/layout/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ pub trait TyAbiInterface<'a, C>: Sized + std::fmt::Debug + std::fmt::Display {
}

impl<'a, Ty> TyAndLayout<'a, Ty> {
/// Synthetize a layout representing the variant-specific fields of an enum-like layout.
///
/// Note that the resulting layout *does not* fully describes `self.ty` at that specific
/// variant: prefix fields (e.g. in coroutines) and tag information are lost.
///
/// If you don't need type information about the variant's fields, prefer using
/// `self.layout.variants` directly.
pub fn for_variant<C>(self, cx: &C, variant_index: VariantIdx) -> Self
where
Ty: TyAbiInterface<'a, C>,
Expand Down
11 changes: 11 additions & 0 deletions compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2203,6 +2203,17 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> {
pub fn is_uninhabited(&self) -> bool {
self.uninhabited
}

/// Returns `true` if the given variant is uninhabited.
pub fn is_variant_uninhabited(&self, variant: VariantIdx) -> bool {
match self.variants {
Variants::Empty => true,
Variants::Single { index } => variant != index || self.uninhabited,
Variants::Multiple { ref variants, .. } => {
variants.get(variant).map(|v| v.uninhabited).unwrap_or(true)
}
}
}
}

impl<FieldIdx: Idx, VariantIdx: Idx> fmt::Debug for LayoutData<FieldIdx, VariantIdx>
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_ir/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ macro_rules! walk_list {
macro_rules! walk_visitable_list {
($visitor: expr, $list: expr $(, $($extra_args: expr),* )?) => {
for elem in $list {
$crate::try_visit!(elem.visit_with($visitor $(, $($extra_args,)* )?));
$crate::try_visit!(::rustc_type_ir::TypeVisitable::visit_with(elem, $visitor $(, $($extra_args,)* )?));
}
}
}
5 changes: 4 additions & 1 deletion compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,10 @@ impl Visitor<'_> for AstValidator<'_> {

if &Safety::Default == safety {
if item.span.at_least_rust_2024() {
self.dcx().emit_err(diagnostics::MissingUnsafeOnExtern { span: item.span });
self.dcx().emit_err(diagnostics::MissingUnsafeOnExtern {
span: item.span,
unsafe_span: item.span.shrink_to_lo(),
});
} else {
self.lint_buffer.buffer_lint(
MISSING_UNSAFE_ON_EXTERN,
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_ast_passes/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,13 @@ pub(crate) struct UnsafeItem {
pub(crate) struct MissingUnsafeOnExtern {
#[primary_span]
pub span: Span,

#[suggestion(
"needs `unsafe` before the extern keyword",
code = "unsafe ",
applicability = "machine-applicable"
)]
pub unsafe_span: Span,
}

#[derive(Diagnostic)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_attr_parsing/src/attributes/unroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use super::prelude::*;

pub(crate) struct UnrollParser;
impl SingleAttributeParser for UnrollParser {
const PATH: &[Symbol] = &[sym::unroll];
// FIXME(#159429): temporarily renamed to mitigate `#[unroll]` nameres ambiguity.
const PATH: &[Symbol] = &[sym::rustc_unroll];
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Loop),
Allow(Target::ForLoop),
Expand Down
21 changes: 7 additions & 14 deletions compiler/rustc_borrowck/src/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use std::fmt;

use rustc_data_structures::fx::FxIndexMap;
use rustc_index::bit_set::{DenseBitSet, MixedBitSet};
use rustc_middle::mir::{
self, BasicBlock, Body, CallReturnPlaces, Location, Place, TerminatorEdges,
};
use rustc_middle::mir::{self, BasicBlock, Body, CallReturnPlaces, Location, Place};
use rustc_middle::ty::{RegionVid, TyCtxt};
use rustc_mir_dataflow::fmt::DebugWithContext;
use rustc_mir_dataflow::impls::{
Expand Down Expand Up @@ -76,19 +74,15 @@ impl<'a, 'tcx> Analysis<'tcx> for Borrowck<'a, 'tcx> {
self.ever_inits.apply_early_terminator_effect(&mut state.ever_inits, term, loc);
}

fn apply_primary_terminator_effect<'mir>(
fn apply_primary_terminator_effect(
&self,
state: &mut Self::Domain,
term: &'mir mir::Terminator<'tcx>,
term: &mir::Terminator<'tcx>,
loc: Location,
) -> TerminatorEdges<'mir, 'tcx> {
) {
self.borrows.apply_primary_terminator_effect(&mut state.borrows, term, loc);
self.uninits.apply_primary_terminator_effect(&mut state.uninits, term, loc);
self.ever_inits.apply_primary_terminator_effect(&mut state.ever_inits, term, loc);

// This return value doesn't matter. It's only used by `iterate_to_fixpoint`, which this
// analysis doesn't use.
TerminatorEdges::None
}

fn apply_call_return_effect(
Expand Down Expand Up @@ -598,12 +592,12 @@ impl<'tcx> rustc_mir_dataflow::Analysis<'tcx> for Borrows<'_, 'tcx> {
self.kill_loans_out_of_scope_at_location(state, location);
}

fn apply_primary_terminator_effect<'mir>(
fn apply_primary_terminator_effect(
&self,
state: &mut Self::Domain,
terminator: &'mir mir::Terminator<'tcx>,
terminator: &mir::Terminator<'tcx>,
_location: Location,
) -> TerminatorEdges<'mir, 'tcx> {
) {
if let mir::TerminatorKind::InlineAsm { operands, .. } = &terminator.kind {
for op in operands {
if let mir::InlineAsmOperand::Out { place: Some(place), .. }
Expand All @@ -613,7 +607,6 @@ impl<'tcx> rustc_mir_dataflow::Analysis<'tcx> for Borrows<'_, 'tcx> {
}
}
}
terminator.edges()
}
}

Expand Down
110 changes: 73 additions & 37 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use rustc_middle::mir::{
LocalKind, Location, Operand, Place, PlaceRef, PlaceTy, ProjectionElem, Rvalue, Statement,
StatementKind, Terminator, TerminatorKind, VarDebugInfoContents, find_self_call,
};
use rustc_middle::ty::print::Print;
use rustc_middle::ty::print::{Print, with_no_trimmed_paths};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_middle::{bug, span_bug};
use rustc_mir_dataflow::move_paths::{InitLocation, LookupResult, MoveOutIndex};
Expand Down Expand Up @@ -1374,12 +1374,21 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
&move_spans,
);

let func = tcx.def_path_str(method_did);
err.subdiagnostic(CaptureReasonNote::FuncTakeSelf {
func,
place_name: place_name.clone(),
span: self_arg.span,
});
let func = with_no_trimmed_paths!(tcx.def_path_str(method_did));
if let Some((kind, _)) = desugaring {
err.subdiagnostic(CaptureReasonNote::DesugaringFuncTakeSelf {
func,
desugar_name: kind.name(),
place_name: place_name.clone(),
span: self_arg.span,
});
} else {
err.subdiagnostic(CaptureReasonNote::FuncTakeSelf {
func,
place_name: place_name.clone(),
span: self_arg.span,
});
}
}
let parent_did = tcx.parent(method_did);
let parent_self_ty =
Expand All @@ -1400,30 +1409,46 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
var_span: var_span.shrink_to_hi(),
});
}
if let Some((CallDesugaringKind::ForLoopIntoIter, _)) = desugaring {
if let Some((
kind @ (CallDesugaringKind::ForLoopIntoIter
| CallDesugaringKind::ForLoopIntoAsyncIter),
_,
)) = desugaring
{
let ty = moved_place.ty(self.body, tcx).ty;
let suggest = match tcx.get_diagnostic_item(sym::IntoIterator) {
Some(def_id) => type_known_to_meet_bound_modulo_regions(
self.infcx,
self.infcx.param_env,
Ty::new_imm_ref(tcx, tcx.lifetimes.re_erased, ty),
def_id,
),
_ => false,
};
let def_id = kind.trait_def_id(tcx);
let suggest = type_known_to_meet_bound_modulo_regions(
self.infcx,
self.infcx.param_env,
Ty::new_imm_ref(tcx, tcx.lifetimes.re_erased, ty),
def_id,
);
if suggest {
err.subdiagnostic(CaptureReasonSuggest::IterateSlice {
ty,
span: move_span.shrink_to_lo(),
});
}

err.subdiagnostic(CaptureReasonLabel::ImplicitCall {
fn_call_span,
place_name: &place_name,
is_partial,
is_loop_message,
});
match kind {
CallDesugaringKind::ForLoopIntoIter => {
err.subdiagnostic(CaptureReasonLabel::ImplicitCall {
fn_call_span,
place_name: &place_name,
is_partial,
is_loop_message,
});
}
CallDesugaringKind::ForLoopIntoAsyncIter => {
err.subdiagnostic(CaptureReasonLabel::ImplicitAsyncCall {
fn_call_span,
place_name: &place_name,
is_partial,
is_loop_message,
});
}
_ => {}
}
// If the moved place was a `&mut` ref, then we can
// suggest to reborrow it where it was moved, so it
// will still be valid by the time we get to the usage.
Expand Down Expand Up @@ -1451,20 +1476,31 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
}
}
} else {
if let Some((CallDesugaringKind::Await, _)) = desugaring {
err.subdiagnostic(CaptureReasonLabel::Await {
fn_call_span,
place_name: &place_name,
is_partial,
is_loop_message,
});
} else {
err.subdiagnostic(CaptureReasonLabel::MethodCall {
fn_call_span,
place_name: &place_name,
is_partial,
is_loop_message,
});
match desugaring {
Some((CallDesugaringKind::Await, _)) => {
err.subdiagnostic(CaptureReasonLabel::Await {
fn_call_span,
place_name: &place_name,
is_partial,
is_loop_message,
});
}
Some((CallDesugaringKind::QuestionBranch, _)) => {
err.subdiagnostic(CaptureReasonLabel::QuestionMark {
fn_call_span,
place_name: &place_name,
is_partial,
is_loop_message,
});
}
_ => {
err.subdiagnostic(CaptureReasonLabel::MethodCall {
fn_call_span,
place_name: &place_name,
is_partial,
is_loop_message,
});
}
}
// Erase and shadow everything that could be passed to the new infcx.
let ty = moved_place.ty(self.body, tcx).ty;
Expand Down
43 changes: 43 additions & 0 deletions compiler/rustc_borrowck/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,22 @@ pub(crate) enum CaptureReasonLabel<'a> {
is_partial: bool,
is_loop_message: bool,
},
#[label(
"{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to the question mark {$is_loop_message ->
[true] operator, in previous iteration of loop
*[false] operator
}"
)]
QuestionMark {
#[primary_span]
fn_call_span: Span,
place_name: &'a str,
is_partial: bool,
is_loop_message: bool,
},
#[label(
"{$place_name} {$is_partial ->
[true] partially moved
Expand All @@ -405,6 +421,22 @@ pub(crate) enum CaptureReasonLabel<'a> {
is_partial: bool,
is_loop_message: bool,
},
#[label(
"{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to this implicit call to {$is_loop_message ->
[true] `.into_async_iter()`, in previous iteration of loop
*[false] `.into_async_iter()`
}"
)]
ImplicitAsyncCall {
#[primary_span]
fn_call_span: Span,
place_name: &'a str,
is_partial: bool,
is_loop_message: bool,
},
#[label(
"{$place_name} {$is_partial ->
[true] partially moved
Expand Down Expand Up @@ -498,6 +530,17 @@ pub(crate) enum CaptureReasonNote {
#[primary_span]
span: Span,
},
#[note(
"the {$desugar_name} is desugared into a call to `{$func}`, which takes ownership of the \
receiver `self`, which moves {$place_name}"
)]
DesugaringFuncTakeSelf {
desugar_name: &'static str,
func: String,
place_name: String,
#[primary_span]
span: Span,
},
}

#[derive(Subdiagnostic)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/discriminant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) fn codegen_set_discriminant<'tcx>(
variant_index: VariantIdx,
) {
let layout = place.layout();
if layout.for_variant(fx, variant_index).is_uninhabited() {
if layout.is_variant_uninhabited(variant_index) {
return;
}
match layout.variants {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ pub(super) fn codegen_tag_value<'tcx, V>(
) -> Result<Option<(FieldIdx, V)>, UninhabitedVariantError> {
// By checking uninhabited-ness first we don't need to worry about types
// like `(u32, !)` which are single-variant but weird.
if layout.for_variant(cx, variant_index).is_uninhabited() {
if layout.is_variant_uninhabited(variant_index) {
return Err(UninhabitedVariantError);
}

Expand Down
Loading
Loading