Skip to content

ice: clippy on none-lifetime binders #113516

Closed
rust-lang/rust-clippy
#11191
@matthiaskrgr

Description

@matthiaskrgr

Code

// check-pass

#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete

trait Foo: for<T> Bar<T> {}

trait Bar<T> {
    fn method() -> T;
}

fn x<T: Foo>() {
    let _: T = todo!();
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (83964c156 2023-07-08)
binary: rustc
commit-hash: 83964c156db1f444050a38b2498dbd0da6d5d503
commit-date: 2023-07-08
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

<output>
Backtrace

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/matthias/vcs/github/rust_codegen_splice_omni/tests/ui/traits/non_lifetime_binders/icemaker/5D2774E1ED5902C19ACFFF46C80789310BFCEDC9C761BC465CB2A0E0396B3763.rs:3:12
  |
3 | #![feature(non_lifetime_binders)]
  |            ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: function `x` is never used
  --> /home/matthias/vcs/github/rust_codegen_splice_omni/tests/ui/traits/non_lifetime_binders/icemaker/5D2774E1ED5902C19ACFFF46C80789310BFCEDC9C761BC465CB2A0E0396B3763.rs:12:4
   |
12 | fn x<T: Foo>() {
   |    ^
   |
   = note: `#[warn(dead_code)]` on by default

warning: sub-expression diverges
  --> /home/matthias/vcs/github/rust_codegen_splice_omni/tests/ui/traits/non_lifetime_binders/icemaker/5D2774E1ED5902C19ACFFF46C80789310BFCEDC9C761BC465CB2A0E0396B3763.rs:13:16
   |
13 |     let _: T = todo!();
   |                ^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression
   = note: `#[warn(clippy::diverging_sub_expression)]` on by default
   = note: this warning originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: compiler/rustc_hir_analysis/src/collect/type_of.rs:508:18: unexpected non-type Node::GenericParam: Type { default: None, synthetic: false }

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/compiler/rustc_errors/src/lib.rs:1651:9
stack backtrace:
   0:     0x7fb6ecb63a71 - std::backtrace_rs::backtrace::libunwind::trace::h4e1458b4a9fb4e6f
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fb6ecb63a71 - std::backtrace_rs::backtrace::trace_unsynchronized::hab78200fa9cb4924
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb6ecb63a71 - std::sys_common::backtrace::_print_fmt::hcfea8b2400713c36
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fb6ecb63a71 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3e59532c1e143911
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fb6ecbc9d7f - core::fmt::rt::Argument::fmt::h9df7228410758d1a
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/core/src/fmt/rt.rs:138:9
   5:     0x7fb6ecbc9d7f - core::fmt::write::h8469ff0e5aa7b2a8
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fb6ecb564b7 - std::io::Write::write_fmt::hf942e53f0bebad10
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/std/src/io/mod.rs:1714:15
   7:     0x7fb6ecb63885 - std::sys_common::backtrace::_print::hb60701aae549e88f
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fb6ecb63885 - std::sys_common::backtrace::print::h5a926053ebf6acdd
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fb6ecb66663 - std::panicking::default_hook::{{closure}}::h9cb2c77fd9d08a16
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/std/src/panicking.rs:269:22
  10:     0x7fb6ecb663f4 - std::panicking::default_hook::hc22d719f1e0a6564
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/std/src/panicking.rs:288:9
  11:     0x7fb6efe47c6b - rustc_driver_impl[2d6a85f1efddecb1]::install_ice_hook::{closure#0}
  12:     0x7fb6ecb66e8e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h05534b3187a63b37
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/alloc/src/boxed.rs:2007:9
  13:     0x7fb6ecb66e8e - std::panicking::rust_panic_with_hook::h548300ff41a99ca1
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/std/src/panicking.rs:709:13
  14:     0x7fb6f03fe5d1 - std[1ede75a6519e9681]::panicking::begin_panic::<rustc_errors[c0cefe3d099df7b4]::ExplicitBug>::{closure#0}
  15:     0x7fb6f03fd2e6 - std[1ede75a6519e9681]::sys_common::backtrace::__rust_end_short_backtrace::<std[1ede75a6519e9681]::panicking::begin_panic<rustc_errors[c0cefe3d099df7b4]::ExplicitBug>::{closure#0}, !>
  16:     0x7fb6f03fc9d6 - std[1ede75a6519e9681]::panicking::begin_panic::<rustc_errors[c0cefe3d099df7b4]::ExplicitBug>
  17:     0x7fb6f0408134 - <rustc_errors[c0cefe3d099df7b4]::HandlerInner>::bug::<alloc[b6f6cdd3965a641f]::string::String>
  18:     0x7fb6f0407fb6 - <rustc_errors[c0cefe3d099df7b4]::Handler>::bug::<alloc[b6f6cdd3965a641f]::string::String>
  19:     0x7fb6f0371f1c - rustc_middle[1f0c398aabd4ddf9]::util::bug::opt_span_bug_fmt::<rustc_span[2315e69a6c645816]::span_encoding::Span>::{closure#0}
  20:     0x7fb6f037098a - rustc_middle[1f0c398aabd4ddf9]::ty::context::tls::with_opt::<rustc_middle[1f0c398aabd4ddf9]::util::bug::opt_span_bug_fmt<rustc_span[2315e69a6c645816]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fb6f037095a - rustc_middle[1f0c398aabd4ddf9]::ty::context::tls::with_context_opt::<rustc_middle[1f0c398aabd4ddf9]::ty::context::tls::with_opt<rustc_middle[1f0c398aabd4ddf9]::util::bug::opt_span_bug_fmt<rustc_span[2315e69a6c645816]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fb6ee62c46d - rustc_middle[1f0c398aabd4ddf9]::util::bug::bug_fmt
  23:     0x7fb6eefcca1f - rustc_hir_analysis[d912080a46418664]::collect::type_of::type_of
  24:     0x7fb6edf97743 - rustc_query_impl[26d2ebf6b1d6d4c2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[26d2ebf6b1d6d4c2]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1f0c398aabd4ddf9]::query::erase::Erased<[u8; 8usize]>>
  25:     0x7fb6edf97700 - <rustc_query_impl[26d2ebf6b1d6d4c2]::query_impl::type_of::dynamic_query::{closure#2} as core[29b2b76cf1b48b36]::ops::function::FnOnce<(rustc_middle[1f0c398aabd4ddf9]::ty::context::TyCtxt, rustc_span[2315e69a6c645816]::def_id::DefId)>>::call_once
  26:     0x7fb6ede79cf5 - rustc_query_system[c6699240e700ffe8]::query::plumbing::try_execute_query::<rustc_query_impl[26d2ebf6b1d6d4c2]::DynamicConfig<rustc_query_system[c6699240e700ffe8]::query::caches::DefaultCache<rustc_span[2315e69a6c645816]::def_id::DefId, rustc_middle[1f0c398aabd4ddf9]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[26d2ebf6b1d6d4c2]::plumbing::QueryCtxt, false>
  27:     0x7fb6ef790863 - rustc_query_impl[26d2ebf6b1d6d4c2]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  28:     0x558fdecf817e - clippy_lints[5250119efe64ef1f]::redundant_type_annotations::is_same_type
  29:     0x558fdecf857f - clippy_lints[5250119efe64ef1f]::redundant_type_annotations::is_redundant_in_func_call
  30:     0x558fdecf882f - <clippy_lints[5250119efe64ef1f]::redundant_type_annotations::RedundantTypeAnnotations as rustc_lint[45bcffbddee15b5]::passes::LateLintPass>::check_local
  31:     0x7fb6f02484d3 - <rustc_lint[45bcffbddee15b5]::early::RuntimeCombinedEarlyLintPass as rustc_lint[45bcffbddee15b5]::passes::EarlyLintPass>::check_stmt
  32:     0x7fb6f0225e91 - <rustc_lint[45bcffbddee15b5]::late::LateContextAndPass<rustc_lint[45bcffbddee15b5]::late::RuntimeCombinedLateLintPass> as rustc_hir[30866afef9a6ad3a]::intravisit::Visitor>::visit_local
  33:     0x7fb6f01fbaeb - rustc_hir[30866afef9a6ad3a]::intravisit::walk_block::<rustc_lint[45bcffbddee15b5]::late::LateContextAndPass<rustc_lint[45bcffbddee15b5]::late::RuntimeCombinedLateLintPass>>
  34:     0x7fb6f0225e19 - <rustc_lint[45bcffbddee15b5]::late::LateContextAndPass<rustc_lint[45bcffbddee15b5]::late::RuntimeCombinedLateLintPass> as rustc_hir[30866afef9a6ad3a]::intravisit::Visitor>::visit_block
  35:     0x7fb6f0224d61 - <rustc_lint[45bcffbddee15b5]::late::LateContextAndPass<rustc_lint[45bcffbddee15b5]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[45bcffbddee15b5]::late::LateContextAndPass<rustc_lint[45bcffbddee15b5]::late::RuntimeCombinedLateLintPass> as rustc_hir[30866afef9a6ad3a]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
  36:     0x7fb6f0225d0c - <rustc_lint[45bcffbddee15b5]::late::LateContextAndPass<rustc_lint[45bcffbddee15b5]::late::RuntimeCombinedLateLintPass> as rustc_hir[30866afef9a6ad3a]::intravisit::Visitor>::visit_expr
  37:     0x7fb6f0226165 - <rustc_lint[45bcffbddee15b5]::late::LateContextAndPass<rustc_lint[45bcffbddee15b5]::late::RuntimeCombinedLateLintPass> as rustc_hir[30866afef9a6ad3a]::intravisit::Visitor>::visit_nested_body
  38:     0x7fb6f022634a - <rustc_lint[45bcffbddee15b5]::late::LateContextAndPass<rustc_lint[45bcffbddee15b5]::late::RuntimeCombinedLateLintPass> as rustc_hir[30866afef9a6ad3a]::intravisit::Visitor>::visit_fn
  39:     0x7fb6f01fd593 - rustc_hir[30866afef9a6ad3a]::intravisit::walk_item::<rustc_lint[45bcffbddee15b5]::late::LateContextAndPass<rustc_lint[45bcffbddee15b5]::late::RuntimeCombinedLateLintPass>>
  40:     0x7fb6f0226a97 - <rustc_lint[45bcffbddee15b5]::late::LateContextAndPass<rustc_lint[45bcffbddee15b5]::late::RuntimeCombinedLateLintPass> as rustc_hir[30866afef9a6ad3a]::intravisit::Visitor>::visit_nested_item
  41:     0x7fb6f01fcd58 - rustc_hir[30866afef9a6ad3a]::intravisit::walk_mod::<rustc_lint[45bcffbddee15b5]::late::LateContextAndPass<rustc_lint[45bcffbddee15b5]::late::RuntimeCombinedLateLintPass>>
  42:     0x7fb6ef2b2a5e - rustc_lint[45bcffbddee15b5]::late::late_lint_crate::<rustc_lint[45bcffbddee15b5]::BuiltinCombinedLateLintPass>
  43:     0x7fb6ef2b1ea8 - <rustc_session[d2c5967be8e6b8f9]::session::Session>::time::<(), rustc_lint[45bcffbddee15b5]::late::check_crate<rustc_lint[45bcffbddee15b5]::BuiltinCombinedLateLintPass, rustc_interface[b053cddf22540e47]::passes::analysis::{closure#5}::{closure#1}::{closure#2}::{closure#0}::{closure#0}>::{closure#0}::{closure#0}>
  44:     0x7fb6ef2b1d43 - <rustc_session[d2c5967be8e6b8f9]::session::Session>::time::<(), rustc_interface[b053cddf22540e47]::passes::analysis::{closure#5}::{closure#1}::{closure#2}::{closure#0}>
  45:     0x7fb6ef2b187f - <core[29b2b76cf1b48b36]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[b053cddf22540e47]::passes::analysis::{closure#5}::{closure#1}> as core[29b2b76cf1b48b36]::ops::function::FnOnce<()>>::call_once
  46:     0x7fb6ef2b12a0 - <rustc_session[d2c5967be8e6b8f9]::session::Session>::time::<(), rustc_interface[b053cddf22540e47]::passes::analysis::{closure#5}>
  47:     0x7fb6ef2afdb7 - rustc_interface[b053cddf22540e47]::passes::analysis
  48:     0x7fb6ef30e68a - rustc_query_impl[26d2ebf6b1d6d4c2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[26d2ebf6b1d6d4c2]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1f0c398aabd4ddf9]::query::erase::Erased<[u8; 1usize]>>
  49:     0x7fb6ef30e679 - <rustc_query_impl[26d2ebf6b1d6d4c2]::query_impl::analysis::dynamic_query::{closure#2} as core[29b2b76cf1b48b36]::ops::function::FnOnce<(rustc_middle[1f0c398aabd4ddf9]::ty::context::TyCtxt, ())>>::call_once
  50:     0x7fb6ef4a3168 - rustc_query_system[c6699240e700ffe8]::query::plumbing::try_execute_query::<rustc_query_impl[26d2ebf6b1d6d4c2]::DynamicConfig<rustc_query_system[c6699240e700ffe8]::query::caches::SingleCache<rustc_middle[1f0c398aabd4ddf9]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[26d2ebf6b1d6d4c2]::plumbing::QueryCtxt, false>
  51:     0x7fb6ef4a2f39 - rustc_query_impl[26d2ebf6b1d6d4c2]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  52:     0x7fb6ef051b25 - <rustc_middle[1f0c398aabd4ddf9]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[2d6a85f1efddecb1]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[29b2b76cf1b48b36]::result::Result<(), rustc_span[2315e69a6c645816]::ErrorGuaranteed>>
  53:     0x7fb6ef051152 - <rustc_interface[b053cddf22540e47]::interface::Compiler>::enter::<rustc_driver_impl[2d6a85f1efddecb1]::run_compiler::{closure#1}::{closure#2}, core[29b2b76cf1b48b36]::result::Result<core[29b2b76cf1b48b36]::option::Option<rustc_interface[b053cddf22540e47]::queries::Linker>, rustc_span[2315e69a6c645816]::ErrorGuaranteed>>
  54:     0x7fb6ef04a2a5 - rustc_span[2315e69a6c645816]::set_source_map::<core[29b2b76cf1b48b36]::result::Result<(), rustc_span[2315e69a6c645816]::ErrorGuaranteed>, rustc_interface[b053cddf22540e47]::interface::run_compiler<core[29b2b76cf1b48b36]::result::Result<(), rustc_span[2315e69a6c645816]::ErrorGuaranteed>, rustc_driver_impl[2d6a85f1efddecb1]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  55:     0x7fb6ef049d16 - <scoped_tls[b9dcc93a263bd177]::ScopedKey<rustc_span[2315e69a6c645816]::SessionGlobals>>::set::<rustc_interface[b053cddf22540e47]::interface::run_compiler<core[29b2b76cf1b48b36]::result::Result<(), rustc_span[2315e69a6c645816]::ErrorGuaranteed>, rustc_driver_impl[2d6a85f1efddecb1]::run_compiler::{closure#1}>::{closure#0}, core[29b2b76cf1b48b36]::result::Result<(), rustc_span[2315e69a6c645816]::ErrorGuaranteed>>
  56:     0x7fb6ef0492dc - std[1ede75a6519e9681]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b053cddf22540e47]::util::run_in_thread_pool_with_globals<rustc_interface[b053cddf22540e47]::interface::run_compiler<core[29b2b76cf1b48b36]::result::Result<(), rustc_span[2315e69a6c645816]::ErrorGuaranteed>, rustc_driver_impl[2d6a85f1efddecb1]::run_compiler::{closure#1}>::{closure#0}, core[29b2b76cf1b48b36]::result::Result<(), rustc_span[2315e69a6c645816]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[29b2b76cf1b48b36]::result::Result<(), rustc_span[2315e69a6c645816]::ErrorGuaranteed>>
  57:     0x7fb6ef0490a5 - <<std[1ede75a6519e9681]::thread::Builder>::spawn_unchecked_<rustc_interface[b053cddf22540e47]::util::run_in_thread_pool_with_globals<rustc_interface[b053cddf22540e47]::interface::run_compiler<core[29b2b76cf1b48b36]::result::Result<(), rustc_span[2315e69a6c645816]::ErrorGuaranteed>, rustc_driver_impl[2d6a85f1efddecb1]::run_compiler::{closure#1}>::{closure#0}, core[29b2b76cf1b48b36]::result::Result<(), rustc_span[2315e69a6c645816]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[29b2b76cf1b48b36]::result::Result<(), rustc_span[2315e69a6c645816]::ErrorGuaranteed>>::{closure#1} as core[29b2b76cf1b48b36]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  58:     0x7fb6ecb71305 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8fa82afee072a41e
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/alloc/src/boxed.rs:1993:9
  59:     0x7fb6ecb71305 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h99bb2872d0c67e87
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/alloc/src/boxed.rs:1993:9
  60:     0x7fb6ecb71305 - std::sys::unix::thread::Thread::new::thread_start::h51979755696e7814
                               at /rustc/83964c156db1f444050a38b2498dbd0da6d5d503/library/std/src/sys/unix/thread.rs:108:17
  61:     0x7fb6ec81744b - <unknown>
  62:     0x7fb6ec89ae40 - <unknown>
  63:                0x0 - <unknown>

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: rustc 1.72.0-nightly (83964c156 2023-07-08) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [type_of] computing type of `x::T`
#1 [analysis] running analysis passes on this crate
end of query stack
note: Clippy version: clippy 0.1.72 (83964c1 2023-07-08)

error: aborting due to previous error; 3 warnings emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-clippyArea: ClippyC-bugCategory: This is a bug.F-non_lifetime_binders`#![feature(non_lifetime_binders)]`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