Skip to content

unused function is not monomorphized, so post-mono lints do not show up (in particular affects associated and inline consts) #106617

Closed
@zirconium-n

Description

@zirconium-n

I tried this code:

#![feature(inline_const)]

fn run() {
    const { assert!(false) };
}

I expected to see this happen: compile error.

Instead, this happened: compile passes.

If I change the visibility of fn run to pub, it will throw a compile error.

For comparison, const value always throw a compile error even if the const is never used.

const X: i32 = {
    assert!(false);   // This will error!
    1
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-monomorphizationArea: MonomorphizationC-bugCategory: This is a bug.F-inline_constInline constants (aka: const blocks, const expressions, anonymous constants)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions