Skip to content

Internal compiler error: Could not find a valid lexical scope for this source location. #7254

Open
@ironcev

Description

@ironcev

Some of the expression, when used as initializers of asm-block arguments cause the following ICE:

Internal compiler error: Could not find a valid lexical scope for this source location.

E.g., in the below example, each of the asm blocks will emit that ICE:

script;

fn main() {
    let _ = asm(p: if true { 1 } else { 2 }) { p: u64 };
    let _ = asm(p: (if true { 1 } else { 2 })) { p: u64 };
    let _ = asm(p: { 1 }) { p: u64 };
}

Note that in general, we support arbitrary expressions in asm arguments initializers. E.g., this compiles as expected:

script;

fn main() {
    let _ = asm(p: 1 + 2) { p: u64 };
    let _ = asm(p: return) { p: u64 };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompilerGeneral compiler. Should eventually become more specific as the issue is triagedcompiler: frontendEverything to do with type checking, control flow analysis, and everything between parsing and IRgenteam:compilerCompiler Team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions