Skip to content

ICE - "interpolated tokens should not be present in the HIR" #78892

Closed
@mrowqa

Description

@mrowqa

Code

#![deny(clippy::pedantic)]

#[doc(hidden)]
#[macro_export]
macro_rules! __clippy_allow_workaround {
    ($($lint_name:ident,)+ $def:tt) => {{
        #[allow( $(clippy::$lint_name),* )]
        let workaround = || { $def };
        workaround()
    }};
}

pub fn foo() -> u32 {
    __clippy_allow_workaround!(items_after_statements, {
        let x = 4;
        fn y() -> u32 {
            42
        }
        x + y()
    })
}
Off-topic note regarding clippy In the project I work on I deny everything and allow specific lints on "minimal" scopes. I run both clippy stable and nightly. "minimal", because it is not that rare that I need to apply `#[allow()]` to a larger scope; otherwise it does not work.

Meta

rustc --version --verbose:

rustc 1.47.0 (18bf6b4f0 2020-10-07)
binary: rustc
commit-hash: 18bf6b4f01a6feaf7259ba7cdae58031af1b7b39
commit-date: 2020-10-07
host: x86_64-pc-windows-msvc
release: 1.47.0
LLVM version: 11.0

Note: the bug does not occur in nightly:

rustc 1.49.0-nightly (1773f60ea 2020-11-08)
binary: rustc
commit-hash: 1773f60ea5d42e86b8fdf78d2fc5221ead222bc1
commit-date: 2020-11-08
host: x86_64-pc-windows-msvc
release: 1.49.0-nightly

Error output

thread 'rustc' panicked at 'interpolated tokens should not be present in the HIR', /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\src\librustc_ast\token.rs:892:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
Backtrace

$ RUST_BACKTRACE=1 cargo build
   Compiling ice-example v0.1.0 (C:\Users\Artur\tmp\ice-example)
thread 'rustc' panicked at 'interpolated tokens should not be present in the HIR', /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\src\librustc_ast\token.rs:892:9
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

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: rustc 1.47.0 (18bf6b4f0 2020-10-07) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
#0 [index_hir] index HIR
#1 [hir_owner] HIR owner of `{{misc}}#0`
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `ice-example`.

To learn more, run the command again with --verbose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions