Skip to content

ICE: With writeln! after recent changes in std::fmt #19142

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
japaric opened this issue Nov 20, 2014 · 2 comments
Closed

ICE: With writeln! after recent changes in std::fmt #19142

japaric opened this issue Nov 20, 2014 · 2 comments
Labels
A-syntaxext Area: Syntax extensions I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@japaric
Copy link
Member

japaric commented Nov 20, 2014

STR

use std::fmt::Show;
use std::io::PipeStream;

struct Program {
    stdin: PipeStream,
}

impl Program {
    fn send<T: Show>(&mut self, line: T) -> &mut Program {
        // OK
        //match writeln!(&mut self.stdin, "{}", line) {
        // ICE
        match writeln!(self.stdin, "{}", line) {
            Err(_) => panic!(),
            Ok(_) => self,
        }
    }
}

fn main() {}

Output

task 'rustc' panicked at 'index out of bounds: the len is 6 but the index is 6', /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/src/libsyntax/lib.rs:1

stack backtrace:
   1:     0x7f7ac0e18a30 - rt::backtrace::imp::write::h2b9052e6d9bc7115y9s
   2:     0x7f7ac0e1bbd0 - <unknown>
   3:     0x7f7ac15bdea0 - unwind::begin_unwind_inner::h045530faf4b26040nbd
   4:     0x7f7ac15bdb20 - unwind::begin_unwind_fmt::hbb3cb48652ded377y8c
   5:     0x7f7ac15bdae0 - rust_begin_unwind
   6:     0x7f7ac15fa590 - panicking::panic_fmt::hc3aa7deba1f6ed540Nl
   7:     0x7f7ac15ff980 - panicking::panic_bounds_check::h40d1ef7dd63df707yMl
   8:     0x7f7abec8bba0 - codemap::FileMap::get_line::haca5f2812f60e330m4E
   9:     0x7f7abecba5c0 - <unknown>
  10:     0x7f7abecb6fe0 - diagnostic::EmitterWriter.Emitter::emit::h8944016a574210b0lrG
  11:     0x7f7abecb5860 - diagnostic::Handler::emit::hef6d94e096dac3f1F8F
  12:     0x7f7abec88380 - diagnostic::SpanHandler::span_err::he4174115bd82cc5fEWF
  13:     0x7f7ac00875d0 - middle::typeck::infer::InferCtxt<'a, 'tcx>::type_error_message_str_with_expected::h0350e4ffa557951e6rF
  14:     0x7f7abffd1cc0 - middle::typeck::infer::InferCtxt<'a, 'tcx>::type_error_message::h216c2650f9e1a343qxF
  15:     0x7f7abffdb420 - <unknown>
  16:     0x7f7abffdb420 - <unknown>
  17:     0x7f7ac0011ca0 - middle::typeck::check::check_decl_local::hba8b231eaafb10e9vao
  18:     0x7f7ac0011e60 - middle::typeck::check::check_stmt::ha5de4679bb4bc747vco
  19:     0x7f7abff93bc0 - <unknown>
  20:     0x7f7abffdb420 - <unknown>
  21:     0x7f7abfec6f70 - middle::typeck::check::_match::check_match::h4e3330be3e1c359eyz8
  22:     0x7f7abffdb420 - <unknown>
  23:     0x7f7abff93bc0 - <unknown>
  24:     0x7f7abff6b9b0 - <unknown>
  25:     0x7f7abff904c0 - <unknown>
  26:     0x7f7abff96bd0 - <unknown>
  27:     0x7f7abff8c2b0 - middle::typeck::check::check_item::hd604129538ea4d11VQi
  28:     0x7f7abff90150 - middle::typeck::check::check_item_types::h1a3e4c15e3ead8aeXvi
  29:     0x7f7ac0333c60 - <unknown>
  30:     0x7f7ac0332e70 - middle::typeck::check_crate::he5192d314e6838dfhdM
  31:     0x7f7ac1ab8bf0 - driver::driver::phase_3_run_analysis_passes::he238813c217c3b94efS
  32:     0x7f7ac1aada10 - driver::driver::compile_input::h117f94c1b348a398YVR
  33:     0x7f7ac1b323d0 - <unknown>
  34:     0x7f7ac1b322c0 - <unknown>
  35:     0x7f7ac193ef30 - <unknown>
  36:     0x7f7ac193ed20 - <unknown>
  37:     0x7f7ac1e52b70 - <unknown>
  38:     0x7f7ac160cfe0 - <unknown>
  39:     0x7f7ac160cfd0 - rust_try
  40:     0x7f7ac15bb800 - unwind::try::h03ead95328113b2fIZc
  41:     0x7f7ac15bb690 - task::Task::run::hed7dc0cf620a0172y5b
  42:     0x7f7ac1e528b0 - <unknown>
  43:     0x7f7ac15bceb0 - <unknown>
  44:     0x7f7abc08a1d0 - start_thread
  45:     0x7f7ac12941b9 - clone
  46:                0x0 - <unknown>

Version

Equivalent code was compiling with:

rustc 0.13.0-nightly (e09d98603 2014-11-18 23:51:43 +0000)

But now it's ICEing on: 1d81776

I think #19040 may have introduced the ICE.

cc @alexcrichton

@ghost
Copy link

ghost commented Nov 20, 2014

This is a dupe of #14091, closing.

@ghost ghost closed this as completed Nov 20, 2014
@ghost
Copy link

ghost commented Nov 20, 2014

The real error here is obscured by a well-known bug in codemap that causes diagnostics to blow up if they originate in code expanded from external macros. We really need to fix that one...

@huonw huonw added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-syntaxext Area: Syntax extensions labels Nov 21, 2014
pfalabella added a commit to pfalabella/rust-rosetta that referenced this issue Nov 21, 2014
GauravBholaris pushed a commit to GauravBholaris/criterion.rs that referenced this issue Jul 20, 2022
lnicola pushed a commit to lnicola/rust that referenced this issue Feb 17, 2025
Spawn toolchain querying processes in parallel
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-syntaxext Area: Syntax extensions I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants