-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
The rust compiler panicks when compiling the following code:
extern crate rand;
extern crate symphony_fpga;
use rand::{thread_rng, Rng};
use symphony_fpga::*;
fn rand_string(chars: &mut [u8]) {
let charset: Vec<u8> = String::from("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZ1234567890").into_bytes();
let rnos: Vec<usize> = (0..chars.len())
.map(|_| thread_rng().gen_range::<usize>(0, charset.len()))
.collect();
for i in 0..chars.len() {
chars[i] = charset[rnos[i]];
}
chars[chars.len()-1] = '\0' as u8;
}
fn main() {
// Initialize AWS libraries
assert!(init_aws().is_ok());
// Configuration
let slot_id = 0;
let queue_id = 0;
let mut dma = DMAQueue::new(slot_id, queue_id).unwrap();
// Input buffer
let len = 1 << 10;
let mut buf = vec![0u8; len];
rand_string(buf.as_ref());
// Write data
for channel in 0..4 {
let write_address: i64 = 0x10000000 + channel*(1 << 34);
assert!(dma.sync_write(buf.as_ref(), write_address).is_ok());
}
// Read data
for channel in 0..4 {
let read_address:i64 = 0x10000000 + channel*(1 << 34);
assert!(dma.sync_read(out.as_ref(), read_address).is_ok());
}
}
Backtrace
It produces the following backtrace
error: internal compiler error: librustc/traits/structural_impls.rs:180: impossible case reached
thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:554:9
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::print
at libstd/sys_common/backtrace.rs:71
at libstd/sys_common/backtrace.rs:59
2: std::panicking::default_hook::{{closure}}
at libstd/panicking.rs:211
3: std::panicking::default_hook
at libstd/panicking.rs:227
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:467
6: std::panicking::begin_panic
7: rustc_errors::Handler::bug
8: rustc::session::opt_span_bug_fmt::{{closure}}
9: rustc::ty::context::tls::with_opt::{{closure}}
10: rustc::ty::context::tls::with_context_opt
11: rustc::ty::context::tls::with_opt
12: rustc::session::opt_span_bug_fmt
13: rustc::session::bug_fmt
14: rustc::traits::structural_impls::<impl rustc::ty::context::Lift<'tcx> for rustc::traits::SelectionError<'a>>::lift_to_tcx
15: rustc::traits::select::SelectionContext::candidate_from_obligation
16: rustc::traits::select::SelectionContext::evaluate_stack
17: rustc::ty::context::tls::with_context
18: rustc::dep_graph::graph::DepGraph::with_anon_task
19: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
20: rustc::traits::select::SelectionContext::evaluate_candidate
21: <&'a mut I as core::iter::iterator::Iterator>::next
22: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
23: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache
24: rustc::ty::context::tls::with_context
25: rustc::dep_graph::graph::DepGraph::with_anon_task
26: rustc::traits::select::SelectionContext::candidate_from_obligation
27: rustc::traits::select::SelectionContext::evaluate_stack
28: rustc::ty::context::tls::with_context
29: rustc::dep_graph::graph::DepGraph::with_anon_task
30: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
31: rustc::traits::select::SelectionContext::evaluate_candidate
32: <&'a mut I as core::iter::iterator::Iterator>::next
33: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
34: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache
35: rustc::ty::context::tls::with_context
36: rustc::dep_graph::graph::DepGraph::with_anon_task
37: rustc::traits::select::SelectionContext::candidate_from_obligation
38: rustc::traits::select::SelectionContext::evaluate_stack
39: rustc::ty::context::tls::with_context
40: rustc::dep_graph::graph::DepGraph::with_anon_task
41: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
42: rustc::traits::select::SelectionContext::evaluate_candidate
43: <&'a mut I as core::iter::iterator::Iterator>::next
44: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
45: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache
46: rustc::ty::context::tls::with_context
47: rustc::dep_graph::graph::DepGraph::with_anon_task
48: rustc::traits::select::SelectionContext::candidate_from_obligation
49: rustc::traits::select::SelectionContext::evaluate_stack
50: rustc::ty::context::tls::with_context
51: rustc::dep_graph::graph::DepGraph::with_anon_task
52: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
53: rustc::traits::select::SelectionContext::evaluate_candidate
54: <&'a mut I as core::iter::iterator::Iterator>::next
55: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
56: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache
57: rustc::ty::context::tls::with_context
58: rustc::dep_graph::graph::DepGraph::with_anon_task
59: rustc::traits::select::SelectionContext::candidate_from_obligation
60: rustc::traits::select::SelectionContext::evaluate_stack
61: rustc::ty::context::tls::with_context
62: rustc::dep_graph::graph::DepGraph::with_anon_task
63: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
64: rustc::traits::select::SelectionContext::evaluate_candidate
65: <&'a mut I as core::iter::iterator::Iterator>::next
66: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
67: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache
68: rustc::ty::context::tls::with_context
69: rustc::dep_graph::graph::DepGraph::with_anon_task
70: rustc::traits::select::SelectionContext::candidate_from_obligation
71: rustc::traits::select::SelectionContext::evaluate_stack
72: rustc::ty::context::tls::with_context
73: rustc::dep_graph::graph::DepGraph::with_anon_task
74: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
75: rustc::traits::select::SelectionContext::evaluate_candidate
76: <&'a mut I as core::iter::iterator::Iterator>::next
77: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
78: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache
79: rustc::ty::context::tls::with_context
80: rustc::dep_graph::graph::DepGraph::with_anon_task
81: rustc::traits::select::SelectionContext::candidate_from_obligation
82: rustc::traits::select::SelectionContext::evaluate_stack
83: rustc::ty::context::tls::with_context
84: rustc::dep_graph::graph::DepGraph::with_anon_task
85: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
86: rustc::traits::select::SelectionContext::evaluate_candidate
87: <&'a mut I as core::iter::iterator::Iterator>::next
88: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
89: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache
90: rustc::ty::context::tls::with_context
91: rustc::dep_graph::graph::DepGraph::with_anon_task
92: rustc::traits::select::SelectionContext::candidate_from_obligation
93: rustc::traits::select::SelectionContext::evaluate_stack
94: rustc::ty::context::tls::with_context
95: rustc::dep_graph::graph::DepGraph::with_anon_task
96: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
97: rustc::traits::select::SelectionContext::evaluate_candidate
98: <&'a mut I as core::iter::iterator::Iterator>::next
99: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `&'_ _: std::io::Write`
#1 [typeck_tables_of] processing `main`
#2 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to previous error
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.27.1 (5f2b325f6 2018-07-07) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
Compiler Version
$rustc --version --verbose
rustc 1.27.1 (5f2b325f6 2018-07-07)
binary: rustc
commit-hash: 5f2b325f64ed6caa7179f3e04913db437656ec7e
commit-date: 2018-07-07
host: x86_64-unknown-linux-gnu
release: 1.27.1
LLVM version: 6.0
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.