Closed
Description
This is a minimal reproduction of something I saw when updating some of my projects to use Vec
.
use std::vec_ng::Vec;
fn main() {
let s = [1i, 2, 3];
let v: Vec<_> = s.iter().collect();
}
test.rs:5:21: 5:39 error: cannot determine a type for this bounded type parameter: unconstrained type
test.rs:5 let v: Vec<_> = s.iter().collect();
^~~~~~~~~~~~~~~~~~
This manifested in other ways in larger programs, ICEing in one case:
❯ env RUST_LOG=std::rt::backtrace make [rust-postgres/master *$=]
rustc -O --cfg ndebug -L submodules/rust-openssl/build/ -L submodules/rust-openssl/build/ -L submodules/rust-phf/build/ -L submodules/rust-phf/build/ -L submodules/rust-phf/build/ --dep-info build/postgres.d \
--out-dir build src/lib.rs
src/lib.rs:612:17: 612:42 error: the type of this value must be known in this context
src/lib.rs:612 PgUnknownType { oid, .. } =>
^~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:622:19: 622:26 error: the type of this value must be known in this context
src/lib.rs:622 match desc.ty {
^~~~~~~
error: internal compiler error: no type for node 74135: local oid (id=74135) in fcx 0x7f639ffba890
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_LOG=std::rt::backtrace` for a backtrace
task 'rustc' failed at '~Any', /build/rust-git/src/rust/src/libsyntax/diagnostic.rs:123
stack backtrace:
1: 0x7f63a9db6740 - rt::backtrace::imp::write::h584392c0aaf88f8agYb::v0.10.pre
2: 0x7f63a9d1b370 - rt::unwind::begin_unwind_inner::h39118a123ff832cbUzb::v0.10.pre
3: 0x7f63a80eac40 - <unknown>
4: 0x7f63a80eb820 - diagnostic::Handler::bug::h3def07bec623c5d9q3b::v0.10.pre
5: 0x7f63a5aa8580 - driver::session::Session_::bug::hc25e766e0c47b22fxyc::v0.10.pre
6: 0x7f63a5cc2f70 - middle::typeck::check::FnCtxt::node_ty::h3bb3bf7881b4ddbc4W6::v0.10.pre
7: 0x7f63a5ce35e0 - <unknown>
8: 0x7f63a5cea980 - <unknown>
9: 0x7f63a5cea980 - <unknown>
10: 0x7f63a5cea3e0 - <unknown>
11: 0x7f63a5ce8af0 - <unknown>
12: 0x7f63a5cea220 - <unknown>
13: 0x7f63a5ce8af0 - <unknown>
14: 0x7f63a5ce8af0 - <unknown>
15: 0x7f63a5cea220 - <unknown>
16: 0x7f63a5ce8af0 - <unknown>
17: 0x7f63a5ce8af0 - <unknown>
18: 0x7f63a5ce8800 - <unknown>
19: 0x7f63a5cea700 - <unknown>
20: 0x7f63a5ced8b0 - middle::typeck::check::writeback::resolve_type_vars_in_fn::h60db597186ed5046Vs1::v0.10.pre
21: 0x7f63a5d38ac0 - <unknown>
22: 0x7f63a5d424e0 - <unknown>
23: 0x7f63a5d33c20 - middle::typeck::check::check_item::h2dd1675c2d31364e1T5::v0.10.pre
24: 0x7f63a5d38910 - middle::typeck::check::check_item_types::ha39a6b2247f5d06aaA5::v0.10.pre
25: 0x7f63a5e32b70 - <unknown>
26: 0x7f63a5e31870 - middle::typeck::check_crate::h1776a18a6977a78cZvr::v0.10.pre
27: 0x7f63a6187f70 - driver::driver::phase_3_run_analysis_passes::hef56a7cb46a523e2WOa::v0.10.pre
28: 0x7f63a618eb80 - driver::driver::compile_input::h692b87098ca31f542bb::v0.10.pre
29: 0x7f63a61b2630 - run_compiler::h5fa6736bc743af23tNi::v0.10.pre
30: 0x7f63a61c5380 - <unknown>
31: 0x7f63a61c3cb0 - <unknown>
32: 0x7f63a61bf6e0 - <unknown>
33: 0x7f63a551d8c0 - <unknown>
34: 0x7f63a9db0080 - <unknown>
35: 0x7f63a9dbd1a0 - rust_try
36: 0x7f63a9dafec0 - rt::task::Task::run::h413709669c303bc5s58::v0.10.pre
37: 0x7f63a551d660 - <unknown>
38: 0x7f63a9db37b0 - <unknown>
39: 0x7f63a4a2afe0 - start_thread
40: 0x7f63a522ace9 - clone
41: 0x0 - <unknown>
This can be reproduced by taking sfackler/rust-postgres@c5abe8c and changing lines 592 and 598 of src/lib.rs to use partial type hints.
cc @Kimundi