Skip to content

ICE type of value must be know in this context #20506

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
pentlander opened this issue Jan 4, 2015 · 2 comments · Fixed by #20897
Closed

ICE type of value must be know in this context #20506

pentlander opened this issue Jan 4, 2015 · 2 comments · Fixed by #20897
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@pentlander
Copy link

Arch linux

rustc 0.13.0-nightly (c89417130 2015-01-02 21:56:13 +0000)
binary: rustc
commit-hash: c89417130f042c58adc60012e7cddc4ef70b70b9
commit-date: 2015-01-02 21:56:13 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly
use std::io;

 struct Dice {
     num: uint,
     size: uint,
 }   

 fn parse_input(input: &str) -> Dice {
     let results = input.split('d').map(|num| num.parse::<uint>()).collect();
     println!("{}", results);                  
     Dice {num: results[0], size: results[1]}  
 }                                             

 fn main() {
     let input = io::stdin.read_line().ok();   
     let a = parse_input(input);
     println!("{}", a.num);
 }
main.rs:11:16: 11:26 error: the type of this value must be known in this context
main.rs:11     Dice {num: results[0], size: results[1]}
                          ^~~~~~~~~~
error: internal compiler error: no type for node 48: expr 1 (id=48) in fcx 0x7f3de57ec4b8
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
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:182

stack backtrace:
   1:     0x7f3ded0423e0 - sys::backtrace::write::h07654db4c803799asit
   2:     0x7f3ded067c10 - failure::on_fail::hcaec3177bc42e928Tuz
   3:     0x7f3decfcd2d0 - rt::unwind::begin_unwind_inner::hb226e8b72f3e677ey9y
   4:     0x7f3de8152e30 - rt::unwind::begin_unwind::h4014735294015536206
   5:     0x7f3de81536e0 - diagnostic::Handler::bug::h05b38468732b1c1dzLF
   6:     0x7f3deb1fbb30 - session::Session::bug::h6e1b76961f7f6c6eh8p
   7:     0x7f3dec610a40 - check::FnCtxt<'a, 'tcx>::node_ty::h148c45f33d9b05bbhul
   8:     0x7f3dec625f10 - check::writeback::WritebackCx<'cx, 'tcx>::visit_node_id::haedae18a10f6507bGDb
   9:     0x7f3dec6221a0 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h91e8e5224f7dbfd6Gtb
  10:     0x7f3dec6221a0 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h91e8e5224f7dbfd6Gtb
  11:     0x7f3dec6ebb20 - check::check_bare_fn::h8ccefd5610a5a146goj
  12:     0x7f3dec6e30c0 - check::check_item::h39fb2bbe81c824a9SGj
  13:     0x7f3dec8839d0 - check_crate::unboxed_closure.39848
  14:     0x7f3dec87e620 - check_crate::hb52a41bcb9b55409Vlx
  15:     0x7f3ded592620 - driver::phase_3_run_analysis_passes::h33329f43054c2979Tva
  16:     0x7f3ded580ac0 - driver::compile_input::h88016b50923aff2bwba
  17:     0x7f3ded64be00 - thunk::F.Invoke<A, R>::invoke::h18199457566815101468
  18:     0x7f3ded64abb0 - rt::unwind::try::try_fn::h5958693639131164017
  19:     0x7f3ded0ce510 - rust_try_inner
  20:     0x7f3ded0ce500 - rust_try
  21:     0x7f3ded64af00 - thunk::F.Invoke<A, R>::invoke::h2060855259774067648
  22:     0x7f3ded053f50 - sys::thread::thread_start::hb5d2265d5cf58673y8v
  23:     0x7f3de7977250 - start_thread
  24:     0x7f3decc83219 - clone
  25:                0x0 - <unknown>
@huonw huonw added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jan 4, 2015
@ghost
Copy link

ghost commented Jan 4, 2015

I believe I'm also affected.

OS: Arch Linux
Architecture: x86_64
rustc version:

rustc 0.13.0-nightly (c6c786671 2015-01-04 00:50:59 +0000)
binary: rustc
commit-hash: c6c786671d692d7b13c2e5c68a53001327b4b125
commit-date: 2015-01-04 00:50:59 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly

Backtrace:

$ RUST_BACKTRACE=1 rustc test.rs 
test.rs:5:9: 5:15 error: the type of this value must be known in this context
test.rs:5         arr[j] = 0.0f64;
                  ^~~~~~
error: internal compiler error: no type for node 46: expr j (id=46) in fcx 0x7fb2403ec488
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
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:182

stack backtrace:
   1:     0x7fb2481e72d0 - sys::backtrace::write::h8532e701ef86014f4it
   2:     0x7fb24820cb00 - failure::on_fail::h7532e1f79d134d5dzvz
   3:     0x7fb2481721c0 - rt::unwind::begin_unwind_inner::h97b151606151d62deaz
   4:     0x7fb243046c60 - rt::unwind::begin_unwind::h15809447133099964284
   5:     0x7fb243047510 - diagnostic::Handler::bug::h8818b567cf47e6a0DLF
   6:     0x7fb246381cf0 - session::Session::bug::h251da16737c526c0lrq
   7:     0x7fb2477a7ec0 - check::FnCtxt<'a, 'tcx>::node_ty::h8b4513e3177b34b9FAl
   8:     0x7fb2477bd390 - check::writeback::WritebackCx<'cx, 'tcx>::visit_node_id::hadb4e437b164af77oDb
   9:     0x7fb2477b9620 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h773756089457ec03otb
  10:     0x7fb2477b9620 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h773756089457ec03otb
  11:     0x7fb2477bd290 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_block::h73bb9a8ed95e2890Dub
  12:     0x7fb24788db40 - check::check_bare_fn::h592fda8aa741d710Qtj
  13:     0x7fb247885170 - check::check_item::h9827005a9cde6421CMj
  14:     0x7fb247a25fe0 - check_crate::unboxed_closure.40162
  15:     0x7fb247a20c30 - check_crate::h19fb6dea5733566ajsx
  16:     0x7fb248738640 - driver::phase_3_run_analysis_passes::h46b1604d9f9f5633Tva
  17:     0x7fb248726ae0 - driver::compile_input::h68b8602933aad8d7wba
  18:     0x7fb2487f1eb0 - thunk::F.Invoke<A, R>::invoke::h18029802347644288836
  19:     0x7fb2487f0c60 - rt::unwind::try::try_fn::h6518866316425934196
  20:     0x7fb248273400 - rust_try_inner
  21:     0x7fb2482733f0 - rust_try
  22:     0x7fb2487f0fb0 - thunk::F.Invoke<A, R>::invoke::h15513809553472565307
  23:     0x7fb2481f8e40 - sys::thread::thread_start::h5ea7ba97235331d5a9v
  24:     0x7fb24286b250 - start_thread
  25:     0x7fb247e29219 - clone
  26:                0x0 - <unknown>

test.rs:

fn main() {
    let mut arr = range(0, 10u).map(|_| 0.0f64).collect();
    let mut sum = 0.0f64;
    for j in range(0, 10u) {
        arr[j] = 0.0f64;
        sum += arr[j];
    }
}

@georgschoelly
Copy link

Here's yet another small code that triggers it:

use std::default::Default;
type new_progress = [u8; 5];

fn main() { }

fn combine_progress(a : [u8; 5], b : [u8; 5]) -> [u8; 5] {
    let mut new_progress = Default::default();

    for i in range(new_progress.len()) {
        new_progress[i] = std::cmp::max(a[i], b[i]);
    }

    new_progress
}

Output:

ice_no_type.rs:9:18: 9:43 error: this function takes 2 parameters but 1 parameter was supplied [E0061]
ice_no_type.rs:9         for i in range(new_progress.len()) {
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
ice_no_type.rs:9:24: 9:42 error: the type of this value must be known in this context
ice_no_type.rs:9         for i in range(new_progress.len()) {
                                        ^~~~~~~~~~~~~~~~~~
error: internal compiler error: no type for node 51: expr i (id=51) in fcx 0x106fee718
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
thread 'rustc' panicked at 'Box', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:182
stack backtrace:
   1:        0x1058f45e5 - sys::backtrace::write::h98e4664f4f31dc8eiTs
   2:        0x105919f4f - failure::on_fail::h15cffea110d6009eKVy
   3:        0x10587f40a - rt::unwind::begin_unwind_inner::h9de529c6f705175fKDy
   4:        0x103577dc7 - rt::unwind::begin_unwind::h8742058877264024887
   5:        0x103578738 - diagnostic::Handler::bug::h7bcbd2439c55014b0qF
   6:        0x102b4d3b8 - session::Session::bug::h59b8be8232d1ea9aBWp
   7:        0x1025cfc02 - check::FnCtxt<'a, 'tcx>::node_ty::h7c722fd7bb1fc88dRzl
   8:        0x1025e5bea - check::writeback::WritebackCx<'cx, 'tcx>::visit_node_id::h7a203c9d76d14e1epDb
   9:        0x1025e09e3 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::hfe8b1d3bea2ca17bptb
  10:        0x1025e440f - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_block::h7503b694ee05563dEub
  11:        0x1025e440f - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_block::h7503b694ee05563dEub
  12:        0x10267c5da - check::check_bare_fn::h9b4971f57fc7a4312sj
  13:        0x1026731cd - check::check_item::h8df47e8e18e344abOLj
  14:        0x10275f4f0 - check_crate::unboxed_closure.39887
  15:        0x10275ad53 - check_crate::hbc0ab8570a19149famx
  16:        0x10208d292 - driver::phase_3_run_analysis_passes::h61da41ec58961d9bSva
  17:        0x102079cac - driver::compile_input::h6ba151de4af50ce2vba
  18:        0x10213cc13 - thunk::F.Invoke::invoke::h15890902738341362910
  19:        0x102139d70 - rt::unwind::try::try_fn::h15939753852117214544
  20:        0x10597f009 - rust_try_inner
  21:        0x10597eff6 - rust_try
  22:        0x10213a4b6 - thunk::F.Invoke::invoke::h14011449182044061502
  23:        0x105905a34 - sys::thread::thread_start::h4e93ea2350249d53kGv
  24:     0x7fff932fe2fc - _pthread_body
  25:     0x7fff932fe279 - _pthread_body

Configuration:

rustc 0.13.0-nightly (c7dd3c4d6 2015-01-05 23:51:00 +0000)
binary: rustc
commit-hash: c7dd3c4d69aee1c4ad8cc220c194b176bba2ab62
commit-date: 2015-01-05 23:51:00 +0000
host: x86_64-apple-darwin
release: 0.13.0-nightly

barosl added a commit to barosl/rust that referenced this issue Jan 11, 2015
If the type of a node cannot be determined due to a previous type error,
a "no type for node" ICE occurs. This commit makes it return ty_err
instead in such a case.

Fixes rust-lang#20401.
Fixes rust-lang#20506.
Fixes rust-lang#20614.
Fixes rust-lang#20752.
Fixes rust-lang#20829.
Fixes rust-lang#20846.
Fixes rust-lang#20885.
Fixes rust-lang#20886.
bors added a commit that referenced this issue Jan 12, 2015
If the type of a node cannot be determined due to a previous type error, a `no type for node` ICE occurs. This commit makes it return `ty_err` instead in such a case.

Fixes #20401.
Fixes #20506.
Fixes #20614.
Fixes #20752.
Fixes #20829.
Fixes #20846.
Fixes #20885.
Fixes #20886.
Fixes #20952.
Fixes #20970.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants