Skip to content
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

ICE when lowering sym fn operand in global/inline asm macro that has a nested def id #137179

Open
compiler-errors opened this issue Feb 17, 2025 · 0 comments · May be fixed by #137180
Open

ICE when lowering sym fn operand in global/inline asm macro that has a nested def id #137179

compiler-errors opened this issue Feb 17, 2025 · 0 comments · May be fixed by #137180
Assignees
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@compiler-errors
Copy link
Member

Code

use std::arch::global_asm;

global_asm! {
    "{}",
    sym foo::<{
        || {};
        0
    }>,
}

fn foo<const N: usize>() {}

Meta

rustc --version --verbose:

idk whatever nightly is today (feb 17, 2024)

Error output

error: internal compiler error: `type_of` called on const argument's anon const before the const argument was lowered
 --> src/lib.rs:5:15
  |
5 |       sym foo::<{
  |  _______________^
6 | |         || {};
7 | |         0
8 | |     }>,
  | |_____^
  |
note: delayed at compiler/rustc_hir_analysis/src/collect/type_of.rs:168:14 - disabled backtrace
 --> src/lib.rs:5:15
  |
5 |       sym foo::<{
  |  _______________^
6 | |         || {};
7 | |         0
8 | |     }>,
  | |_____^

error: internal compiler error: Trying to feed an already recorded value for query type_of key=DefId(0:7 ~ playground[f84d]::{global_asm#0}::{constant#0}):
                                old value: EarlyBinder { value: {type error}, .. }
                                new value: EarlyBinder { value: usize, .. }
  |
  = note: delayed at compiler/rustc_middle/src/query/mod.rs:2514:1 - disabled backtrace

error: internal compiler error: mir_const_qualif: MIR had errors
 --> src/lib.rs:5:15
  |
5 |       sym foo::<{
  |  _______________^
6 | |         || {};
7 | |         0
8 | |     }>,
  | |_____^
  |
note: delayed at compiler/rustc_mir_transform/src/lib.rs:362:19 - disabled backtrace
 --> src/lib.rs:5:15
  |
5 |       sym foo::<{
  |  _______________^
6 | |         || {};
7 | |         0
8 | |     }>,
  | |_____^

error: internal compiler error: mir_const_qualif: MIR had errors
 --> src/lib.rs:5:5
  |
5 | /     sym foo::<{
6 | |         || {};
7 | |         0
8 | |     }>,
  | |______^
  |
note: delayed at compiler/rustc_mir_transform/src/lib.rs:362:19 - disabled backtrace
 --> src/lib.rs:5:5
  |
5 | /     sym foo::<{
6 | |         || {};
7 | |         0
8 | |     }>,
  | |______^

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/playground/rustc-ice-2025-02-17T16_30_28-21.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: `playground` (lib) generated 1 warning
error: could not compile `playground` (lib); 1 warning emitted
@compiler-errors compiler-errors added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 17, 2025
@compiler-errors compiler-errors self-assigned this Feb 17, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 17, 2025
@compiler-errors compiler-errors added the A-inline-assembly Area: Inline assembly (`asm!(…)`) label Feb 17, 2025
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
3 participants