Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e3e4fed
Refactor pretty print comma_sep flag
teor2345 Jul 30, 2026
48f1386
Fix a splat legacy demangling bug, add extra tests
teor2345 Jul 28, 2026
5c8074f
Move rustfmt::skip to main in one test
teor2345 Jul 28, 2026
2fb58b9
Disentangle from rustc-demangle fix
teor2345 Sep 3, 2026
6850e56
Provide context of enclosing item on `self` that takes ownership
estebank Sep 26, 2026
1619367
Provide more trait/impl context
estebank Sep 26, 2026
94ece64
Point at trait on assoc item mismatch
estebank Sep 26, 2026
43f887c
remove redundant typing env constructions
adwinwhite Oct 9, 2026
faa2fd3
move bound variable index shifting into rustc_type_ir
amirHdev Oct 9, 2026
6b1236f
add regression test
39la Oct 9, 2026
04c10ba
libtest: UEFI targets do not support threads
Ayush1325 Oct 11, 2026
503129e
compiletest: Fix has_threads for uefi
Ayush1325 Oct 11, 2026
ad04476
bootstrap: Honor the target runner when running test-float-parse
mattst88 Sep 27, 2026
242437e
Update outdated `hir_attrs` doc
mejrs Oct 12, 2026
1fac212
fix expected output for x86-64-sysv64-arg-ext.apple.stderr
liza371 Oct 12, 2026
c9aa6d1
Remove the 'sup' method from 'At' and migrate to 'sup_raw'
fallible-algebra Oct 13, 2026
e1f6010
Apply suggestion from @lcnr
fallible-algebra Oct 13, 2026
6b27238
uplift bound variable replacement into rustc_type_ir
amirHdev Oct 12, 2026
ae85a2a
Use demand_suptype_diag instead
fallible-algebra Oct 13, 2026
90fbfef
Add transmutability test to cover for superseded PR
lsunsi Oct 13, 2026
36840af
rename `with_post_analysis_normalized`
adwinwhite Oct 9, 2026
97f64e1
bootstrap: Let test-float-parse follow --target
mattst88 Sep 27, 2026
8def69b
convert non-generic diagnostic attribute placeholders to snake_case
mejrs Oct 13, 2026
fbf53be
Test the interaction between `--remap-path-prefix` and doctests
Urgau Oct 12, 2026
3adf204
Rollup merge of #164040 - amirHdev:uplift-bound-var-index-shifter, r=…
JonathanBrouwer Oct 13, 2026
81e7a15
Rollup merge of #162934 - mattst88:test-float-parse-target, r=Kobzol
JonathanBrouwer Oct 13, 2026
eb44ee3
Rollup merge of #164269 - mejrs:snake_case_placeholders, r=mu001999
JonathanBrouwer Oct 13, 2026
7527b5b
Rollup merge of #160050 - teor2345:splat-legacy-demangle, r=camelid
JonathanBrouwer Oct 13, 2026
069d0c8
Rollup merge of #163383 - estebank:trait-n-impl-context-move, r=camelid
JonathanBrouwer Oct 13, 2026
b8d8e46
Rollup merge of #164023 - adwinwhite:env_clean, r=lcnr
JonathanBrouwer Oct 13, 2026
30914fd
Rollup merge of #164041 - 39la:test/dead-code-issue-142541, r=camelid
JonathanBrouwer Oct 13, 2026
5643662
Rollup merge of #164166 - Ayush1325:uefi-tests, r=joboet
JonathanBrouwer Oct 13, 2026
44b135b
Rollup merge of #164220 - Urgau:remap-path-prefix-doctest-panic, r=Gu…
JonathanBrouwer Oct 13, 2026
d2dce07
Rollup merge of #164229 - mejrs:hir_attrs_doc, r=beetrees
JonathanBrouwer Oct 13, 2026
1aaed2b
Rollup merge of #164244 - fallible-algebra:at-removal/remove-sup, r=lcnr
JonathanBrouwer Oct 13, 2026
4656c19
Rollup merge of #164257 - lsunsi:pull149228, r=ShoyuVanilla
JonathanBrouwer Oct 13, 2026
f744455
Rollup merge of #164263 - liza371:fix-x86-64-apple, r=lqd
JonathanBrouwer Oct 13, 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
8 changes: 4 additions & 4 deletions compiler/rustc_attr_ir/src/attribute_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,11 @@ const _: () = ();
/// positional and listed parameters are not accepted.
/// The following parameter names are valid:
/// - `Self` and all generic parameters of the trait.
/// - `This`: the name of the trait the attribute is on, without generics.
/// - `This:path`: the full path of the trait the attribute is on, with unresolved generics.
/// - `This:resolved`: the full path of the trait the attribute is on, with resolved generics.
/// - `this`: the name of the trait the attribute is on, without generics.
/// - `this:path`: the full path of the trait the attribute is on, with unresolved generics.
/// - `this:resolved`: the full path of the trait the attribute is on, with resolved generics.
/// Additionally, this will "sugar" the `Fn(...)` traits.
/// - `ItemContext`: the kind of `hir::Node` we're in, things like `"an async block"`,
/// - `item_context`: the kind of `hir::Node` we're in, things like `"an async block"`,
/// `"a function"`, `"an async function"`, etc.
///
#[doc = include_example!("rustc_on_unimplemented_format")]
Expand Down
18 changes: 9 additions & 9 deletions compiler/rustc_attr_ir/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,22 +237,22 @@ pub enum FormatArg {
},
// `{Self}`
SelfUpper,
/// `{This}` and `{This:name}`.
/// `{this}` and `{this:name}`.
This,
/// The sugared form: `{This:sugared}`.
/// The sugared form: `{this:resolved}`.
ThisResolved,
/// The full path: `{This:path}`.
/// The full path: `{this:path}`.
ThisPath,
/// what we're in, like a function, method, closure etc.
/// What we're in, like a function, method, closure etc. Used via `{item_context}`.
ItemContext,
/// What the user typed, if it doesn't match anything we can use.
AsIs(Symbol),
/// {Found} in diagnostic::on_type_error
/// {found} in diagnostic::on_type_error
Found,
/// {Expected} in diagnostic::on_type_error
/// {expected} in diagnostic::on_type_error
Expected,
/// {Unresolved} in diagnostic::on_unknown
/// {unresolved} in diagnostic::on_unknown
Unresolved,
/// What the user typed, if it doesn't match anything we can use.
AsIs(Symbol),
}

/// Represents the `on` filter in `#[rustc_on_unimplemented]`.
Expand Down
24 changes: 12 additions & 12 deletions compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ impl Mode {
"only `Self` and generics of the implementation are allowed as a format argument"
}
Self::DiagnosticOnMove => {
"only `This`, `Self` and generics of the type are allowed as a format argument"
"only `this`, `Self` and generics of the type are allowed as a format argument"
}
Self::DiagnosticOnUnknown => {
"only `This` is allowed as a format argument, referring to the failed import"
"only `this` is allowed as a format argument, referring to the failed import"
}
Self::DiagnosticOnUnmatchedArgs => {
"only `This` is allowed as a format argument, referring to the macro's name"
"only `this` is allowed as a format argument, referring to the macro's name"
}
Self::DiagnosticOnTypeError => {
"only `note` is allowed as option for `diagnostic::on_type_error`"
Expand Down Expand Up @@ -515,10 +515,10 @@ fn parse_arg(
let ret = match arg.position {
// Something like "hello {name}"
Position::ArgumentNamed(name) => match (mode, Symbol::intern(name)) {
(Mode::RustcOnUnimplemented, sym::ItemContext) => FormatArg::ItemContext,
(Mode::RustcOnUnimplemented, sym::item_context) => FormatArg::ItemContext,

// `{This:ty}`
(Mode::RustcOnUnimplemented, sym::This) => match arg.format.ty {
// `{this:ty}`
(Mode::RustcOnUnimplemented, sym::this) => match arg.format.ty {
"resolved" => {
check_format = false;
FormatArg::ThisResolved
Expand All @@ -530,11 +530,11 @@ fn parse_arg(
_ => FormatArg::This,
},

(Mode::DiagnosticOnTypeError, sym::Found) => FormatArg::Found,
(Mode::DiagnosticOnTypeError, sym::Expected) => FormatArg::Expected,
(Mode::DiagnosticOnUnknown, sym::Unresolved) => FormatArg::Unresolved,
(Mode::DiagnosticOnTypeError, sym::found) => FormatArg::Found,
(Mode::DiagnosticOnTypeError, sym::expected) => FormatArg::Expected,
(Mode::DiagnosticOnUnknown, sym::unresolved) => FormatArg::Unresolved,

// Some diagnostic attributes can use `{This}` to refer to the annotated item.
// Some diagnostic attributes can use `{this}` to refer to the annotated item.
// For those that don't, we continue and maybe use it as a generic parameter.
//
// FIXME(mejrs) `DiagnosticOnUnimplemented` is intentionally not here;
Expand All @@ -544,13 +544,13 @@ fn parse_arg(
| Mode::DiagnosticOnMove
| Mode::DiagnosticOnUnmatchedArgs
| Mode::DiagnosticOnTypeError,
sym::This,
sym::this,
) => FormatArg::This,

// `{Self}`; the self type.
// - For trait declaration attributes that's the type that does not implement it.
// - for trait impl attributes, the implemented for type.
// - For ADT attributes, that's the type (which will be identical to `{This}`)
// - For ADT attributes, that's the type (which will be identical to `{this}`)
// - For everything else it doesn't make sense.
(
Mode::RustcOnUnimplemented
Expand Down
7 changes: 5 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1361,18 +1361,21 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
);

let func = with_no_trimmed_paths!(tcx.def_path_str(method_did));
let mut span: MultiSpan = self_arg.span.into();
span.push_span_context(tcx.def_span(method_did).shrink_to_lo());
span.push_span_context(tcx.def_span(tcx.parent(method_did)).shrink_to_lo());
if let Some((kind, _)) = desugaring {
err.subdiagnostic(CaptureReasonNote::DesugaringFuncTakeSelf {
func,
desugar_name: kind.name(),
place_name: place_name.clone(),
span: self_arg.span,
span,
});
} else {
err.subdiagnostic(CaptureReasonNote::FuncTakeSelf {
func,
place_name: place_name.clone(),
span: self_arg.span,
span,
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ pub(crate) enum CaptureReasonNote {
func: String,
place_name: String,
#[primary_span]
span: Span,
span: MultiSpan,
},
#[note(
"the {$desugar_name} is desugared into a call to `{$func}`, which takes ownership of the \
Expand All @@ -539,7 +539,7 @@ pub(crate) enum CaptureReasonNote {
func: String,
place_name: String,
#[primary_span]
span: Span,
span: MultiSpan,
},
}

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,7 @@ pub(crate) fn check_trait(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), Err
E0714,
"marker traits cannot have associated items",
)
.with_span_context(tcx.def_span(def_id))
.emit();
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub(crate) struct AssocKindMismatch {
pub expected_because_label: Option<Span>,
pub assoc_kind: &'static str,
#[note("the associated {$assoc_kind} is defined here")]
pub def_span: Span,
pub def_span: MultiSpan,
#[label("bounds are not allowed on associated constants")]
pub bound_on_assoc_const_label: Option<Span>,
#[subdiagnostic]
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
} else {
(ident.span, None, assoc_tag, assoc_item.tag())
};
let mut def_span: MultiSpan = tcx.def_span(assoc_item.def_id).into();
def_span.push_span_context(tcx.def_span(tcx.parent(assoc_item.def_id)));

let def_kind = tcx.def_kind(self.item_def_id());
let item_span = tcx.def_span(self.item_def_id()).shrink_to_lo();
Expand Down Expand Up @@ -423,7 +425,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
got: assoc_tag_str(got),
expected_because_label,
assoc_kind: assoc_tag_str(assoc_item.tag()),
def_span: tcx.def_span(assoc_item.def_id),
def_span,
bound_on_assoc_const_label,
wrap_in_braces_sugg,
})
Expand Down
11 changes: 9 additions & 2 deletions compiler/rustc_hir_typeck/src/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
call_expr.span,
ObligationCauseCode::WellFormed(WellFormedLoc::HirId(call_expr.hir_id)),
);
// FIXME: This needs to happen in a `probe` as the `sup`
// call can currently guide type inference.
if self
.at(&cause, self.param_env)
.sup(DefineOpaqueTypes::Yes, formal_input_tys[0], adjusted_arg_type)
.sup_raw(
&cause,
self.param_env,
DefineOpaqueTypes::Yes,
formal_input_tys[0],
adjusted_arg_type,
)
.is_err()
{
return do_check();
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
let res = if self.use_lub {
at.lub(b, a)
} else {
at.sup(DefineOpaqueTypes::Yes, b, a)
self.sup_raw(&self.cause, self.param_env, DefineOpaqueTypes::Yes, b, a)
.map(|InferOk { value: (), obligations }| InferOk { value: b, obligations })
};

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_hir_typeck/src/demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
expected: Ty<'tcx>,
actual: Ty<'tcx>,
) -> Result<(), Diag<'a>> {
self.at(cause, self.param_env)
.sup(DefineOpaqueTypes::Yes, expected, actual)
self.sup_raw(cause, self.param_env, DefineOpaqueTypes::Yes, expected, actual)
.map(|infer_ok| self.register_infer_ok_obligations(infer_ok))
.map_err(|e| {
self.err_ctxt().report_mismatched_types(cause, self.param_env, expected, actual, e)
Expand Down
27 changes: 5 additions & 22 deletions compiler/rustc_hir_typeck/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use rustc_hir::def_id::DefId;
use rustc_hir::{ExprKind, HirId, QPath, is_range_literal};
use rustc_hir_analysis::diagnostics::{NoFieldOnType, NoVariantNamed};
use rustc_hir_analysis::hir_ty_lowering::HirTyLowerer as _;
use rustc_infer::infer::{self, DefineOpaqueTypes, InferOk, RegionVariableOrigin};
use rustc_infer::infer::{self, RegionVariableOrigin};
use rustc_infer::traits::WellFormedLoc;
use rustc_infer::traits::query::NoSolution;
use rustc_middle::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase};
Expand Down Expand Up @@ -2118,27 +2118,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let Some(_) = remaining_fields.remove(&ident) {
let target_ty = self.field_ty(base_expr.span, f, args);
let cause = self.misc(base_expr.span);
match self.at(&cause, self.param_env).sup(
// We're already using inference variables for any params,
// and don't allow converting between different structs,
// so there is no way this ever actually defines an opaque
// type. Thus choosing `Yes` is fine.
DefineOpaqueTypes::Yes,
target_ty,
fru_ty,
) {
Ok(InferOk { obligations, value: () }) => {
self.register_predicates(obligations)
}
Err(_) => {
span_bug!(
cause.span,
"subtyping remaining fields of type changing FRU \
failed: {target_ty} != {fru_ty}: {}::{}",
variant.name,
ident.name,
);
}
if let Err(diag) =
self.demand_suptype_diag(cause.span, target_ty, fru_ty)
{
diag.delay_as_bug();
}
}
self.deeply_resolve_ignoring_regions(fru_ty)
Expand Down
11 changes: 8 additions & 3 deletions compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3263,9 +3263,14 @@ impl<'a, 'tcx> ArgMatchingCtxt<'a, 'tcx> {

// Using probe here, since we don't want this subtyping to affect inference.
let subtyping_error = self.probe(|_| {
self.at(&self.misc(arg_span), self.param_env)
.sup(DefineOpaqueTypes::Yes, formal_input_ty, coerced_ty)
.err()
self.sup_raw(
&self.misc(arg_span),
self.param_env,
DefineOpaqueTypes::Yes,
formal_input_ty,
coerced_ty,
)
.err()
});

// Same as above: if either the coerce type or the checked type is an error type,
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_hir_typeck/src/method/confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,8 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
self_ty, method_self_ty, self.span, pick
);
let cause = self.cause(self.self_expr.span, ObligationCauseCode::Misc);
match self.at(&cause, self.param_env).sup(DefineOpaqueTypes::Yes, method_self_ty, self_ty) {
match self.sup_raw(&cause, self.param_env, DefineOpaqueTypes::Yes, method_self_ty, self_ty)
{
Ok(InferOk { obligations, value: () }) => {
self.register_predicates(obligations);
}
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
self.xform_self_ty(candidate.item, trait_ref.self_ty(), trait_ref.args);
// Guide the trait selection to show impls that have methods whose type matches
// up with the `self` parameter of the method.
let _ = self.at(&ObligationCause::dummy(), self.param_env).sup(
let _ = self.sup_raw(
&ObligationCause::dummy(),
self.param_env,
DefineOpaqueTypes::Yes,
xform_self_ty,
self_ty,
Expand Down
Loading
Loading