Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
47c9070
Parse move exprs as a bottom expr instead of a prefix expr
fmease Oct 7, 2026
604a21c
Document zero sized allocations in `Box` and `Vec`
maxdexh Sep 25, 2026
93b75b2
document some quirks around directory symlinks on Windows
RalfJung Oct 10, 2026
311c6e3
Revert "Rollup merge of #159562 - Joel-Wwalker:154071-stdio-handle-ca…
lhecker Oct 11, 2026
5955fed
add breaking test for 161913
jdonszelmann Sep 28, 2026
7a9e409
fix fudging and three other more known issues
jdonszelmann Sep 28, 2026
fdefc16
Add a new `rustc_show_spans` internal attribute
FranciscoTGouveia Oct 11, 2026
9a20a07
test(parser): add baseline for missing turbofish with lifetime in str…
raushan728 Sep 12, 2026
508d2f4
test DSL eagerly handle false constraints
born-in-autumn Oct 13, 2026
ebca075
fix(parser): recover missing turbofish for lifetimes in exprs
raushan728 Oct 3, 2026
eb85bf4
[rustdoc] Improve display of `rustc_must_implement_one_of` note and g…
GuillaumeGomez Oct 13, 2026
fe97485
[rustdoc] Generate sidebar link for "required methods" even if there …
GuillaumeGomez Oct 13, 2026
9b08cd0
Windows FileExt trait doesn't need to handle ErrorKind::Interrupted; …
json420 Oct 13, 2026
fca5ba9
Add regression test for higher-ranked param env normalization ICE
Kuksgauzen Oct 13, 2026
5448cc6
Add a test for the `rustc_show_spans` attribute use in macros
FranciscoTGouveia Oct 13, 2026
29e3a08
Add a test for the `rustc_show_spans` attribute on nested functions
FranciscoTGouveia Oct 13, 2026
cad2ab9
Add regression test for `rustc_must_implement_one_of` changes
GuillaumeGomez Oct 13, 2026
6ffc09a
Add regression test for hang in overlap check with GAT alias
zakrad Oct 13, 2026
c097682
Remove the `span_use_eq_ctxt` lint
nnethercote Oct 6, 2026
9c1eb80
Prefer WriteConsoleW for stdout on Windows
lhecker Oct 14, 2026
6c150fe
fix some nits
born-in-autumn Oct 14, 2026
9aa0839
fix issue number for feature(unsized_const_params)
khyperia Oct 14, 2026
f5e4813
add test
mejrs Oct 11, 2026
f76d613
Use proper mod name for on_unknown attribute
mejrs Oct 14, 2026
731b659
bless tests
jdonszelmann Oct 12, 2026
3df075c
point at the opaque when its hidden type cannot be inferred
Albab-Hasan Oct 14, 2026
75b48ee
Implement better resolution for delegation mapping field
aerooneqq Oct 14, 2026
0c16e6d
Rollup merge of #162749 - raushan728:issues/162656, r=nnethercote
JonathanBrouwer Oct 14, 2026
03f0b69
Rollup merge of #164165 - FranciscoTGouveia:rustc-show-spans-attr, r=…
JonathanBrouwer Oct 14, 2026
04b9f82
Rollup merge of #164170 - lhecker:windows-stdout-perf-is-console, r=C…
JonathanBrouwer Oct 14, 2026
7178d28
Rollup merge of #164208 - aerooneqq:delegation-wrapping-field, r=petr…
JonathanBrouwer Oct 14, 2026
3734cf2
Rollup merge of #164255 - born-in-autumn:dsl-test-handle, r=khyperia
JonathanBrouwer Oct 14, 2026
ae77657
Rollup merge of #163230 - maxdexh:zero-sized-allocations-are-not-real…
JonathanBrouwer Oct 14, 2026
ccaa545
Rollup merge of #163442 - jdonszelmann:fix-fudging, r=lcnr
JonathanBrouwer Oct 14, 2026
1097fe6
Rollup merge of #163940 - fmease:move-expr-is-bottom-not-prefix, r=Ta…
JonathanBrouwer Oct 14, 2026
b6117ff
Rollup merge of #164079 - RalfJung:win-dir-symlink, r=ChrisDenton
JonathanBrouwer Oct 14, 2026
1c81bf9
Rollup merge of #164178 - mejrs:on_unknown-mod-names, r=mu001999
JonathanBrouwer Oct 14, 2026
92afc41
Rollup merge of #164219 - json420:windows-FileExt-test-cleanup, r=Chr…
JonathanBrouwer Oct 14, 2026
7c9e02f
Rollup merge of #164266 - GuillaumeGomez:rustc_must_implement_one_of,…
JonathanBrouwer Oct 14, 2026
398a666
Rollup merge of #164272 - Kuksgauzen:test-155977, r=adwinwhite
JonathanBrouwer Oct 14, 2026
6adab09
Rollup merge of #164287 - zakrad:regr-test-151503, r=adwinwhite
JonathanBrouwer Oct 14, 2026
8ed03d5
Rollup merge of #164292 - nnethercote:rm-span_use_eq_ctxt, r=lqd,Kivooeo
JonathanBrouwer Oct 14, 2026
3881053
Rollup merge of #164301 - khyperia:unsized-const-params-tracking-issu…
JonathanBrouwer Oct 14, 2026
c080453
Rollup merge of #164309 - Albab-Hasan:point-at-opaque-for-unconstrain…
JonathanBrouwer Oct 14, 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 compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4096,6 +4096,7 @@ pub struct TestBinderConstraints {

#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
pub struct TestBinderBody {
pub span: Span,
pub foralls: ThinVec<TestBinderForall>,
pub exists: ThinVec<TestBinderExists>,
pub constraints: Vec<TestBinderConstraint>,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_lowering/src/delegation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use rustc_hir::{self as hir, FnDeclFlags, QPath};
use rustc_middle::ty::Asyncness;
use rustc_span::def_id::DefId;
use rustc_span::symbol::kw;
use rustc_span::{Ident, Span, Symbol, sym};
use rustc_span::{Ident, Span, Symbol};

use crate::delegation::generics::{GenericsGenerationResults, GenericsPosition};
use crate::delegation::resolution::resolver::DelegationResolver;
Expand Down Expand Up @@ -480,7 +480,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
self.arena.alloc_slice(&[hir::ExprField {
hir_id: self.next_id(),
is_shorthand: false,
ident: Ident::new(sym::integer(0), span),
ident: Ident::new(kw::Underscore, span),
expr: self.arena.alloc(call),
span,
}]),
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2015,7 +2015,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
.iter()
.map(|predicate| self.lower_where_predicate(predicate, &[], &mut dedup_map)),
);
hir::TestBinderBody { foralls, exists, constraints, predicates }
let span = self.lower_span(body.span);
hir::TestBinderBody { foralls, exists, constraints, predicates, span }
}

fn lower_test_binder_forall(
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_ast_passes/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1333,3 +1333,11 @@ pub(crate) struct AbiCustomCannotBeCold {
#[label("`extern \"custom\"` because of this")]
pub abi_span: Span,
}

#[derive(Diagnostic)]
#[diag("showing the spans of the {$kind}")]
pub(crate) struct ShowSpan {
#[primary_span]
pub span: Span,
pub kind: &'static str,
}
1 change: 1 addition & 0 deletions compiler/rustc_ast_passes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
pub mod ast_validation;
mod diagnostics;
pub mod feature_gate;
pub mod show_spans;
67 changes: 67 additions & 0 deletions compiler/rustc_ast_passes/src/show_spans.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
use rustc_ast::visit::{self, Visitor};
use rustc_ast::{self as ast, ItemKind};
use rustc_attr_ir::{Attribute, AttributeKind, RustcShowSpansKind};
use rustc_attr_parsing::AttributeParser;
use rustc_session::Session;
use rustc_span::sym;

use crate::diagnostics;

struct ShowSpans<'a> {
sess: &'a Session,
expr: bool,
ty: bool,
path: bool,
}

impl<'a> Visitor<'a> for ShowSpans<'a> {
fn visit_item(&mut self, item: &'a ast::Item) {
let saved = (self.expr, self.ty, self.path);
(self.expr, self.ty, self.path) = (false, false, false);

if let ItemKind::Fn(_) = &item.kind
&& let Some(Attribute::Parsed(AttributeKind::RustcShowSpans(kinds))) =
AttributeParser::parse_limited_sym(self.sess, &item.attrs, &[sym::rustc_show_spans])
{
for kind in kinds {
match kind {
RustcShowSpansKind::Expr => self.expr = true,
RustcShowSpansKind::Ty => self.ty = true,
RustcShowSpansKind::Path => self.path = true,
}
}
}
visit::walk_item(self, item);

// Recover the state. Needed if we are looking into nested items.
(self.expr, self.ty, self.path) = saved;
}

// We override it as to not report attribute paths as paths.
fn visit_attribute(&mut self, _: &'a ast::Attribute) {}

fn visit_expr(&mut self, e: &'a ast::Expr) {
if self.expr {
self.sess.dcx().emit_note(diagnostics::ShowSpan { span: e.span, kind: "expr" });
}
visit::walk_expr(self, e);
}

fn visit_ty(&mut self, t: &'a ast::Ty) {
if self.ty {
self.sess.dcx().emit_note(diagnostics::ShowSpan { span: t.span, kind: "ty" });
}
visit::walk_ty(self, t);
}

fn visit_path(&mut self, p: &'a ast::Path) {
if self.path {
self.sess.dcx().emit_note(diagnostics::ShowSpan { span: p.span, kind: "path" });
}
visit::walk_path(self, p);
}
}

pub fn check_crate(sess: &Session, krate: &ast::Crate) {
visit::walk_crate(&mut ShowSpans { sess, expr: false, ty: false, path: false }, krate);
}
10 changes: 10 additions & 0 deletions compiler/rustc_attr_ir/src/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,13 @@ impl<E: rustc_span::SpanEncoder> rustc_serialize::Encodable<E> for DocAttribute
}
}

#[derive(Clone, Debug, StableHash, Encodable, Decodable, PrintAttribute)]
pub enum RustcShowSpansKind {
Expr,
Ty,
Path,
}

#[derive(Clone, Debug, StableHash, Encodable, Decodable, PrintAttribute)]
pub enum RustcDumpLayoutKind {
Align,
Expand Down Expand Up @@ -1426,6 +1433,9 @@ pub enum AttributeKind {
/// Represents `#[rustc_should_not_be_called_on_const_items]`
RustcShouldNotBeCalledOnConstItems,

/// Represents `#[rustc_show_spans]`
RustcShowSpans(ThinVec<RustcShowSpansKind>),

/// Represents `#[rustc_simd_monomorphize_lane_limit = "N"]`.
RustcSimdMonomorphizeLaneLimit(Limit),

Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_attr_ir/src/encode_cross_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ impl AttributeKind {
RustcRegions => No,
RustcScalableVector { .. } => Yes,
RustcShouldNotBeCalledOnConstItems => Yes,
RustcShowSpans(_) => No,
RustcSimdMonomorphizeLaneLimit(..) => Yes, // Affects layout computation, which needs to work cross-crate
RustcSkipDuringMethodDispatch { .. } => No,
RustcSpecializationTrait => No,
Expand Down Expand Up @@ -405,6 +406,7 @@ impl AttributeKind {
RustcRegions => false,
RustcScalableVector { .. } => false,
RustcShouldNotBeCalledOnConstItems => false,
RustcShowSpans(_) => false,
RustcSimdMonomorphizeLaneLimit(..) => false,
RustcSkipDuringMethodDispatch { .. } => false,
RustcSpecializationTrait => false,
Expand Down
43 changes: 42 additions & 1 deletion compiler/rustc_attr_parsing/src/attributes/rustc_dump.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rustc_attr_ir::target::{AssocCtxt, MethodKind, Target};
use rustc_attr_ir::{AttributeKind, RustcDumpLayoutKind};
use rustc_attr_ir::{AttributeKind, RustcDumpLayoutKind, RustcShowSpansKind};
use rustc_feature::AttributeStability;
use rustc_span::{Span, Symbol, sym};

Expand Down Expand Up @@ -301,3 +301,44 @@ impl NoArgsAttributeParser for RustcDumpVtableParser {
const STABILITY: AttributeStability = unstable!(rustc_attrs);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcDumpVtable;
}

pub(crate) struct RustcShowSpans;

impl SingleAttributeParser for RustcShowSpans {
const PATH: &[Symbol] = &[sym::rustc_show_spans];

const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[Allow(Target::Fn)]);

const TEMPLATE: AttributeTemplate = template!(List: &["expr", "ty", "path"]);
const STABILITY: AttributeStability = unstable!(rustc_attrs);

fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option<AttributeKind> {
let Some(items) = cx.expect_list(args, cx.attr_span) else {
return None;
};

let mut result = ThinVec::new();
for item in items.mixed() {
let Some(arg) = item.meta_item_no_args() else {
cx.adcx().expected_not_literal(item.span());
continue;
};
let Some(ident) = arg.ident() else {
cx.adcx().expected_identifier(arg.span());
return None;
};
let kind = match ident.name {
sym::expr => RustcShowSpansKind::Expr,
sym::ty => RustcShowSpansKind::Ty,
sym::path => RustcShowSpansKind::Path,
_ => {
cx.adcx()
.expected_specific_argument(ident.span, &[sym::expr, sym::ty, sym::path]);
continue;
}
};
result.push(kind);
}
Some(AttributeKind::RustcShowSpans(result))
}
}
1 change: 1 addition & 0 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ attribute_parsers!(
Single<RustcObjcClassParser>,
Single<RustcObjcSelectorParser>,
Single<RustcScalableVectorParser>,
Single<RustcShowSpans>,
Single<RustcSimdMonomorphizeLaneLimitParser>,
Single<RustcSkipDuringMethodDispatchParser>,
Single<RustcTestMarkerParser>,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ pub static BUILTIN_ATTRIBUTES: &[Symbol] = &[
// Internal attributes, Testing:
// ==========================================================================

sym::rustc_show_spans,
sym::rustc_effective_visibility,
sym::rustc_dump_inferred_outlives,
sym::rustc_capture_analysis,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ declare_features! (
(incomplete, unsafe_fields, "1.85.0", Some(132922)),
/// Allows const generic parameters to be defined with types that
/// are not `Sized`, e.g. `fn foo<const N: [u8]>() {`.
(incomplete, unsized_const_params, "1.82.0", Some(95174)),
(incomplete, unsized_const_params, "1.82.0", Some(128028)),
/// Allows unsized fn parameters.
(internal, unsized_fn_params, "1.49.0", Some(48055)),
/// Allows using the `#[used(linker)]` (or `#[used(compiler)]`) attribute.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4530,6 +4530,7 @@ impl FnHeader {

#[derive(Debug, Clone, Copy, StableHash)]
pub struct TestBinderBody<'hir> {
pub span: Span,
pub foralls: &'hir [TestBinderForall<'hir>],
pub exists: &'hir [TestBinderExists<'hir>],
/// Constraints to be inserted directly into constraint storage to be proven
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,7 @@ pub fn walk_test_binder_body<'v, V: Visitor<'v>>(
visitor: &mut V,
body: &'v TestBinderBody<'v>,
) -> V::Result {
let TestBinderBody { foralls, exists, constraints, predicates } = body;
let TestBinderBody { span: _, foralls, exists, constraints, predicates } = body;
walk_list!(visitor, visit_test_binder_forall, *foralls);
walk_list!(visitor, visit_test_binder_exists, *exists);
try_visit!(visitor.visit_test_binder_constraint(&constraints));
Expand Down
14 changes: 13 additions & 1 deletion compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2380,7 +2380,7 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {

#[instrument(level = "debug", skip(self))]
pub(super) fn check_test_binder_body(&self, body: TestBinderBody<'tcx>) {
let TestBinderBody { foralls, exists, constraints, predicates } = body;
let TestBinderBody { span, foralls, exists, constraints, predicates } = body;
if !predicates.is_empty() {
for (predicate, span) in predicates {
let cause = traits::ObligationCause::misc(span, self.body_def_id);
Expand All @@ -2400,6 +2400,10 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
Ok(()) => constraints,
Err(_guar) => ty::region_constraint::RegionConstraint::new_true(),
};
if constraints.is_false() {
self.tcx().dcx().span_err(span, "top level false constraints are not supported");
return;
}

self.infcx.register_solver_region_constraint(constraints);

Expand Down Expand Up @@ -2479,6 +2483,13 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
u,
)
.with_spans(forall.span);
if constraint.is_false() {
self.tcx().dcx().span_err(forall.span, "forall evaluated to false");
self.infcx.overwrite_solver_region_constraint(
ty::region_constraint::RegionConstraint::new_true(),
);
return;
}
if let Some(assert_on_exit) = &forall.assert_on_exit {
self.check_test_binder_region_constraints(forall.span, assert_on_exit, &constraint);
}
Expand Down Expand Up @@ -2798,6 +2809,7 @@ struct RedundantLifetimeArgsLint<'tcx> {

#[derive(Clone, Debug, TypeFoldable, TypeVisitable)]
pub(crate) struct TestBinderBody<'tcx> {
pub span: Span,
pub foralls: Vec<TestBinderForall<'tcx>>,
pub exists: Vec<TestBinderExists<'tcx>>,
/// Constraints to be inserted directly into constraint storage to be proven
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ impl<'tcx> ItemCtxt<'tcx> {
&self,
item: &hir::TestBinderBody<'tcx>,
) -> TestBinderBody<'tcx> {
let hir::TestBinderBody { foralls, exists, constraints, predicates } = item;
let hir::TestBinderBody { span, foralls, exists, constraints, predicates } = item;
let foralls = foralls.iter().map(|forall| self.lower_test_binder_forall(forall)).collect();
let exists = exists.iter().map(|exists| self.lower_test_binder_exists(exists)).collect();
let constraints = self.lower_test_binder_constraint(&constraints);
Expand All @@ -337,7 +337,7 @@ impl<'tcx> ItemCtxt<'tcx> {
clauses_of::where_predicate_clauses(self, predicate, &mut clauses);
}
let predicates = clauses.into_iter().map(|(c, span)| (c.kind(), span)).collect();
TestBinderBody { foralls, exists, constraints, predicates }
TestBinderBody { span: *span, foralls, exists, constraints, predicates }
}

#[instrument(level = "debug", skip(self), ret)]
Expand Down
Loading
Loading