-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.P-lowLow priorityLow priorityT-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 following (invalid) code triggers an ICE:
trait Foo { }
fn foo<T: Foo>(x: T) { }
fn main() {
// '&mut int' also triggers an ICE, as does replacing 'int' with any other type.
// Just 'int' produces a very similar compile error, but with no ICE.
let x: |&int| = foo;
}
Compiler output:
$ RUST_BACKTRACE=1 rustc ice.rs
ice.rs:8:21: 8:24 error: the trait `Foo` is not implemented for the type `&int`
ice.rs:8 let x: |&int| = foo;
^~~
ice.rs:8:21: 8:24 note: the trait `Foo` must be implemented because it is required by `foo`
ice.rs:8 let x: |&int| = foo;
^~~
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'assertion failed: !ty::type_needs_infer(ty)', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc/middle/typeck/mod.rs:287
stack backtrace:
1: 0xb6240e70 - rt::backtrace::imp::write::h7a758165f6ba41d0scq
2: 0xb6243cb0 - failure::on_fail::h9832b9ccb4fdbc0e3xq
3: 0xb65bd590 - unwind::begin_unwind_inner::h34603f1d03c7301c7Rd
4: 0xb674db90 - unwind::begin_unwind::h16442260839102883864
5: 0xb6c3b800 - middle::typeck::write_ty_to_tcx::h8af730520c710be1amp
6: 0xb6c37e10 - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>::visit_node_id::hc06bb3e173d3905ecZO
7: 0xb6c363f0 - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h17ddfb3651503235cOO
8: 0xb6c39800 - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_local::h4608353f0c9b5790JSO
9: 0xb6c3aca0 - visit::walk_block::h11861875672251434685
10: 0xb6c37b90 - middle::typeck::check::writeback::resolve_type_vars_in_fn::h6349b48253cd1f93iJO
11: 0xb6c91630 - middle::typeck::check::check_bare_fn::he6d7c7b3bc920a95UhW
12: 0xb6c8d650 - middle::typeck::check::check_item::h60fc147f59e915423BW
13: 0xb6c913e0 - middle::typeck::check::check_item_types::he4f43b9788b1001f4gW
14: 0xb6f9d480 - middle::typeck::check_crate::closure.140551
15: 0xb676adc0 - util::common::time::h5171196413795613556
16: 0xb6f9c590 - middle::typeck::check_crate::hfe6d18bc6c2f50a0JEp
17: 0xb7008cf0 - driver::driver::phase_3_run_analysis_passes::h9d97fef3fdd62215JoC
18: 0xb7003970 - driver::driver::compile_input::h3c2343e4d8471330u5B
19: 0xb7089540 - driver::run_compiler::haa3ef0d50c3e4454LVF
20: 0xb7089420 - driver::run::closure.146534
21: 0xb67835b0 - task::TaskBuilder<S>::try_future::closure.104847
22: 0xb67833a0 - task::TaskBuilder<S>::spawn_internal::closure.104818
23: 0xb7707d60 - task::NativeSpawner.Spawner::spawn::closure.8448
24: 0xb65bd010 - unwind::try::try_fn::h8e5dedf36bdf5fe00Id
25: 0xb66197d0 - rust_try_inner
26: 0xb6619790 - rust_try
27: 0xb65bae40 - unwind::try::h4eb595f617e1a97fPGd
28: 0xb65bacb0 - task::Task::run::h7184ce8d54e7ef9aFMc
29: 0xb7707ac0 - task::NativeSpawner.Spawner::spawn::closure.8386
30: 0xb65bc540 - thread::thread_start::hbe8cf1b92d073927U7c
31: 0xb611ce30 - start_thread
32: 0xb64b4de2 - clone
33: 0x0 - <unknown>
This occurs under:
$ uname -a
Linux <hostname> 3.16-3-686-pae #1 SMP Debian 3.16.5-1 (2014-10-10) i686 GNU/Linux
$ rustc --version=verbose
rustc 0.13.0-nightly (45cbdec41 2014-11-07 00:02:18 +0000)
binary: rustc
commit-hash: 45cbdec4174778bf915f17561ef971c068a7fcbc
commit-date: 2014-11-07 00:02:18 +0000
host: i686-unknown-linux-gnu
release: 0.13.0-nightly
Metadata
Metadata
Assignees
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.P-lowLow priorityLow priorityT-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.