Skip to content

ICE while checking RA proc_macro_srv: associated type missing default #6793

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

Closed
matthiaskrgr opened this issue Feb 25, 2021 · 1 comment · Fixed by #6812
Closed

ICE while checking RA proc_macro_srv: associated type missing default #6793

matthiaskrgr opened this issue Feb 25, 2021 · 1 comment · Fixed by #6812
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

git clone https://github.com/rust-analyzer/rust-analyzer/
cd rust-analyzer/crates/proc_macro_srv
git checkout 6ed49683e317413f4585dd2fdad407e20b3abb45
cargo clippy -- --wap-lints warn

Meta

clippy v: clippy 0.1.52 (98f8cce 2021-02-25)

rustc v

rustc 1.52.0-nightly (98f8cce6d 2021-02-25)
binary: rustc
commit-hash: 98f8cce6db6c6c6660eeffee2b3903104e547ecf
commit-date: 2021-02-25
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1

Error output

error: internal compiler error: compiler/rustc_typeck/src/collect/type_of.rs:279:17: associated type missing default
  --> crates/proc_macro_srv/src/proc_macro/bridge/server.rs:23:10
   |
23 |         (type Group: 'static + Clone;);
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
61 | with_api!(Self, self_, declare_server_traits);
   | ---------------------------------------------- in this macro invocation
   |
   = note: this error: internal compiler error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at 'Box<Any>', /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/panic.rs:59:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.52 (98f8cce 2021-02-25)
Backtrace

error: internal compiler error: compiler/rustc_typeck/src/collect/type_of.rs:279:17: associated type missing default
--> crates/proc_macro_srv/src/proc_macro/bridge/server.rs:23:10
 |
23 |         (type Group: 'static + Clone;);
 |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
61 | with_api!(Self, self_, declare_server_traits);
 | ---------------------------------------------- in this macro invocation
 |
 = note: this error: internal compiler error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at 'Box<Any>', /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/panic.rs:59:5
stack backtrace:
 0:     0x7f4c8f991ce0 - std::backtrace_rs::backtrace::libunwind::trace::h9d49145f95eb5894
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
 1:     0x7f4c8f991ce0 - std::backtrace_rs::backtrace::trace_unsynchronized::hab1d020365bb6864
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
 2:     0x7f4c8f991ce0 - std::sys_common::backtrace::_print_fmt::h7659588431e304bd
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/sys_common/backtrace.rs:67:5
 3:     0x7f4c8f991ce0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h09f4a9e3befae3c7
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/sys_common/backtrace.rs:46:22
 4:     0x7f4c8fa0242c - core::fmt::write::hf3fdfde304b9a088
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/core/src/fmt/mod.rs:1092:17
 5:     0x7f4c8f985022 - std::io::Write::write_fmt::h1cb850689c7116f0
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/io/mod.rs:1568:15
 6:     0x7f4c8f995b85 - std::sys_common::backtrace::_print::hdbccd5aa093ba544
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/sys_common/backtrace.rs:49:5
 7:     0x7f4c8f995b85 - std::sys_common::backtrace::print::hc639c4f320222558
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/sys_common/backtrace.rs:36:9
 8:     0x7f4c8f995b85 - std::panicking::default_hook::{{closure}}::hdb012dd7a485bb5d
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/panicking.rs:208:50
 9:     0x7f4c8f995633 - std::panicking::default_hook::h75facbce77b6ba91
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/panicking.rs:225:9
10:     0x5574dc8fa6f7 - clippy_driver::ICE_HOOK::{{closure}}::{{closure}}::h4581c66fd81e2243
11:     0x7f4c8f996486 - std::panicking::rust_panic_with_hook::hbcaa5de2cb5e22d5
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/panicking.rs:595:17
12:     0x7f4c90574ee6 - std::panicking::begin_panic::{{closure}}::he22afd489be7f839
13:     0x7f4c90574e19 - std::sys_common::backtrace::__rust_end_short_backtrace::h8864891dcfcacf13
14:     0x7f4c905d35d2 - std::panicking::begin_panic::h978d7b6600883251
15:     0x7f4c90568220 - std::panic::panic_any::h2f13f43e56bf09a7
16:     0x7f4c90564d45 - rustc_errors::HandlerInner::span_bug::h851309a44ebcd5d5
17:     0x7f4c90565463 - rustc_errors::Handler::span_bug::h42213a9313121990
18:     0x7f4c905ccdc2 - rustc_middle::ty::context::tls::with_opt::h553203d5c637e61d
19:     0x7f4c921c5350 - rustc_middle::util::bug::opt_span_bug_fmt::hdab485fa6a7ec0e2
20:     0x7f4c905cce3c - rustc_middle::util::bug::span_bug_fmt::h9a5397aa7e1ee77a
21:     0x7f4c9167fb80 - rustc_typeck::collect::type_of::type_of::hfbcd5f80eee70212
22:     0x7f4c9243fc68 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h3883891ff5466298
23:     0x7f4c9182af1b - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hfd88bc53009039eb
24:     0x7f4c917fe2d3 - rustc_data_structures::stack::ensure_sufficient_stack::h035578b2223bc27a
25:     0x7f4c917de2c7 - rustc_query_system::query::plumbing::force_query_with_job::h7032cab6de61fbf2
26:     0x7f4c917c0a6f - rustc_query_system::query::plumbing::get_query_impl::ha96d8281a4a739f8
27:     0x7f4c91830aea - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::type_of::h7d7eddcd0eccbd73
28:     0x5574dc9d0316 - <clippy_lints::default_numeric_fallback::NumericFallbackVisitor as rustc_hir::intravisit::Visitor>::visit_expr::hb10f19b628b1e36b
29:     0x5574dc9d0710 - <clippy_lints::default_numeric_fallback::NumericFallbackVisitor as rustc_hir::intravisit::Visitor>::visit_expr::hb10f19b628b1e36b
30:     0x5574dc9cfd56 - <clippy_lints::default_numeric_fallback::DefaultNumericFallback as rustc_lint::passes::LateLintPass>::check_body::h1f9c44ae463662a0
31:     0x7f4c9103f8c2 - <rustc_lint::late::LateLintPassObjects as rustc_lint::passes::LateLintPass>::check_body::h699daf59875dce36
32:     0x7f4c9026666b - <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_nested_body::he58e9e6b24e9d9c0
33:     0x7f4c90266956 - <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_fn::hac0cd372390dff45
34:     0x7f4c902a7ecb - rustc_hir::intravisit::walk_impl_item::h5bb649e8ba81efef
35:     0x7f4c90267aa1 - rustc_hir::intravisit::Visitor::visit_nested_impl_item::hdf136acf27ef1810
36:     0x7f4c902a85bc - rustc_hir::intravisit::walk_impl_item_ref::h39360467acb6f1e2
37:     0x7f4c902a96ca - rustc_hir::intravisit::walk_item::h2f37f1d91082318b
38:     0x7f4c902674f5 - rustc_hir::intravisit::Visitor::visit_nested_item::hcd30d874837a4042
39:     0x7f4c902a8b88 - rustc_hir::intravisit::walk_mod::h169a052681c2134e
40:     0x7f4c90266a9f - <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_mod::h50f560318c71a862
41:     0x7f4c902a9759 - rustc_hir::intravisit::walk_item::h2f37f1d91082318b
42:     0x7f4c902674f5 - rustc_hir::intravisit::Visitor::visit_nested_item::hcd30d874837a4042
43:     0x7f4c902a8b88 - rustc_hir::intravisit::walk_mod::h169a052681c2134e
44:     0x7f4c90266a9f - <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_mod::h50f560318c71a862
45:     0x7f4c902a791f - rustc_hir::intravisit::walk_crate::h56516cd5271fbde1
46:     0x7f4c9026284c - rustc_lint::late::late_lint_pass_crate::h68fca22b203b40c7
47:     0x7f4c91ed4d9f - rustc_lint::late::late_lint_crate::h8b056da490fd5163
48:     0x7f4c91f0a8c3 - rustc_data_structures::sync::join::h1e87f8b6f730a184
49:     0x7f4c91ef2e50 - std::panic::catch_unwind::h52b42338dd242d3f
50:     0x7f4c91edac1f - rustc_session::utils::<impl rustc_session::session::Session>::time::hb76d107dd0ea1521
51:     0x7f4c91ee085c - rustc_interface::passes::analysis::h1be2fa253172941a
52:     0x7f4c909c8a4e - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h43bf6df04b555c18
53:     0x7f4c923ffb19 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hc09b4067b7b36b10
54:     0x7f4c9238bb2f - rustc_data_structures::stack::ensure_sufficient_stack::h2b7e5425bc236287
55:     0x7f4c9234cb4a - rustc_query_system::query::plumbing::force_query_with_job::h90d3fef7e56f1800
56:     0x7f4c92314c9b - rustc_query_system::query::plumbing::get_query_impl::hb04441add7cec8aa
57:     0x7f4c9241c2ef - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis::hafab3eafa781eefb
58:     0x7f4c91ecd3db - rustc_interface::passes::QueryContext::enter::h8a95f60ada89ef7e
59:     0x7f4c91e9da2d - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h39531375bcd2fda9
60:     0x7f4c91ece901 - rustc_span::with_source_map::hf3c84f193adf9eda
61:     0x7f4c91e9e9ea - rustc_interface::interface::create_compiler_and_run::he227014f8377cd9b
62:     0x7f4c91e9cbf8 - scoped_tls::ScopedKey<T>::set::h45bce0d39c421236
63:     0x7f4c91e9d2bc - std::sys_common::backtrace::__rust_begin_short_backtrace::h07189c72057db042
64:     0x7f4c91ebc41a - core::ops::function::FnOnce::call_once{{vtable.shim}}::h58a4726aa1e9868c
65:     0x7f4c8f9a668a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdc51fe7e73bc86bf
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/alloc/src/boxed.rs:1546:9
66:     0x7f4c8f9a668a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he605738a76b56d9d
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/alloc/src/boxed.rs:1546:9
67:     0x7f4c8f9a668a - std::sys::unix::thread::Thread::new::thread_start::he44b12fd83e74919
                             at /rustc/98f8cce6db6c6c6660eeffee2b3903104e547ecf/library/std/src/sys/unix/thread.rs:71:17
68:     0x7f4c8f892299 - start_thread
69:     0x7f4c8f674153 - clone
70:                0x0 - <unknown>

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.52 (98f8cce 2021-02-25)

query stack during panic:
#0 [type_of] computing type of `proc_macro::bridge::server::Types::Group`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error; 13 warnings emitted

error: could not compile `proc_macro_srv`

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

@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 25, 2021
@Y-Nak
Copy link
Contributor

Y-Nak commented Feb 27, 2021

Reproducer of the issue.

trait Trait {
    type Ty: 'static + Clone;

    fn foo() -> Self::Ty;
}

#[derive(Clone)]
struct MyType {
    x: i32,
}

impl Trait for MyType {
    type Ty = MyType;

    fn foo() -> Self::Ty {
        Self::Ty { x: 1 }
    }
}

gives

error: internal compiler error: compiler/rustc_typeck/src/collect/type_of.rs:279:17: associated type missing default
 --> src/lib.rs:2:5
  |
2 |     type Ty: 'static + Clone;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'Box<Any>', /rustc/9c09c1f7cfcf9de0522bcd1cfda32b552195c464/library/std/src/panic.rs:59:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.52 (9c09c1f 2021-02-26)
BackTrace
error: internal compiler error: compiler/rustc_typeck/src/collect/type_of.rs:279:17: associated type missing default
 --> src/lib.rs:2:5
  |
2 |     type Ty: 'static + Clone;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'Box<Any>', /rustc/9c09c1f7cfcf9de0522bcd1cfda32b552195c464/library/std/src/panic.rs:59:5
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::span_bug
   3: rustc_errors::Handler::span_bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::span_bug_fmt
   7: rustc_typeck::collect::type_of::type_of
   8: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
   9: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  10: rustc_data_structures::stack::ensure_sufficient_stack
  11: rustc_query_system::query::plumbing::force_query_with_job
  12: rustc_query_system::query::plumbing::get_query_impl
  13: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::type_of
  14: <clippy_lints::default_numeric_fallback::NumericFallbackVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  15: <clippy_lints::default_numeric_fallback::NumericFallbackVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  16: <clippy_lints::default_numeric_fallback::DefaultNumericFallback as rustc_lint::passes::LateLintPass>::check_body
  17: <rustc_lint::late::LateLintPassObjects as rustc_lint::passes::LateLintPass>::check_body
  18: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_nested_body
  19: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_fn
  20: rustc_hir::intravisit::walk_impl_item
  21: rustc_hir::intravisit::Visitor::visit_nested_impl_item
  22: rustc_hir::intravisit::walk_impl_item_ref
  23: rustc_hir::intravisit::walk_item
  24: rustc_hir::intravisit::Visitor::visit_nested_item
  25: rustc_hir::intravisit::walk_mod
  26: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_mod
  27: rustc_hir::intravisit::walk_crate
  28: rustc_lint::late::late_lint_pass_crate
  29: rustc_lint::late::late_lint_crate
  30: rustc_data_structures::sync::join
  31: std::panic::catch_unwind
  32: rustc_session::utils::<impl rustc_session::session::Session>::time
  33: rustc_interface::passes::analysis
  34: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  35: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  36: rustc_data_structures::stack::ensure_sufficient_stack
  37: rustc_query_system::query::plumbing::force_query_with_job
  38: rustc_query_system::query::plumbing::get_query_impl
  39: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  40: rustc_interface::passes::QueryContext::enter
  41: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  42: rustc_span::with_source_map
  43: rustc_interface::interface::create_compiler_and_run
  44: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.52 (9c09c1f 2021-02-26)

query stack during panic:
#0 [type_of] computing type of `Trait::Ty`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

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

Successfully merging a pull request may close this issue.

2 participants