Skip to content
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

task 'rustc' failed at 'assertion failed: ty::type_is_sized(bcx.tcx(), contents_ty)', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/librustc/middle/trans/expr.rs:1503 #17118

Closed
glademiller opened this issue Sep 9, 2014 · 3 comments
Labels
A-DSTs Area: Dynamically-sized types (DSTs) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@glademiller
Copy link

I have a function defined like this which I suspect is not working because I'm doing it wrong but rustc isn't being very helpful.

fn get_page(uri: &str) -> Box<str> {
....
box *body.as_slice()
}
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. 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' failed at 'assertion failed: ty::type_is_sized(bcx.tcx(), contents_ty)', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/librustc/middle/trans/expr.rs:1503

stack backtrace:
   1:        0x10f052115 - rt::backtrace::imp::write::h38c3950ca30819fdNhr
   2:        0x10f055451 - failure::on_fail::h61277a1f47996a75Hyr
   3:        0x10f307875 - unwind::begin_unwind_inner::h486b778488114bbbb0d
   4:        0x10ba0cd3f - unwind::begin_unwind::h15688615720603158913
   5:        0x10be1d27f - middle::trans::expr::trans_uniq_expr::h40fb1130cbca349eit5
   6:        0x10be1dea3 - middle::trans::expr::trans_unary::hfc200761698d9538dp5
   7:        0x10be11d3c - middle::trans::expr::trans_unadjusted::h82416de87d2e89c4t73
   8:        0x10bdceffb - middle::trans::expr::trans_into::ha853a39b9a7f24dajk3
   9:        0x10bdcf264 - middle::trans::controlflow::trans_block::hd755847507381b83M8Y
  10:        0x10be7ee66 - middle::trans::base::trans_closure::h0c688b38a6dcca51gSf
  11:        0x10bdbf322 - middle::trans::base::trans_fn::h097de052d534817a33f
  12:        0x10bdbabf3 - middle::trans::base::trans_item::h7c651a6b253c43b1Sng
  13:        0x10be8977c - middle::trans::base::trans_crate::h8a752ffbd6768478rnh
  14:        0x10c2a8241 - driver::driver::phase_4_translate_to_llvm::hff28f92720c498desQD
  15:        0x10c2a11e8 - driver::driver::compile_input::h6fd531f77f6169fctsD
  16:        0x10c32bfaa - driver::run_compiler::hb663589ebabe2c20IjH
  17:        0x10c32a3b6 - driver::main_args::closure.147451
  18:        0x10ba42d6b - task::TaskBuilder<S>::try_future::closure.100018
  19:        0x10ba42c73 - task::TaskBuilder<S>::spawn_internal::closure.99989
  20:        0x10d6de2cd - task::spawn_opts::closure.8473
  21:        0x10f369d2c - rust_try_inner
  22:        0x10f369d16 - rust_try
  23:        0x10f304d17 - unwind::try::h513c5138bad9ea23lOd
  24:        0x10f304b8c - task::Task::run::h87d8d159864e6bc2L0c
  25:        0x10d6de122 - task::spawn_opts::closure.8412
  26:        0x10f3067ba - thread::thread_start::hb27c396f8741958eSld
  27:     0x7fff9337d899 - _pthread_body
  28:     0x7fff9337d72a - _pthread_struct_init
@huonw huonw added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-DSTs Area: Dynamically-sized types (DSTs) labels Sep 9, 2014
@nrc
Copy link
Member

nrc commented Sep 9, 2014

I believe this should fixed by a recent patch. Could try with a recent build of rustc please? (Tonights nightly, if you are using nightlies). If you are still getting problems, could you post the whole function please? In particular the definition of body.

@glademiller
Copy link
Author

Here is the complete function body with the correct code I eventually ended up with commented out. I'm on pre-nightlies right now but as soon as I can figure out how to get the nightlies installed I'll try with those. Current version rustc 0.12.0-pre-nightly (aaf141d 2014-09-07 23:01:34 +0000)

fn get_page(uri: &str) -> Box<str> {//String {
    let url = Url::parse(uri).unwrap();
    let request: RequestWriter = match RequestWriter::new(Get, url) {
        Ok(request) => request,
        Err(error) => fail!("{}", error),
    };
    let mut response = match request.read_response() {
        Ok(response) => response,
        Err((_request, error)) => fail!("{}", error),
    };
    let body = match response.read_to_string() {
        Ok(body) => body,
        Err(error) => fail!("Failed to read response body {}", error),
    };
    box *body.as_slice()//body
}

@nrc
Copy link
Member

nrc commented Sep 9, 2014

Thanks for the full code! I tested this with an up to date rustc (actually with a few patches in the process of landing too) and it no longer ICEs. The last line gives the correct error - "error: cannot move a value of type str: the size of str cannot be statically determined [E0161]". I had to make some changes to make it compile though so I may not be hitting exactly the code paths you are.

Closing this issue for now. Feel free to reopen if it still ICEs for you on an up to date rustc.

@nrc nrc closed this as completed Sep 9, 2014
lnicola pushed a commit to lnicola/rust that referenced this issue Apr 24, 2024
feat: Allow rust files to be used linkedProjects

With this, script files become more usable as the user can at least add them manually to the linked projects, allowing them to be used "on the (manual) fly" without having to open a separate vscode window that only has files open and no folder.

Also makes build scripts work for them (though no proc-macros, for some reason the dylib field is not populated in the output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-DSTs Area: Dynamically-sized types (DSTs) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants