Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
b9a8c80
Add regression test for impossible dyn Sized predicate
qaijuang May 15, 2026
2df8f1f
Consider structurally impossible Sized predicates
qaijuang May 15, 2026
f86ad47
isolate regression test
qaijuang Jun 9, 2026
9b0094e
Add supplementary information for as_uninit_mut
yilin0518 Jul 5, 2026
fcb4680
split out suggestion generation for type hints into a separate function
WaffleLapkin Jun 26, 2026
7517333
merge `SourceKindSubdiag` and `SourceKindMultiSuggestion`
WaffleLapkin Jul 3, 2026
5f4114c
Expose more info about ADTs and functions in rustc_public
erickt Jun 12, 2026
8fb83ab
place FnDef behind a binder, instantiate w/ Dummy
Jun 17, 2026
b994cba
doc: clarify attr parser APIs
kn1g78 Jul 11, 2026
e9273fc
Support `#[track_caller]` on EII declarations
cezarbbb Jun 29, 2026
b9b9d41
Update compiler to rustc-demangle 1.2.8
teor2345 Jul 13, 2026
f802a87
Update library to rustc-demangle 1.2.8
teor2345 Jul 13, 2026
82f4112
Update tools to rustc-demangle 1.2.8
teor2345 Jul 13, 2026
2e978ac
don't allow todo!() macro in tidy
jdonszelmann Jun 10, 2026
91311ae
Fixup all current uses of `todo!()` in the compiler
jdonszelmann Jun 10, 2026
d8eb2f5
Fixup all current uses of `todo!()` in std
jdonszelmann Jun 10, 2026
44fc3c6
Fixup all current uses of `todo!()` in rustdoc
jdonszelmann Jun 10, 2026
e8ead57
implement tidy ignores for a single line
jdonszelmann Jun 12, 2026
f4a50a6
show line numbers for unnecessary ignores
jdonszelmann Jun 29, 2026
0e47821
Better way to check bad directives
jdonszelmann Jun 30, 2026
d27b4d6
fix match_ignore check
jdonszelmann Jun 30, 2026
8581e88
make odd_backticks apply to the next blockcomment instead of just line
jdonszelmann Jun 30, 2026
e0f9f8c
introduce a test entrypoint marker for tools
jdonszelmann Jun 18, 2026
25745ee
fix all tidy annotations
jdonszelmann Jun 30, 2026
bdc1397
bless tests
jdonszelmann Jul 2, 2026
4a92ee0
add `NamedDirective` to keep track of error messages per-directive
jdonszelmann Jul 7, 2026
8c0439d
add tidy self tests for style
jdonszelmann Jul 7, 2026
0b76cd3
add ignore-tidy-all
jdonszelmann Jul 7, 2026
6f522b4
fix alphabetical
jdonszelmann Jul 7, 2026
ea03e5c
some more review feedback (don't want to squash, history is messed up…
jdonszelmann Jul 7, 2026
01f0ad1
add regression test for impossible dyn Sized predicate
TaKO8Ki Jul 13, 2026
bd4d8f6
simplify ast validation struct visiting
oli-obk May 13, 2026
5d41744
consider structurally impossible Sized predicates in MIR
TaKO8Ki Jul 13, 2026
d873077
add test
jdonszelmann Jul 6, 2026
843639b
bless existing tests
jdonszelmann Jul 6, 2026
74208da
Combine `sourceKindSubdiag::Generic*` into one variant
WaffleLapkin Jul 4, 2026
50d233d
need type info: only allow 0-1 subdiagnostic
WaffleLapkin Jul 4, 2026
979a7e4
move `TypeErrCtxt::suggesion` to `InferSourceKind`
WaffleLapkin Jul 4, 2026
4706067
decouple `InferSourceKind::suggesion` from `TypeErrCtxt`
WaffleLapkin Jul 4, 2026
a991824
remove `#![allow(incomplete_features)]`
TaKO8Ki Jul 13, 2026
03afa49
Use shorter borrows for `FnKind`
oli-obk Apr 21, 2026
d61f033
Fix unused variable warnings for diverging expressions
chenyukang Jul 13, 2026
490097d
Rollup merge of #157706 - jdonszelmann:deny-todo, r=wafflelapkin
JonathanBrouwer Jul 13, 2026
153165d
Rollup merge of #158535 - cezarbbb:eii-track-caller, r=bjorn3
JonathanBrouwer Jul 13, 2026
3bb66d7
Rollup merge of #158632 - addiesh:superfisher, r=oli-obk
JonathanBrouwer Jul 13, 2026
a1855a2
Rollup merge of #158846 - chenyukang:yukang-fix-158783-unused-never-b…
JonathanBrouwer Jul 13, 2026
3bd0126
Rollup merge of #159002 - WaffleLapkin:need_type_info_refactors, r=lcnr
JonathanBrouwer Jul 13, 2026
95dfc7e
Rollup merge of #159202 - teor2345:bump-rustc-demangle, r=Mark-Simula…
JonathanBrouwer Jul 13, 2026
256bcb8
Rollup merge of #159216 - TaKO8Ki:delegation-probe-self-ty, r=petroch…
JonathanBrouwer Jul 13, 2026
3198c7a
Rollup merge of #156609 - qaijuang:mir-opt-impossible-sized-predicate…
JonathanBrouwer Jul 13, 2026
c6e5644
Rollup merge of #157993 - erickt:rustc-public, r=makai410
JonathanBrouwer Jul 13, 2026
1bce978
Rollup merge of #158804 - yilin0518:fix_as_uninit_mut, r=LawnGnome
JonathanBrouwer Jul 13, 2026
aa45526
Rollup merge of #158854 - jdonszelmann:test-entrypoint, r=jonathanbro…
JonathanBrouwer Jul 13, 2026
34d04a5
Rollup merge of #158998 - oli-obk:mut_ast_valid, r=petrochenkov
JonathanBrouwer Jul 13, 2026
768fb02
Rollup merge of #159123 - kn1g78:doc/attr-parser-api, r=mejrs
JonathanBrouwer Jul 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3570,9 +3570,9 @@ dependencies = [

[[package]]
name = "rustc-demangle"
version = "0.1.27"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d"
checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb"

[[package]]
name = "rustc-hash"
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ macro_rules! common_visitor_and_walkers {
Closure(&'a $($mut)? ClosureBinder, &'a $($mut)? Option<CoroutineKind>, &'a $($mut)? Box<FnDecl>, &'a $($mut)? Box<Expr>),
}

impl<'a> FnKind<'a> {
impl<'a> FnKind<'_> {
pub fn header(&'a $($mut)? self) -> Option<&'a $($mut)? FnHeader> {
match *self {
FnKind::Fn(_, _, Fn { sig, .. }) => Some(&$($mut)? sig.header),
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_ast_lowering/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ pub(crate) struct MatchArmWithNoBody {
pub span: Span,
#[suggestion(
"add a body after the pattern",
// ignore-tidy-todo
code = " => todo!(),",
applicability = "has-placeholders"
)]
Expand Down
22 changes: 4 additions & 18 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,7 @@ impl Visitor<'_> for AstValidator<'_> {
}
visit::walk_item(self, item)
}
ItemKind::Struct(ident, generics, vdata) => {
ItemKind::Struct(.., vdata) => {
self.with_tilde_const(Some(TildeConstReason::Struct { span: item.span }), |this| {
// Scalable vectors can only be tuple structs
let scalable_vector_attr =
Expand All @@ -1536,29 +1536,15 @@ impl Visitor<'_> for AstValidator<'_> {
}
}

match vdata {
VariantData::Struct { fields, .. } => {
this.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
this.visit_generics(generics);
walk_list!(this, visit_field_def, fields);
}
_ => visit::walk_item(this, item),
}
visit::walk_item(this, item);
})
}
ItemKind::Union(ident, generics, vdata) => {
ItemKind::Union(.., vdata) => {
if vdata.fields().is_empty() {
self.dcx().emit_err(diagnostics::FieldlessUnion { span: item.span });
}
self.with_tilde_const(Some(TildeConstReason::Union { span: item.span }), |this| {
match vdata {
VariantData::Struct { fields, .. } => {
this.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
this.visit_generics(generics);
walk_list!(this, visit_field_def, fields);
}
_ => visit::walk_item(this, item),
}
visit::walk_item(this, item)
});
}
ItemKind::Const(ConstItem { defaultness, ident, rhs_kind, .. }) => {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_ast_passes/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ pub(crate) struct MatchArmWithNoBody {
// resulting code to be correct.
#[suggestion(
"add a body after the pattern",
// ignore-tidy-todo
code = " => {{ todo!() }}",
applicability = "has-placeholders",
style = "verbose"
Expand Down
11 changes: 11 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/test_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,14 @@ impl SingleAttributeParser for RustcTestMarkerParser {
Some(AttributeKind::RustcTestMarker(value_str))
}
}

pub(crate) struct RustcTestEntrypointMarkerParser;

impl NoArgsAttributeParser for RustcTestEntrypointMarkerParser {
const PATH: &[Symbol] = &[sym::rustc_test_entrypoint_marker];
const ALLOWED_TARGETS: AllowedTargets<'_> =
AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::Closure)]);
const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn;
const STABILITY: AttributeStability = unstable!(rustc_attrs);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcTestEntrypointMarker;
}
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 @@ -328,6 +328,7 @@ attribute_parsers!(
Single<WithoutArgs<RustcSpecializationTraitParser>>,
Single<WithoutArgs<RustcStdInternalSymbolParser>>,
Single<WithoutArgs<RustcStrictCoherenceParser>>,
Single<WithoutArgs<RustcTestEntrypointMarkerParser>>,
Single<WithoutArgs<RustcTrivialFieldReadsParser>>,
Single<WithoutArgs<RustcUnsafeSpecializationMarkerParser>>,
Single<WithoutArgs<SplatParser>>,
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_attr_parsing/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,13 @@ impl MetaItemOrLitParser {
}
}

// FIXME(scrabsha): once #155696 is merged, update this and mention the higher-level APIs.
/// Utility that deconstructs a MetaItem into usable parts.
///
/// MetaItems are syntactically extremely flexible, but specific attributes want to parse
/// them in custom, more restricted ways. This can be done using this struct.
/// them in custom, more restricted ways. For common argument shapes, prefer the higher-level
/// [`AcceptContext::expect_list`](crate::context::AcceptContext::expect_list) and
/// [`AcceptContext::expect_single`](crate::context::AcceptContext::expect_single) helpers.
/// Use this struct when parsing a custom restricted syntax.
///
/// MetaItems consist of some path, and some args. The args could be empty. In other words:
///
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore-tidy-filelength
// ignore-tidy-file-filelength

use std::iter;
use std::ops::ControlFlow;
Expand Down Expand Up @@ -681,7 +681,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
hir::ExprKind::Call(callee, _)
if let &ty::FnDef(_, args) = typeck.node_type(callee.hir_id).kind() =>
{
args
args.no_bound_vars().unwrap()
}
_ => return None,
};
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,8 @@ impl<'tcx> BorrowedContentSource<'tcx> {
ty::FnDef(def_id, args) => {
let trait_id = tcx.trait_of_assoc(def_id)?;

let args = args.no_bound_vars().unwrap();

if tcx.is_lang_item(trait_id, LangItem::Deref)
|| tcx.is_lang_item(trait_id, LangItem::DerefMut)
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/move_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
hir::ExprKind::Call(callee, _) => {
let ty = typeck_result.node_type_opt(callee.hir_id)?;
let ty::FnDef(fn_def_id, args) = *ty.kind() else { return None };
tcx.predicates_of(fn_def_id).instantiate(tcx, args)
tcx.predicates_of(fn_def_id).instantiate(tcx, args.no_bound_vars().unwrap())
}
hir::ExprKind::MethodCall(..) => {
let (_, method) = typeck_result.type_dependent_def(parent.hir_id)?;
Expand Down
10 changes: 8 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
typeck_results.node_type_opt(expr.hir_id).as_ref().map(|ty| ty.kind())
{
let arg_pos = args.iter().position(|arg| arg.hir_id == closure_id)?;
Some((*def_id, expr.span, arg_pos, arg_pos, generic_args))
Some((
*def_id,
expr.span,
arg_pos,
arg_pos,
generic_args.no_bound_vars().unwrap(),
))
} else {
None
}
Expand Down Expand Up @@ -1914,7 +1920,7 @@ fn suggest_ampmut<'tcx>(
let trait_ref = ty::TraitRef::from_assoc(
tcx,
tcx.require_lang_item(hir::LangItem::IndexMut, rhs_span),
method_args,
method_args.no_bound_vars().unwrap(),
);
// The type only implements `Index` but not `IndexMut`, we must not suggest `&mut`.
if !infcx
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
tcx,
self.infcx.typing_env(self.infcx.param_env),
fn_did,
self.infcx.resolve_vars_if_possible(args),
self.infcx.resolve_vars_if_possible(args.no_bound_vars().unwrap()),
) else {
return;
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/places_conflict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ fn place_projection_conflict<'tcx>(
),

(ProjectionElem::UnwrapUnsafeBinder(_), _) => {
todo!()
unimplemented!()
}
}
}
1 change: 1 addition & 0 deletions compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1830,6 +1830,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
}

if let ty::FnDef(def_id, args) = *constant.const_.ty().kind() {
let args = args.no_bound_vars().unwrap();
let instantiated_predicates = tcx.predicates_of(def_id).instantiate(tcx, args);
self.normalize_and_prove_instantiated_predicates(
def_id,
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_borrowck/src/universal_regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ impl<'tcx> UniversalRegions<'tcx> {
});
}
DefiningTy::CoroutineClosure(..) => {
todo!()
unimplemented!()
}
DefiningTy::Coroutine(def_id, args) => {
let v = with_no_trimmed_paths!(
Expand Down Expand Up @@ -603,7 +603,9 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
ty::CoroutineClosure(def_id, args) => {
DefiningTy::CoroutineClosure(def_id, args)
}
ty::FnDef(def_id, args) => DefiningTy::FnDef(def_id, args),
ty::FnDef(def_id, args) => {
DefiningTy::FnDef(def_id, args.no_bound_vars().unwrap())
}
_ => span_bug!(
tcx.def_span(self.mir_def),
"expected defining type for `{:?}`: `{:?}`",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/autodiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ mod llvm_enzyme {
.iter()
.map(|arg| match arg.pat.kind {
PatKind::Ident(_, ident, _) => ecx.expr_path(ecx.path_ident(span, ident)),
_ => todo!(),
_ => unimplemented!(),
})
.collect::<ThinVec<_>>(),
);
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_builtin_macros/src/eii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ fn split_attrs(
foreign_item_attributes.push(attr.clone());
macro_attributes.push(attr);
}
// `#[track_caller]` goes on the foreign item only: it's the symbol callers link
// against, so it must carry the flag for call sites to pass the caller location.
// Implementations derive it during codegen (see `EiiImpls` in `codegen_attrs.rs`),
// so it must not be routed onto the default impl here.
Some(sym::track_caller) => {
foreign_item_attributes.push(attr);
}
// Doc attributes should be forwarded to the macro and the foreign item, since those are
// the two items you interact with as a user.
// FIXME: idk yet how EIIs show up in docs, might want to customize
Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_builtin_macros/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ use crate::util::{check_builtin_macro_attribute, warn_on_duplicate_attribute};
///
/// We mark item with an inert attribute "rustc_test_marker" which the test generation
/// logic will pick up on.
///
/// The test function also gains a `#[rustc_test_entrypoint_marker]` attribute for tools to pick up
/// on. This behavior is *unstable*.
pub(crate) fn expand_test_case(
ecx: &mut ExtCtxt<'_>,
attr_sp: Span,
Expand Down Expand Up @@ -377,6 +380,12 @@ pub(crate) fn expand_test_or_bench(
let test_extern =
cx.item(sp, ast::AttrVec::new(), ast::ItemKind::ExternCrate(None, test_ident));

let item = {
let mut item = item;
item.attrs.push(cx.attr_word(sym::rustc_test_entrypoint_marker, attr_sp));
item
};

debug!("synthetic test item:\n{}\n", pprust::item_to_string(&test_const));

if is_stmt {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
fx.tcx,
ty::TypingEnv::fully_monomorphized(),
def_id,
fn_args,
fn_args.no_bound_vars().unwrap(),
source_info.span,
);

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
fx.tcx,
ty::TypingEnv::fully_monomorphized(),
def_id,
args,
args.no_bound_vars().unwrap(),
)
.unwrap(),
);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/inline_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>(
fx.tcx,
ty::TypingEnv::fully_monomorphized(),
def_id,
args,
args.no_bound_vars().unwrap(),
)
.unwrap();
let symbol = fx.tcx.symbol_name(instance);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ libc = "0.2"
libloading = { version = "0.9.0" }
measureme = "12.0.1"
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
rustc-demangle = "0.1.21"
rustc-demangle = "0.1.28"
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
let fn_ty = instance.ty(tcx, self.typing_env());
let fn_sig = match *fn_ty.kind() {
ty::FnDef(def_id, args) => tcx.instantiate_bound_regions_with_erased(
tcx.fn_sig(def_id).instantiate(tcx, args).skip_norm_wip(),
tcx.fn_sig(def_id).instantiate(tcx, args.no_bound_vars().unwrap()).skip_norm_wip(),
),
_ => unreachable!(),
};
Expand Down Expand Up @@ -1762,7 +1762,7 @@ fn codegen_autodiff<'ll, 'tcx>(
let fn_to_diff = args[0].immediate();

let (diff_id, diff_args) = match fn_args.into_type_list(tcx)[1].kind() {
ty::FnDef(def_id, diff_args) => (def_id, diff_args),
ty::FnDef(def_id, diff_args) => (def_id, diff_args.no_bound_vars().unwrap()),
_ => bug!("invalid args"),
};

Expand Down Expand Up @@ -1825,7 +1825,7 @@ fn codegen_offload<'ll, 'tcx>(
let fn_args = instance.args;

let (target_id, target_args) = match fn_args.into_type_list(tcx)[0].kind() {
ty::FnDef(def_id, params) => (def_id, params),
ty::FnDef(def_id, params) => (def_id, params.no_bound_vars().unwrap()),
_ => bug!("invalid offload intrinsic arg"),
};

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ where
cx.tcx(),
ty::TypingEnv::fully_monomorphized(),
def_id,
args,
args.no_bound_vars().unwrap(),
expr.span,
),
_ => span_bug!(*op_sp, "asm sym is not a function"),
Expand Down
12 changes: 12 additions & 0 deletions compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,18 @@ fn process_builtin_attrs(
Visibility::Default,
));
codegen_fn_attrs.flags |= CodegenFnAttrFlags::EXTERNALLY_IMPLEMENTABLE_ITEM;

// If the declaration is `#[track_caller]`, derive it onto the implementation
// too. The shim that forwards to this impl (see `add_function_aliases`) takes
// its ABI from the impl's `fn_abi`, so every impl must agree on whether the
// caller-location argument is present, otherwise it would be silently dropped.
if tcx
.codegen_fn_attrs(foreign_item)
.flags
.contains(CodegenFnAttrFlags::TRACK_CALLER)
{
codegen_fn_attrs.flags |= CodegenFnAttrFlags::TRACK_CALLER;
}
}
}
AttributeKind::ThreadLocal => {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
bx.tcx(),
bx.typing_env(),
def_id,
generic_args,
generic_args.no_bound_vars().unwrap(),
fn_span,
);

Expand Down Expand Up @@ -1098,7 +1098,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
bx.tcx(),
bx.typing_env(),
def_id,
generic_args,
generic_args.no_bound_vars().unwrap(),
)
.unwrap();

Expand Down Expand Up @@ -1486,7 +1486,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
bx.tcx(),
bx.typing_env(),
def_id,
args,
args.no_bound_vars().unwrap(),
)
.unwrap();
InlineAsmOperandRef::SymFn { instance }
Expand Down
Loading
Loading