8000 Rollup of 11 pull requests by GuillaumeGomez · Pull Request #140682 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 11 pull requests #140682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
11cfc16
mir-opt: Use one MirPatch in MatchBranchSimplification
dianqk Apr 20, 2025
5881b7c
mir-opt: execute MatchBranchSimplification after GVN
dianqk Apr 21, 2025
8290766
bypass linker configuration and cross target check on `x check`
onur-ozkan Apr 27, 2025
7669d50
add a FIXME
onur-ozkan Apr 28, 2025
6970813
Use less rustc_type_ir in the compiler codebase
rperier May 1, 2025
d0216b5
`fn check_opaque_type_parameter_valid` defer error
lcnr May 3, 2025
de44231
implement `PanicTracker` to track `t` panics
onur-ozkan May 4, 2025
a8f7fd1
update `cc_detect` tests
onur-ozkan May 5, 2025
4b58c50
Make -Zfixed-x18 into a target modifier
Darksonn May 5, 2025
3a1ee64
Resolve instance for SymFn in global/naked asm
compiler-errors Apr 27, 2025
833c212
Rename Instance::new to Instance::new_raw and add a note that it is raw
compiler-errors Apr 28, 2025
29f9aaf
calculate step duration in a panic-safe way
onur-ozkan May 5, 2025
12d3021
Deeply normalize in the new solver in WF
compiler-errors May 5, 2025
8723871
Update books
rustbot May 5, 2025
677a5ac
Rollup merge of #140080 - dianqk:one-mirpatch, r=oli-obk
GuillaumeGomez May 5, 2025
ab7623e
Rollup merge of #140115 - dianqk:gvn-matchbr, r=oli-obk
GuillaumeGomez May 5, 2025
246acdb
Rollup merge of #140357 - onur-ozkan:133840, r=clubby789
GuillaumeGomez May 5, 2025
1e90557
Rollup merge of #140374 - compiler-errors:global_asm-bug, r=lcnr
GuillaumeGomez May 5, 2025
224e3ca
Rollup merge of #140559 - rperier:type-ir-to-type-middle, r=compiler-…
GuillaumeGomez May 5, 2025
1c801a3
Rollup merge of #140605 - lcnr:defer-opaque-type-error, r=compiler-er…
GuillaumeGomez May 5, 2025
6cee5bf
Rollup merge of #140636 - onur-ozkan:panic-tracker-for-t-macro, r=Kobzol
GuillaumeGomez May 5, 2025
0d7067d
Rollup merge of #140661 - Darksonn:fixedx18-tm, r=wesleywiser
GuillaumeGomez May 5, 2025
5822dd6
Rollup merge of #140670 - onur-ozkan:129959, r=Kobzol
GuillaumeGomez May 5, 2025
bdbf1c6
Rollup merge of #140672 - compiler-errors:deeply-normalize, r=lcnr
GuillaumeGomez May 5, 2025
2a882f7
Rollup merge of #140676 - rustbot:docs-update, r=ehuss
GuillaumeGomez May 5, 2025
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
Prev Previous commit
Next Next commit
Resolve instance for SymFn in global/naked asm
  • Loading branch information
compiler-errors committed May 5, 2025
commit 3a1ee645cad501e2fd766bbacea5654a795f352b
8 changes: 7 additions & 1 deletion compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,13 @@ where
rustc_hir::InlineAsmOperand::SymFn { expr } => {
let ty = cx.tcx().typeck(item_id.owner_id).expr_ty(expr);
let instance = match ty.kind() {
&ty::FnDef(def_id, args) => Instance::new(def_id, args),
&ty::FnDef(def_id, args) => Instance::expect_resolve(
cx.tcx(),
ty::TypingEnv::fully_monomorphized(),
def_id,
args,
expr.span,
),
_ => span_bug!(*op_sp, "asm sym is not a function"),
};

Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_codegen_ssa/src/mir/naked_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ fn inline_to_global_operand<'a, 'tcx, Cx: LayoutOf<'tcx, LayoutOfResult = TyAndL
);

let instance = match mono_type.kind() {
&ty::FnDef(def_id, args) => Instance::new(def_id, args),
&ty::FnDef(def_id, args) => {
Instance::expect_resolve(cx.tcx(), cx.typing_env(), def_id, args, value.span)
}
_ => bug!("asm sym is not a function"),
};

Expand Down
27 changes: 27 additions & 0 deletions tests/ui/asm/global-asm-mono-sym-fn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Test that we're properly monomorphizing sym args in global asm blocks
// that point to associated items.

//@ edition: 2021
//@ needs-asm-support
//@ only-x86_64-unknown-linux-gnu
//@ build-pass

#![no_main]

use std::arch::global_asm;

fn foo() {
loop {}
}

trait Foo {
fn bar();
}

impl Foo for i32 {
fn bar() {
loop {}
}
}

global_asm!(".global main", "main:", "call {}", sym <i32 as Foo>::bar);
35 changes: 35 additions & 0 deletions tests/ui/asm/naked-asm-mono-sym-fn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Regression test for <https://github.com/rust-lang/rust/issues/140373>.
// Test that we're properly monomorphizing sym args in naked asm blocks
// that point to associated items.

//@ edition: 2021
//@ needs-asm-support
//@ only-x86_64
//@ build-pass

trait T {
extern "C" fn t();
}

enum E<const C: usize> {}

impl<const C: usize> T for E<C> {
extern "C" fn t() {
println!("Const generic: {}", C);
}
}

#[unsafe(naked)]
extern "C" fn foo<U: T>() {
core::arch::naked_asm!(
"push rax",
"call {fn}",
"pop rax",
"ret",
fn = sym <U as T>::t,
);
}

fn main() {
foo::<E<42>>();
}
0