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: with expression doesn't evaluate to a struct #12351

Closed
matthiaskrgr opened this issue Feb 26, 2024 · 2 comments
Closed

ICE: with expression doesn't evaluate to a struct #12351

matthiaskrgr opened this issue Feb 26, 2024 · 2 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@matthiaskrgr
Copy link
Member

Summary

fn main() {
    let a = xm1::S { ..panic!() };
    //~^ ERROR failed to resolve: could not find `imp` in `sys` [E0433]
    //~^^ ERROR module `sys` is private [E0603]
}
clippy-driver --crate-type lib  97DCA81C5FA3A5595B7245C181674152E09F5437156FB1DB6A226DAF30203D2E.rs --edition 2024 -Zunstable-options

Version

rustc 1.78.0-nightly (381d69953 2024-02-24)
binary: rustc
commit-hash: 381d69953bb7c3390cec0fee200f24529cb6320f
commit-date: 2024-02-24
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Error output

Backtrace

warning: unreachable expression
--> 97DCA81C5FA3A5595B7245C181674152E09F5437156FB1DB6A226DAF30203D2E.rs:2:13
|
2 |     let a = xm1::S { ..panic!() };
|             ^^^^^^^^^^^--------^^
|             |          |
|             |          any code following this expression is unreachable
|             unreachable expression
|
= note: `#[warn(unreachable_code)]` on by default

warning: function `main` is never used
--> 97DCA81C5FA3A5595B7245C181674152E09F5437156FB1DB6A226DAF30203D2E.rs:1:4
|
1 | fn main() {
|    ^^^^
|
= note: `#[warn(dead_code)]` on by default

error: internal compiler error: compiler/rustc_hir_typeck/src/expr_use_visitor.rs:584:21: with expression doesn't evaluate to a struct
--> 97DCA81C5FA3A5595B7245C181674152E09F5437156FB1DB6A226DAF30203D2E.rs:2:24
|
2 |     let a = xm1::S { ..panic!() };
|                        ^^^^^^^^
|
= note: this error: internal compiler error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/compiler/rustc_middle/src/util/bug.rs:34:50:
Box<dyn Any>
stack backtrace:
 0:     0x7f54b798caf6 - std::backtrace_rs::backtrace::libunwind::trace::h109bf01707803b21
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
 1:     0x7f54b798caf6 - std::backtrace_rs::backtrace::trace_unsynchronized::hefcf68af32ee251e
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
 2:     0x7f54b798caf6 - std::sys_common::backtrace::_print_fmt::h31a90ba3e667b38a
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/std/src/sys_common/backtrace.rs:68:5
 3:     0x7f54b798caf6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he4f0cdaaa4ef639a
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/std/src/sys_common/backtrace.rs:44:22
 4:     0x7f54b79dda7c - core::fmt::rt::Argument::fmt::h1ec5088860cf50b0
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/core/src/fmt/rt.rs:142:9
 5:     0x7f54b79dda7c - core::fmt::write::h689bbff3655bb9d8
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/core/src/fmt/mod.rs:1120:17
 6:     0x7f54b798142f - std::io::Write::write_fmt::h7ecff4baaa465710
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/std/src/io/mod.rs:1846:15
 7:     0x7f54b798c8a4 - std::sys_common::backtrace::_print::h9485e3dec28344ea
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/std/src/sys_common/backtrace.rs:47:5
 8:     0x7f54b798c8a4 - std::sys_common::backtrace::print::heeebf1d6105a1e60
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/std/src/sys_common/backtrace.rs:34:9
 9:     0x7f54b798f5eb - std::panicking::default_hook::{{closure}}::h88c7af55bc049fb9
10:     0x7f54b798f339 - std::panicking::default_hook::haa382d9c5bfbc23c
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/std/src/panicking.rs:292:9
11:     0x7f54ba882fdc - std[c7add3eab026fdb7]::panicking::update_hook::<alloc[2ba798d9f5e2777d]::boxed::Box<rustc_driver_impl[4d7390d1e092a0cc]::install_ice_hook::{closure#0}>>::{closure#0}
12:     0x7f54b798fd50 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h8d3a037cf4dab9e8
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/alloc/src/boxed.rs:2030:9
13:     0x7f54b798fd50 - std::panicking::rust_panic_with_hook::hd9ee0be535a8506e
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/std/src/panicking.rs:783:13
14:     0x7f54ba8af6b4 - std[c7add3eab026fdb7]::panicking::begin_panic::<rustc_errors[82a85227d0491a03]::ExplicitBug>::{closure#0}
15:     0x7f54ba8ac5d6 - std[c7add3eab026fdb7]::sys_common::backtrace::__rust_end_short_backtrace::<std[c7add3eab026fdb7]::panicking::begin_panic<rustc_errors[82a85227d0491a03]::ExplicitBug>::{closure#0}, !>
16:     0x7f54ba8ac2b6 - std[c7add3eab026fdb7]::panicking::begin_panic::<rustc_errors[82a85227d0491a03]::ExplicitBug>
17:     0x7f54ba8b90a1 - <rustc_errors[82a85227d0491a03]::diagnostic::BugAbort as rustc_errors[82a85227d0491a03]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
18:     0x7f54baa0cde0 - rustc_middle[be2fc7c2c4a6d89d]::util::bug::opt_span_bug_fmt::<rustc_span[e3ed1f921c615197]::span_encoding::Span>::{closure#0}
19:     0x7f54baa0d45a - rustc_middle[be2fc7c2c4a6d89d]::ty::context::tls::with_opt::<rustc_middle[be2fc7c2c4a6d89d]::util::bug::opt_span_bug_fmt<rustc_span[e3ed1f921c615197]::span_encoding::Span>::{closure#0}, !>::{closure#0}
20:     0x7f54ba9fd878 - rustc_middle[be2fc7c2c4a6d89d]::ty::context::tls::with_context_opt::<rustc_middle[be2fc7c2c4a6d89d]::ty::context::tls::with_opt<rustc_middle[be2fc7c2c4a6d89d]::util::bug::opt_span_bug_fmt<rustc_span[e3ed1f921c615197]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
21:     0x7f54b9b90e74 - rustc_middle[be2fc7c2c4a6d89d]::util::bug::span_bug_fmt::<rustc_span[e3ed1f921c615197]::span_encoding::Span>
22:     0x7f54b9b8cce7 - <rustc_hir_typeck[4809bf69d3356469]::expr_use_visitor::ExprUseVisitor>::walk_expr
23:     0x7f54bc29f2f6 - <rustc_hir_typeck[4809bf69d3356469]::expr_use_visitor::ExprUseVisitor>::walk_block
24:     0x7f54b9b8af84 - <rustc_hir_typeck[4809bf69d3356469]::expr_use_visitor::ExprUseVisitor>::walk_expr
25:     0x7f54bc2a004d - <rustc_hir_typeck[4809bf69d3356469]::expr_use_visitor::ExprUseVisitor>::consume_expr
26:     0x7f54bc29f9e4 - <rustc_hir_typeck[4809bf69d3356469]::expr_use_visitor::ExprUseVisitor>::consume_body
27:     0x55f8cbef398b - <clippy_lints[104fdc8d5d35ad3d]::escape::BoxedLocal as rustc_lint[e54ff600f0934aae]::passes::LateLintPass>::check_fn
28:     0x7f54bac0f005 - <rustc_lint[e54ff600f0934aae]::late::LateContextAndPass<rustc_lint[e54ff600f0934aae]::late::RuntimeCombinedLateLintPass> as rustc_hir[54d089fe68af4196]::intravisit::Visitor>::visit_fn
29:     0x7f54babfe454 - <rustc_lint[e54ff600f0934aae]::late::LateContextAndPass<rustc_lint[e54ff600f0934aae]::late::RuntimeCombinedLateLintPass> as rustc_hir[54d089fe68af4196]::intravisit::Visitor>::visit_nested_item
30:     0x7f54bc7d0d3d - rustc_lint[e54ff600f0934aae]::late::check_crate::{closure#0}
31:     0x7f54bc7d0f91 - rustc_lint[e54ff600f0934aae]::late::check_crate
32:     0x7f54bc7caea5 - rustc_interface[a8e077c2594aedc9]::passes::analysis
33:     0x7f54bc7c9b99 - rustc_query_impl[3dbe716596c9e9df]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3dbe716596c9e9df]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[be2fc7c2c4a6d89d]::query::erase::Erased<[u8; 1usize]>>
34:     0x7f54bc9d2a65 - rustc_query_system[c21ecc0bfee3e160]::query::plumbing::try_execute_query::<rustc_query_impl[3dbe716596c9e9df]::DynamicConfig<rustc_query_system[c21ecc0bfee3e160]::query::caches::SingleCache<rustc_middle[be2fc7c2c4a6d89d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[3dbe716596c9e9df]::plumbing::QueryCtxt, false>
35:     0x7f54bc9d27c9 - rustc_query_impl[3dbe716596c9e9df]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
36:     0x7f54bc8fa256 - rustc_interface[a8e077c2594aedc9]::interface::run_compiler::<core[53164db537a29558]::result::Result<(), rustc_span[e3ed1f921c615197]::ErrorGuaranteed>, rustc_driver_impl[4d7390d1e092a0cc]::run_compiler::{closure#0}>::{closure#0}
37:     0x7f54bcbc7cc5 - std[c7add3eab026fdb7]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a8e077c2594aedc9]::util::run_in_thread_with_globals<rustc_interface[a8e077c2594aedc9]::util::run_in_thread_pool_with_globals<rustc_interface[a8e077c2594aedc9]::interface::run_compiler<core[53164db537a29558]::result::Result<(), rustc_span[e3ed1f921c615197]::ErrorGuaranteed>, rustc_driver_impl[4d7390d1e092a0cc]::run_compiler::{closure#0}>::{closure#0}, core[53164db537a29558]::result::Result<(), rustc_span[e3ed1f921c615197]::ErrorGuaranteed>>::{closure#0}, core[53164db537a29558]::result::Result<(), rustc_span[e3ed1f921c615197]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[53164db537a29558]::result::Result<(), rustc_span[e3ed1f921c615197]::ErrorGuaranteed>>
38:     0x7f54bcbc7af2 - <<std[c7add3eab026fdb7]::thread::Builder>::spawn_unchecked_<rustc_interface[a8e077c2594aedc9]::util::run_in_thread_with_globals<rustc_interface[a8e077c2594aedc9]::util::run_in_thread_pool_with_globals<rustc_interface[a8e077c2594aedc9]::interface::run_compiler<core[53164db537a29558]::result::Result<(), rustc_span[e3ed1f921c615197]::ErrorGuaranteed>, rustc_driver_impl[4d7390d1e092a0cc]::run_compiler::{closure#0}>::{closure#0}, core[53164db537a29558]::result::Result<(), rustc_span[e3ed1f921c615197]::ErrorGuaranteed>>::{closure#0}, core[53164db537a29558]::result::Result<(), rustc_span[e3ed1f921c615197]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[53164db537a29558]::result::Result<(), rustc_span[e3ed1f921c615197]::ErrorGuaranteed>>::{closure#1} as core[53164db537a29558]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
39:     0x7f54b7999725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h160bc5962de4c385
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/alloc/src/boxed.rs:2016:9
40:     0x7f54b7999725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h55e504807a34477d
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/alloc/src/boxed.rs:2016:9
41:     0x7f54b7999725 - std::sys::pal::unix::thread::Thread::new::thread_start::h61059cf7b19988e2
                             at /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/std/src/sys/pal/unix/thread.rs:108:17
42:     0x7f54b763755a - <unknown>
43:     0x7f54b76b4a3c - <unknown>
44:                0x0 - <unknown>

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

note: please attach the file at `/tmp/im/rustc-ice-2024-02-26T05_17_22-3518745.txt` to your bug report

note: compiler flags: --crate-type lib -Z unstable-options

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
note: Clippy version: clippy 0.1.78 (381d699 2024-02-24)

error[E0433]: failed to resolve: use of undeclared crate or module `xm1`
--> 97DCA81C5FA3A5595B7245C181674152E09F5437156FB1DB6A226DAF30203D2E.rs:2:13
|
2 |     let a = xm1::S { ..panic!() };
|             ^^^ use of undeclared crate or module `xm1`

error: aborting due to 2 previous errors; 2 warnings emitted

For more information about this error, try `rustc --explain E0433`.

@matthiaskrgr matthiaskrgr added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Feb 26, 2024
@m-rph
Copy link
Contributor

m-rph commented Mar 24, 2024

I don't think this is a clippy issue but rather a rustc issue getting invoked when walking hir 🤔

clippy_lints[104fdc8d5d35ad3d]::escape::BoxedLocal as rustc_lint[e54ff600f0934aae]::passes::LateLintPass>::check_fn

@Jarcho
Copy link
Contributor

Jarcho commented Mar 24, 2024

I cannot get this to reproduce on stable or current nightly. I assume this is a rustc issue since E0433 is raised which should result in no late lints running.

@Jarcho Jarcho closed this as completed Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants