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

"requires owned_box lang_item" causes panic #7410

Closed
unizippro opened this issue Jun 28, 2021 · 1 comment · Fixed by #7471
Closed

"requires owned_box lang_item" causes panic #7410

unizippro opened this issue Jun 28, 2021 · 1 comment · Fixed by #7471
Labels
C-bug Category: Clippy is not doing the correct thing E-needs-mcve Call for participation: This issue needs a Minimal Complete and Verifiable Example I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@unizippro
Copy link

Code

Unfortunatly i was unable to find the specific code causing the crash. But i have verified the linting runs with clippy 0.1.52 (88f19c6 2021-05-03).

Meta

  • cargo clippy -V:
     clippy 0.1.53 (53cb7b0 2021-06-17)
    
  • rustc -Vv:
    rustc 1.53.0 (53cb7b09b 2021-06-17)
    binary: rustc
    commit-hash: 53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b
    commit-date: 2021-06-17
    host: x86_64-unknown-linux-gnu
    release: 1.53.0
    LLVM version: 12.0.1
    

Error output

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: "requires `owned_box` lang_item"', src/tools/clippy/clippy_utils/src/ty.rs:251:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic
Backtrace

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: "requires `owned_box` lang_item"', src/tools/clippy/clippy_utils/src/ty.rs:251:67
stack backtrace:
 0: rust_begin_unwind
           at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:493:5
 1: core::panicking::panic_fmt
           at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:92:14
 2: core::result::unwrap_failed
           at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/result.rs:1355:5
 3: clippy_utils::ty::is_type_lang_item
 4: clippy_lints::matches::redundant_pattern_match::type_needs_ordered_drop_inner
 5: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
 6: clippy_lints::matches::redundant_pattern_match::type_needs_ordered_drop_inner
 7: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
 8: clippy_lints::matches::redundant_pattern_match::type_needs_ordered_drop_inner
 9: clippy_lints::matches::redundant_pattern_match::find_sugg_for_if_let
10: clippy_lints::matches::redundant_pattern_match::check
11: <clippy_lints::matches::Matches as rustc_lint::passes::LateLintPass>::check_expr
12: <rustc_lint::late::LateLintPassObjects as rustc_lint::passes::LateLintPass>::check_expr
13: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_expr
14: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_block
15: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_expr
16: rustc_hir::intravisit::walk_expr
17: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_expr
18: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_stmt
19: rustc_hir::intravisit::walk_block
20: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_block
21: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_expr
22: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_nested_body
23: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_fn
24: rustc_hir::intravisit::walk_impl_item
25: rustc_hir::intravisit::Visitor::visit_nested_impl_item
26: rustc_hir::intravisit::walk_impl_item_ref
27: rustc_hir::intravisit::walk_item
28: rustc_hir::intravisit::Visitor::visit_nested_item
29: rustc_hir::intravisit::walk_mod
30: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_mod
31: rustc_hir::intravisit::Visitor::visit_nested_item
32: rustc_hir::intravisit::walk_mod
33: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_mod
34: rustc_hir::intravisit::Visitor::visit_nested_item
35: rustc_hir::intravisit::walk_mod
36: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_mod
37: rustc_hir::intravisit::walk_crate
38: rustc_lint::late::late_lint_pass_crate
39: rustc_lint::late::late_lint_crate
40: rustc_session::utils::<impl rustc_session::session::Session>::time
41: std::panic::catch_unwind
42: rustc_session::utils::<impl rustc_session::session::Session>::time
43: rustc_interface::passes::analysis
44: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
45: rustc_data_structures::stack::ensure_sufficient_stack
46: rustc_query_system::query::plumbing::force_query_with_job
47: rustc_query_system::query::plumbing::get_query_impl
48: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
49: rustc_interface::passes::QueryContext::enter
50: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
51: rustc_span::with_source_map
52: rustc_interface::interface::create_compiler_and_run
53: scoped_tls::ScopedKey<T>::set
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-clippy/issues/new

note: Clippy version: clippy 0.1.53 (53cb7b0 2021-06-17)

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

@unizippro unizippro added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Jun 28, 2021
@giraffate giraffate added the E-needs-mcve Call for participation: This issue needs a Minimal Complete and Verifiable Example label Jun 29, 2021
@flip1995
Copy link
Member

Reproducer:

#![feature(lang_items, start, libc)]
#![no_std]

use core::panic::PanicInfo;

struct S;

impl Drop for S {
    fn drop(&mut self) {}
}

#[start]
fn main(argc: isize, argv: *const *const u8) -> isize {
    if let Some(_) = Some(S) {
    } else {
    }
    0
}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
    loop {}
}

#[lang = "eh_personality"]
extern "C" fn eh_personality() {}

I think I have a fix for this ICE.

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 E-needs-mcve Call for participation: This issue needs a Minimal Complete and Verifiable Example I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants