rust-marker / marker

An experimental linting interface for Rust. Let's make custom lints a reality
https://rust-marker.github.io/marker/
Other
142 stars 11 forks source link

[Panic]: `this should be a literal expression Expr {` #335

Open matthiaskrgr opened 10 months ago

matthiaskrgr commented 10 months ago

Summary

No response

Reproducer

// run-pass
#![feature(inline_const_pat)]
#![allow(dead_code)]
#![allow(incomplete_features)]
fn foo<const V: usize>() {
    match 0 {
        const { 1 << 5 } | _ => {}
    }
}

fn main() {}

Version

No response

Logs and Backtrace

MARKER_ERROR_TRACE=1 MARKER_LOG=info RUST_BACKTRACE=1    LD_LIBRARY_PATH='/home/matthias/o/target/debug/deps:/home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/lib:/home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/lib:/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib'  RUSTC_WORKSPACE_WRAPPER=/home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/bin/marker_rustc_driver MARKER_LINT_CRATES=marker_lints:/home/matthias/o/target/marker/lints/libmarker_lints.so   RUSTUP_TOOLCHAIN=nightly-2023-11-16    /home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/bin/marker_rustc_driver /home/matthias/vcs/github/rust_misc_stuff/tests/ui/match/issue-112438.rs
skipping not implemented expr at: /home/matthias/vcs/github/rust_misc_stuff/tests/ui/match/issue-112438.rs:7:9: 7:25 (#0)
thread 'rustc' panicked at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/marker_rustc_driver-0.4.3/src/conversion/marker/ast/pat.rs:131:42:
this should be a literal expression Expr {
    hir_id: HirId(DefId(0:3 ~ issue_112438[460d]::foo).3),
    kind: ConstBlock(
        ConstBlock {
            hir_id: HirId(DefId(0:3 ~ issue_112438[460d]::foo).4),
            def_id: DefId(0:5 ~ issue_112438[460d]::foo::{constant#0}),
            body: BodyId {
                hir_id: HirId(DefId(0:3 ~ issue_112438[460d]::foo).5),
            },
        },
    ),
    span: /home/matthias/vcs/github/rust_misc_stuff/tests/ui/match/issue-112438.rs:7:9: 7:25 (#0),
}
stack backtrace:
   0: rust_begin_unwind
             at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/core/src/panicking.rs:72:14
   2: marker_rustc_driver::conversion::marker::ast::pat::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_pat_with_hls
   3: marker_rustc_driver::conversion::marker::ast::pat::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_pat_with_hls
   4: marker_rustc_driver::conversion::marker::ast::expr::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_match_arm
   5: marker_rustc_driver::conversion::marker::ast::expr::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_expr
   6: marker_rustc_driver::conversion::marker::ast::expr::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_block_expr
   7: marker_rustc_driver::conversion::marker::ast::expr::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_expr
   8: marker_rustc_driver::conversion::marker::MarkerConverter::body
   9: marker_utils::visitor::traverse_item
  10: marker_utils::visitor::traverse_item
  11: marker_adapter::Adapter::process_krate
  12: marker_rustc_driver::lint_pass::process_crate
  13: rustc_lint::late::check_crate::{closure#0}
  14: rustc_lint::late::check_crate
  15: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  16: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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

note: we would appreciate a bug report: https://github.com/rust-marker/marker/issues/new?template=panic.yml

note: please attach the file at `/tmp/marker/rustc-ice-2023-12-17T23_48_33-1811625.txt` to your bug report

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
note: marker_rustc_driver 0.4.3

note: Achievement Unlocked: [Free Ice Cream]