Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
1b0230e
Update documentation for -Zdump-dep-graph
blyxyas Jul 14, 2026
b6e4d46
Add regression test for imperfect derive diagnostics
MlDenis Jul 15, 2026
c271c6b
Reject non-constructor self types in const-arg tuple-call lowering
Dnreikronos Jun 1, 2026
ba5836b
Enable macroless const args in regression test
Dnreikronos Jul 23, 2026
cceaea0
Extract misrepresented function call recovery
Dnreikronos Jul 23, 2026
9c0d5d2
Use structured diagnostic for complex const args
Dnreikronos Jul 24, 2026
9ad9fe0
Add `Default` implementation for `std::sync::Once`
tbu- Jul 29, 2026
a8d9636
fix
bb1yd Jun 16, 2026
cf0a043
Use Rust ABI for __rust_panic_cleanup
bjorn3 Jul 28, 2026
8087334
Directly use Box in the PanicPayload trait and __rust_panic_cleanup
bjorn3 Jul 28, 2026
ae5215c
Mark PanicPayload and __rust_start_panic as safe
bjorn3 Jul 28, 2026
3ef33b7
Avoid allocation when using dummy panic_unwind impl
bjorn3 Jul 28, 2026
ffc65e5
Mark __rust_drop_panic and __rust_foreign_exception as safe
bjorn3 Aug 14, 2026
32999f2
Fix assumptions-on-binders outlives diagnostics
Dnreikronos Jun 29, 2026
2abc0f6
Generalize solver region constraint spans
Dnreikronos Jul 24, 2026
1c21b08
Clarify region constraint span documentation
Dnreikronos Jul 24, 2026
b3fb32a
Keep solver region constraints on the borrowck InferCtxt
Dnreikronos Aug 19, 2026
36597f7
Bless trailing blank line in alias_outlives stderr
Dnreikronos Aug 19, 2026
7bffce8
Split type-op constraint fix from diagnostics
Dnreikronos Aug 20, 2026
8b18fda
fix unrecognized link
lqd Aug 20, 2026
bbc9e66
Build rustc and codegen backends with -Zembed-metadata=no
bjorn3 Jan 13, 2026
fa87d61
add some documentation about shared abstraction layer
lqd Aug 21, 2026
5d347d7
Add myself to mailmap
AsakuraMizu Aug 21, 2026
373266b
Avoid arming the Windows TLS destructor guard in fibers
ohadravid Aug 21, 2026
13bf326
Remove leftover immediate creation
jdupak-ms Aug 21, 2026
bbd34d2
Use `symlink_dir` to create junctions on Windows instead of trying to…
Zoxc Feb 10, 2026
8fe7ae5
Add safety comments in alloc::Wtf8, and update the link in core::Wtf8
yilin0518 Aug 21, 2026
3c43eb0
reflection: remove fields from TypeKind::Int and Float
yara-blue Aug 19, 2026
1d2a65f
reflection: remove field from TypeKind::Bool and Char
yara-blue Aug 19, 2026
4c68bd8
Add Arc/Rc::strong_count_from_raw
valentynkit Aug 21, 2026
823b923
Use bitset for locals_with_use_data
panstromek Aug 21, 2026
8978aee
bootstrap: build the offload/openmp runtimes with clang
ZuseZ4 Aug 20, 2026
10b5235
bootstrap: rename `Config::llvm_clang_dir` to `offload_clang_dir`
ZuseZ4 Aug 21, 2026
36df236
Implement clamp_to
Kyuuhachi Dec 16, 2025
28a3aa7
Rollup merge of #151061 - bjorn3:rustc_no_embed_metadata, r=Kobzol
JonathanBrouwer Aug 21, 2026
4ac82eb
Rollup merge of #150075 - Kyuuhachi:limit_to, r=ChrisDenton
JonathanBrouwer Aug 21, 2026
8918f4d
Rollup merge of #157513 - Dnreikronos:fix-tracing-const-arg-157152, r…
JonathanBrouwer Aug 21, 2026
c32643e
Rollup merge of #157949 - bb1yd:allow-self-in-const-generics, r=BoxyUwU
JonathanBrouwer Aug 21, 2026
0bf501a
Rollup merge of #158588 - Dnreikronos:trait_selection/assumptions_bin…
JonathanBrouwer Aug 21, 2026
f7cbe05
Rollup merge of #160136 - tbu-:pr_once_default, r=clarfonthey
JonathanBrouwer Aug 21, 2026
c5d13d4
Rollup merge of #161048 - bjorn3:refactor_unwind5, r=clarfonthey
JonathanBrouwer Aug 21, 2026
1462014
Rollup merge of #161292 - yilin0518:fix_alloc_wtf8, r=clarfonthey
JonathanBrouwer Aug 21, 2026
afb5789
Rollup merge of #161444 - lqd:ir-comments, r=lcnr
JonathanBrouwer Aug 21, 2026
1ab5abc
Rollup merge of #161465 - jdupak-ms:patch-1, r=wesleywiser
JonathanBrouwer Aug 21, 2026
8ab10e8
Rollup merge of #152433 - Zoxc:bootstrap-symlink, r=ChrisDenton
JonathanBrouwer Aug 21, 2026
362e91d
Rollup merge of #159098 - valentynkit:arc-rc-strong-count-from-raw, r…
JonathanBrouwer Aug 21, 2026
ad1ed9b
Rollup merge of #159282 - blyxyas:walk-items-creader, r=jackh726
JonathanBrouwer Aug 21, 2026
0360f64
Rollup merge of #159318 - MlDenis:test/issue-52560-perfect-derive-dia…
JonathanBrouwer Aug 21, 2026
1aaec58
Rollup merge of #161401 - yara-blue:remove-typekind-fields2, r=oli-obk
JonathanBrouwer Aug 21, 2026
e4d2b0b
Rollup merge of #161431 - ZuseZ4:offload-clang-compiler, r=Kobzol
JonathanBrouwer Aug 21, 2026
2f489ad
Rollup merge of #161451 - ohadravid:windows-tls-avoid-registering-dto…
JonathanBrouwer Aug 21, 2026
eb876cb
Rollup merge of #161463 - AsakuraMizu:mailmap, r=jieyouxu
JonathanBrouwer Aug 21, 2026
c9db83f
Rollup merge of #161476 - panstromek:use-bitset-locals-with-use-data,…
JonathanBrouwer Aug 21, 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: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -743,3 +743,4 @@ Zack Corr <zack@z0w0.me> <zackcorr95@gmail.com>
Zack Slayton <zack.slayton@gmail.com>
Zbigniew Siciarz <zbigniew@siciarz.net> Zbigniew Siciarz <antyqjon@gmail.com>
y21 <30553356+y21@users.noreply.github.com>
朝倉水希 <mizuk1@mzk1.dev> <asakuramizu111@gmail.com>
11 changes: 3 additions & 8 deletions compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,9 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
let errci = ErrorConstraintInfo { fr, outlived_fr, category, span };

let mut diag = match (category, fr_is_local, outlived_fr_is_local) {
(ConstraintCategory::SolverRegionConstraint(span), _, _) => {
let mut d = self.dcx().struct_span_err(
span,
"unsatisfied lifetime constraint from -Zassumptions-on-binders :3",
);
d.note("meoow :c");
d
}
(ConstraintCategory::SolverRegionConstraint(span), _, _) => self
.dcx()
.struct_span_err(span, "higher-ranked lifetime bound could not be satisfied"),
(ConstraintCategory::Return(kind), true, false)
if self.regioncx.is_closure_fn_mut(fr) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
GenericArgKind::Lifetime(r1) => {
let r1_vid = self.to_region_vid(r1);
let r2_vid = self.to_region_vid(r2);
self.add_outlives(r1_vid, r2_vid, constraint_category);
self.add_outlives(r1_vid, r2_vid, constraint_category, self.span);
}

GenericArgKind::Type(mut t1) => {
Expand Down Expand Up @@ -221,6 +221,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
sup: ty::RegionVid,
sub: ty::RegionVid,
category: ConstraintCategory<'tcx>,
span: Span,
) {
let category = match self.category {
ConstraintCategory::Boring | ConstraintCategory::BoringNoLocation => category,
Expand All @@ -229,7 +230,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
self.constraints.outlives_constraints.push(OutlivesConstraint {
locations: self.locations,
category,
span: self.span,
span,
sub,
sup,
variance_info: ty::VarianceDiagInfo::default(),
Expand All @@ -246,14 +247,14 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
impl<'a, 'b, 'tcx> TypeOutlivesDelegate<'tcx> for &'a mut ConstraintConversion<'b, 'tcx> {
fn push_sub_region_constraint(
&mut self,
_origin: SubregionOrigin<'tcx>,
origin: SubregionOrigin<'tcx>,
a: ty::Region<'tcx>,
b: ty::Region<'tcx>,
constraint_category: ConstraintCategory<'tcx>,
) {
let b = self.to_region_vid(b);
let a = self.to_region_vid(a);
self.add_outlives(b, a, constraint_category);
self.add_outlives(b, a, constraint_category, origin.span());
}

fn push_verify(
Expand Down
13 changes: 8 additions & 5 deletions compiler/rustc_borrowck/src/type_check/liveness/local_use_map.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use rustc_index::IndexVec;
use rustc_index::bit_set::DenseBitSet;
use rustc_middle::mir::visit::{PlaceContext, Visitor};
use rustc_middle::mir::{Body, Local, Location};
use rustc_mir_dataflow::points::{DenseLocationMap, PointIndex};
Expand Down Expand Up @@ -97,9 +98,11 @@ impl LocalUseMap {
return local_use_map;
}

let mut locals_with_use_data: IndexVec<Local, bool> =
IndexVec::from_elem(false, &body.local_decls);
live_locals.iter().for_each(|&local| locals_with_use_data[local] = true);
let mut locals_with_use_data: DenseBitSet<Local> =
DenseBitSet::new_empty(body.local_decls.len());
live_locals.iter().for_each(|&local| {
locals_with_use_data.insert(local);
});

LocalUseMapBuild { local_use_map: &mut local_use_map, location_map, locals_with_use_data }
.visit_body(body);
Expand Down Expand Up @@ -134,12 +137,12 @@ struct LocalUseMapBuild<'me> {
// obtained the same information from `live_locals` but we want to
// avoid repeatedly calling `Vec::contains()` (see `LocalUseMap` for
// the rationale on the time-memory trade-off we're favoring here).
locals_with_use_data: IndexVec<Local, bool>,
locals_with_use_data: DenseBitSet<Local>,
}

impl Visitor<'_> for LocalUseMapBuild<'_> {
fn visit_local(&mut self, local: Local, context: PlaceContext, location: Location) {
if self.locals_with_use_data[local]
if self.locals_with_use_data.contains(local)
&& let Some(def_use) = def_use::categorize(context)
{
let first_appearance = match def_use {
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ pub(crate) fn type_check<'tcx>(
&mut converter,
typeck.known_type_outlives_obligations,
universal_region_relations.outlives.clone(),
infcx.tcx.def_span(infcx.root_def_id),
);
}

Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
parse_atomic_ordering(fail_ordering),
weak,
);
let val = bx.from_immediate(val);
let success = bx.from_immediate(success);

let mut builder = OperandRefBuilder::new(result_layout);
builder.insert_imm(FieldIdx::from_u32(0), val);
Expand Down
69 changes: 6 additions & 63 deletions compiler/rustc_const_eval/src/const_eval/type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
// Fill all fields of the `TypeInfo` struct.
for (idx, field) in ty_struct.fields.iter_enumerated() {
let field_dest = self.project_field(dest, idx)?;
let ptr_bit_width = || self.tcx.data_layout.pointer_size().bits();
match field.name {
sym::kind => {
let variant_index = match ty.kind() {
Expand Down Expand Up @@ -115,33 +114,19 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
self.project_downcast_named(&field_dest, sym::Char)?;
variant
}
ty::Int(int_ty) => {
let (variant, variant_place) =
ty::Int(_) => {
let (variant, _variant_place) =
self.project_downcast_named(&field_dest, sym::Int)?;
let place = self.project_field(&variant_place, FieldIdx::ZERO)?;
self.write_int_type_info(
place,
int_ty.bit_width().unwrap_or_else(/* isize */ ptr_bit_width),
true,
)?;
variant
}
ty::Uint(uint_ty) => {
let (variant, variant_place) =
ty::Uint(_) => {
let (variant, _variant_place) =
self.project_downcast_named(&field_dest, sym::Int)?;
let place = self.project_field(&variant_place, FieldIdx::ZERO)?;
self.write_int_type_info(
place,
uint_ty.bit_width().unwrap_or_else(/* usize */ ptr_bit_width),
false,
)?;
variant
}
ty::Float(float_ty) => {
let (variant, variant_place) =
ty::Float(_) => {
let (variant, _variant_place) =
self.project_downcast_named(&field_dest, sym::Float)?;
let place = self.project_field(&variant_place, FieldIdx::ZERO)?;
self.write_float_type_info(place, float_ty.bit_width())?;
variant
}
ty::Str => {
Expand Down Expand Up @@ -316,48 +301,6 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
interp_ok(())
}

fn write_int_type_info(
&mut self,
place: impl Writeable<'tcx, CtfeProvenance>,
bit_width: u64,
signed: bool,
) -> InterpResult<'tcx> {
for (field_idx, field) in
place.layout().ty.ty_adt_def().unwrap().non_enum_variant().fields.iter_enumerated()
{
let field_place = self.project_field(&place, field_idx)?;
match field.name {
sym::bits => self.write_scalar(
Scalar::from_u32(bit_width.try_into().expect("bit_width overflowed")),
&field_place,
)?,
sym::signed => self.write_scalar(Scalar::from_bool(signed), &field_place)?,
other => span_bug!(self.tcx.def_span(field.did), "unimplemented field {other}"),
}
}
interp_ok(())
}

fn write_float_type_info(
&mut self,
place: impl Writeable<'tcx, CtfeProvenance>,
bit_width: u64,
) -> InterpResult<'tcx> {
for (field_idx, field) in
place.layout().ty.ty_adt_def().unwrap().non_enum_variant().fields.iter_enumerated()
{
let field_place = self.project_field(&place, field_idx)?;
match field.name {
sym::bits => self.write_scalar(
Scalar::from_u32(bit_width.try_into().expect("bit_width overflowed")),
&field_place,
)?,
other => span_bug!(self.tcx.def_span(field.did), "unimplemented field {other}"),
}
}
interp_ok(())
}

pub(crate) fn write_reference_type_info(
&mut self,
place: impl Writeable<'tcx, CtfeProvenance>,
Expand Down
16 changes: 14 additions & 2 deletions compiler/rustc_hir_analysis/src/collect/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use tracing::instrument;

use super::{HirPlaceholderCollector, ItemCtxt, bad_placeholder};
use crate::check::wfcheck::check_static_item;
use crate::diagnostics::ParamInTyOfConstParam;
use crate::hir_ty_lowering::HirTyLowerer;

mod opaque;
Expand Down Expand Up @@ -239,8 +240,19 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_
}

Node::GenericParam(param) => match &param.kind {
GenericParamKind::Type { default: Some(ty), .. }
| GenericParamKind::Const { ty, .. } => icx.lower_ty(ty),
GenericParamKind::Type { default: Some(ty), .. } => icx.lower_ty(ty),
GenericParamKind::Const { ty, .. } => {
let lowered_ty = icx.lower_ty(ty);
if !tcx.features().generic_const_parameter_types() && lowered_ty.has_param() {
let guar = tcx
.dcx()
.create_err(ParamInTyOfConstParam { span: ty.span, ty: lowered_ty })
.emit();
Ty::new_error(tcx, guar)
} else {
lowered_ty
}
}
x => bug!("unexpected non-type Node::GenericParam: {:?}", x),
},

Expand Down
16 changes: 16 additions & 0 deletions compiler/rustc_hir_analysis/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ pub(crate) use precise_captures::*;

pub(crate) mod remove_or_use_generic;

#[derive(Diagnostic)]
#[diag("complex const arguments must be placed inside of a `const` block")]
pub(crate) struct ComplexConstArg {
#[primary_span]
pub span: Span,
}

#[derive(Diagnostic)]
#[diag("ambiguous associated {$assoc_kind} `{$assoc_ident}` in bounds of `{$qself}`")]
pub(crate) struct AmbiguousAssocItem<'a> {
Expand Down Expand Up @@ -2144,3 +2151,12 @@ pub(crate) struct OnlyStructsCanBeViewedAdt<'tcx> {
pub article: &'static str,
pub kind: &'static str,
}

#[derive(Diagnostic)]
#[diag("the type of const parameters must not depend on other generic parameters", code = E0770)]
pub(crate) struct ParamInTyOfConstParam<'tcx> {
#[primary_span]
#[label("the type `{$ty}` must not depend on other generic parameter")]
pub(crate) span: Span,
pub(crate) ty: Ty<'tcx>,
}
36 changes: 32 additions & 4 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore-tidy-file-filelength

//! HIR ty lowering: Lowers type-system entities[^1] from the [HIR][hir] to
//! the [`rustc_middle::ty`] representation.
//!
Expand Down Expand Up @@ -2523,6 +2525,31 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
ty::Const::new_value(tcx, valtree, ty)
}

fn try_recover_misrepresented_function_call(
&self,
hir_self_ty: &'tcx hir::Ty<'tcx>,
span: Span,
) -> Option<ErrorGuaranteed> {
// Only an enum can host a tuple-variant constructor (`<Option<u32>>::Some(..)`).
// For any other self type, a type-relative call is an associated function, not a
// constructor, and must be wrapped in `const { ... }`. We catch that here, before
// lowering the self type, so a generic struct/union written without its args
// (`FieldName::len()`, from `tracing`'s macros) reports this clear error instead
// of a spurious E0107 "missing generics" (#157152), and a primitive or foreign
// type reports it instead of an opaque downstream resolution error. Enums,
// aliases, `Self` and type parameters are let through: each may resolve to an
// enum, so they must reach constructor lowering.
let self_ty_res = match hir_self_ty.kind {
hir::TyKind::Path(hir::QPath::Resolved(_, path)) => path.res,
_ => Res::Err,
};
matches!(
self_ty_res,
Res::Def(DefKind::Struct | DefKind::Union | DefKind::ForeignTy, _) | Res::PrimTy(_)
)
.then(|| self.dcx().emit_err(diagnostics::ComplexConstArg { span }))
}

fn lower_const_arg_tuple_call(
&self,
hir_id: HirId,
Expand All @@ -2543,6 +2570,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
self.lower_resolved_const_path(opt_self_ty, path, hir_id)
}
hir::QPath::TypeRelative(hir_self_ty, segment) => {
if let Some(e) = self.try_recover_misrepresented_function_call(hir_self_ty, span) {
return ty::Const::new_error(tcx, e);
}

let self_ty = self.lower_ty(hir_self_ty);
match self.lower_type_relative_const_path(
self_ty,
Expand Down Expand Up @@ -2576,10 +2607,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
(tcx.adt_def(parent_did), fn_args, parent_did)
}
_ => {
let e = self.dcx().span_err(
span,
"complex const arguments must be placed inside of a `const` block",
);
let e = self.dcx().emit_err(diagnostics::ComplexConstArg { span });
return Const::new_error(tcx, e);
}
};
Expand Down
8 changes: 5 additions & 3 deletions compiler/rustc_infer/src/infer/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,21 @@ impl<'tcx> rustc_type_ir::InferCtxtLike for InferCtxt<'tcx> {
fn get_solver_region_constraint(
&self,
) -> rustc_type_ir::region_constraint::RegionConstraint<TyCtxt<'tcx>> {
self.inner.borrow().solver_region_constraint_storage.get_constraint()
self.inner.borrow().solver_region_constraint_storage.get_unspanned_constraint()
}

fn overwrite_solver_region_constraint(
&self,
constraint: rustc_type_ir::region_constraint::RegionConstraint<TyCtxt<'tcx>>,
span: Span,
) {
let mut inner = self.inner.borrow_mut();
use rustc_data_structures::undo_log::UndoLogs;

use crate::infer::UndoLog;
let old_constraint = inner.solver_region_constraint_storage.get_constraint();
inner.undo_log.push(UndoLog::OverwriteSolverRegionConstraint { old_constraint });
inner.solver_region_constraint_storage.overwrite_solver_region_constraint(constraint);
inner.solver_region_constraint_storage.overwrite(constraint, span);
}

fn universe_of_ty(&self, vid: ty::TyVid) -> Option<ty::UniverseIndex> {
Expand Down Expand Up @@ -331,14 +332,15 @@ impl<'tcx> rustc_type_ir::InferCtxtLike for InferCtxt<'tcx> {
fn register_solver_region_constraint(
&self,
c: rustc_type_ir::region_constraint::RegionConstraint<TyCtxt<'tcx>>,
span: Span,
) {
let mut inner = self.inner.borrow_mut();
use rustc_data_structures::undo_log::UndoLogs;

use crate::infer::UndoLog;
let previous_was_and = inner.solver_region_constraint_storage.is_and();
inner.undo_log.push(UndoLog::PushSolverRegionConstraint { previous_was_and });
inner.solver_region_constraint_storage.push(c);
inner.solver_region_constraint_storage.push(c, span);
}

fn register_ty_outlives(&self, ty: Ty<'tcx>, r: ty::Region<'tcx>, span: Span) {
Expand Down
Loading
Loading