Closed
Description
Code
pub enum Operands {
Zero,
One(u8),
Two(u8, u8),
}
pub fn main() {
use Operands::*;
let operands = Zero;
match operands {
Zero => println!("Nothing"),
One(operand) => println!("{:x}", operand),
Two(operands @ ..) => println!("({:x}, {:x})", operands.0, operands.1),
};
}
Meta
The bug exists in the beta,
rustup run beta rustc --version --verbose
rustc 1.46.0-beta.1 (e51b714db 2020-07-15)
binary: rustc
commit-hash: e51b714db8ff82ac38ea7c6742d6f5480e2e77bd
commit-date: 2020-07-15
host: x86_64-unknown-linux-gnu
release: 1.46.0-beta.1
LLVM version: 10.0
nightly,
rustup run nightly rustc --version --verbose
rustc 1.46.0-nightly (346aec9b0 2020-07-11)
binary: rustc
commit-hash: 346aec9b02f3c74f3fce97fd6bda24709d220e49
commit-date: 2020-07-11
host: x86_64-unknown-linux-gnu
release: 1.46.0-nightly
LLVM version: 10.0
and stable build channels.
rustc --version --verbose
:
rustc 1.45.0 (5c1f21c3b 2020-07-13)
binary: rustc
commit-hash: 5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2
commit-date: 2020-07-13
host: x86_64-unknown-linux-gnu
release: 1.45.0
LLVM version: 10.0
The error and the backtrace provided are produced by the stable build.
Error output
error: `operands @` is not allowed in a tuple struct
--> ./a.rs:15:7
|
15 | Two(operands @ ..) => println!("({:x}, {:x})", operands.0, operands.1),
| ^^^^^^^^^^^^^ this is only allowed in slice patterns
|
= help: remove this and bind each tuple field independently
help: if you don't need to use the contents of operands, discard the tuple's remaining fields
|
15 | Two(..) => println!("({:x}, {:x})", operands.0, operands.1),
| ^^
error: internal compiler error: src/librustc_typeck/check/mod.rs:3023: no type for local variable unknown node (hir_id=HirId { owner: DefId(0:13 ~ a[317d]::main[0]), local_id: 9 })
--> ./a.rs:15:50
|
15 | Two(operands @ ..) => println!("({:x}, {:x})", operands.0, operands.1),
| ^^^^^^^^
thread 'rustc' panicked at 'Box<Any>', /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2/src/libstd/macros.rs:13:23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Backtrace
thread 'rustc' panicked at 'Box<Any>', /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2/src/libstd/macros.rs:13:23
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1076
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1537
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:198
9: std::panicking::default_hook
at src/libstd/panicking.rs:218
10: rustc_driver::report_ice
11: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:490
12: std::panicking::begin_panic
13: rustc_errors::HandlerInner::span_bug
14: rustc_errors::Handler::span_bug
15: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
16: rustc_middle::ty::context::tls::with_opt::{{closure}}
17: rustc_middle::ty::context::tls::with_opt
18: rustc_middle::util::bug::opt_span_bug_fmt
19: rustc_middle::util::bug::span_bug_fmt
20: rustc_typeck::check::FnCtxt::local_ty::{{closure}}
21: rustc_typeck::check::FnCtxt::local_ty
22: rustc_typeck::check::FnCtxt::instantiate_value_path
23: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
24: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
25: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
26: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
27: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
28: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
29: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
30: <T as rustc_middle::ty::context::InternIteratorElement<T,R>>::intern_with
31: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
32: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
33: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match
34: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
35: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
36: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
37: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
38: rustc_typeck::check::FnCtxt::check_argument_types
39: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
40: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
41: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
42: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
43: rustc_typeck::check::FnCtxt::check_argument_types
44: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
45: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
46: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
47: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
48: rustc_typeck::check::FnCtxt::check_stmt
49: rustc_typeck::check::FnCtxt::check_block_with_expected
50: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
51: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
52: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match
53: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
54: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
55: rustc_typeck::check::FnCtxt::check_stmt
56: rustc_typeck::check::FnCtxt::check_block_with_expected
57: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
58: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
59: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
60: rustc_typeck::check::check_fn
61: rustc_middle::ty::context::GlobalCtxt::enter_local
62: rustc_typeck::check::typeck_tables_of
63: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck_tables_of>::compute
64: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
65: rustc_query_system::query::plumbing::get_query_impl
66: rustc_query_system::query::plumbing::ensure_query_impl
67: rustc_typeck::check::typeck_item_bodies
68: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck_item_bodies>::compute
69: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
70: rustc_query_system::query::plumbing::get_query_impl
71: rustc_typeck::check_crate
72: rustc_interface::passes::analysis
73: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
74: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
75: rustc_query_system::query::plumbing::get_query_impl
76: rustc_middle::ty::context::tls::enter_global
77: rustc_interface::interface::run_compiler_in_existing_thread_pool
78: rustc_ast::attr::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
This issue has been assigned to @jakubadamw via this comment.