Issue 1:
If you do write!(w, ..) instead of write!(&mut w, ..).

task 'rustc' panicked at 'index out of bounds: the len is 6 but the index is 6', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/lib.rs:1

stack backtrace:
1: 0x7fabba9c69c0 - rt::backtrace::imp::write::h7fe8534f465d0e09y9s
2: 0x7fabba9c9b60 - failure::on_fail::h3fe2ecde6aab0bb8rwt
3: 0x7fabbb18fc80 - unwind::begin_unwind_inner::he6bc2073d4eb582enbd
4: 0x7fabbb18f900 - unwind::begin_unwind_fmt::h305b4b28825355b2y8c
5: 0x7fabbb18f8c0 - rust_begin_unwind
6: 0x7fabbb1d5a70 - panicking::panic_fmt::h9d03fcf6b4c3f8e10Nl
7: 0x7fabbb1dae60 - panicking::panic_bounds_check::h5c6357fea6530f04yMl
8: 0x7fabb883a130 - codemap::FileMap::get_line::h8bd7cfe56e6cfd5e1aF
9: 0x7fabb88689b0 - diagnostic::emit::h2322127ddc0c36debCG
10: 0x7fabb88653d0 - diagnostic::EmitterWriter.Emitter::emit::hb9a4d5c26c04e1df0xG
11: 0x7fabb8863c50 - diagnostic::Handler::emit::ha390aea82acc4940kfG
12: 0x7fabb8836910 - diagnostic::SpanHandler::span_err::h83b27707d23c7bfej3F
13: 0x7fabb9c34720 - middle::typeck::infer::InferCtxt<'a, 'tcx>::type_error_message_str_with_expected::h72941615d6be270289E
14: 0x7fabb9b40840 - middle::typeck::infer::InferCtxt<'a, 'tcx>::type_error_message::h3e78576a7aeba36csfF
15: 0x7fabb9b49f70 - middle::typeck::check::check_expr_with_unifier::h23742768f253d831DLl
16: 0x7fabb9b49f70 - middle::typeck::check::check_expr_with_unifier::h23742768f253d831DLl
17: 0x7fabb9bbec40 - middle::typeck::check::check_decl_local::h24893462a5fe4409xSn
18: 0x7fabb9bbee00 - middle::typeck::check::check_stmt::h1ca15bfe8a7d5a87xUn
19: 0x7fabb9af8d90 - middle::typeck::check::check_block_with_expected::heebc1a2b04a42760MYn
20: 0x7fabb9b49f70 - middle::typeck::check::check_expr_with_unifier::h23742768f253d831DLl
21: 0x7fabb9a75100 - middle::typeck::check::_match::check_match::h2c871678897b201eeA8
22: 0x7fabb9b49f70 - middle::typeck::check::check_expr_with_unifier::h23742768f253d831DLl
23: 0x7fabb9af8d90 - middle::typeck::check::check_block_with_expected::heebc1a2b04a42760MYn
24: 0x7fabb9b49f70 - middle::typeck::check::check_expr_with_unifier::h23742768f253d831DLl
25: 0x7fabb9bbee00 - middle::typeck::check::check_stmt::h1ca15bfe8a7d5a87xUn
26: 0x7fabb9af8d90 - middle::typeck::check::check_block_with_expected::heebc1a2b04a42760MYn
27: 0x7fabb9af4810 - middle::typeck::check::check_fn::hd39b1b6b62f22c3fici
28: 0x7fabb9af4530 - middle::typeck::check::check_bare_fn::h779ff7b2db70ca5bn1h
29: 0x7fabb9afbda0 - middle::typeck::check::check_method_body::h6418d5a11969c3d7nwi
30: 0x7fabb9af0310 - middle::typeck::check::check_item::hde22067b8b575546vli
31: 0x7fabb9af3e60 - visit::walk_mod::h974639367282189498
32: 0x7fabb9af3e60 - visit::walk_mod::h974639367282189498
33: 0x7fabb9af41c0 - middle::typeck::check::check_item_types::h7118271db2ab8ea8x0h
34: 0x7fabb9ee0e10 - util::common::time::h4997555828079517418
35: 0x7fabb9ee0020 - middle::typeck::check_crate::h0949dffd97487b5ejVL
36: 0x7fabbb693a10 - driver::driver::phase_3_run_analysis_passes::h7f3610cf195b4c3abfS
37: 0x7fabbb688830 - driver::driver::compile_input::h13734d451479d6e7VVR
38: 0x7fabbb70d7b0 - driver::run_compiler::h0a1cb9376c105f68pUT
39: 0x7fabbb70d6a0 - driver::run::closure.59745
40: 0x7fabbb519ee0 - task::TaskBuilder<S>::try_future::closure.39051
41: 0x7fabbb519cd0 - task::TaskBuilder<S>::spawn_internal::closure.39022
42: 0x7fabbba2db90 - task::NativeSpawner.Spawner::spawn::closure.2472
43: 0x7fabbb1e84c0 - rust_try_inner
44: 0x7fabbb1e84b0 - rust_try
45: 0x7fabbb18d5e0 - unwind::try::h7c27f4e149aed3f2IZc
46: 0x7fabbb18d470 - task::Task::run::h75863ac7ddab20c0y5b
47: 0x7fabbba2d8d0 - task::NativeSpawner.Spawner::spawn::closure.2398
48: 0x7fabbb18ec90 - thread::thread_start::h7822af80b22f729bEqc
49: 0x7fabb5a4e0c0 - start_thread
50: 0x7fabbae54f89 - __clone
51: 0x0 - <unknown>

Issue 2:
Believed current test case

(pnkfelix says: "if you are looking at this bug, please try to keep this test up-to-date ... potentially by checking the newest linked dupes in the comment feed below.")

// Very

// sensitive
pub struct BytePos(pub u32);

// to particular

// line numberings / offsets

fn main() {
let x = BytePos(1);

assert!(x, x);
}

Original Bug Filed

Script to reproduce:

fn main() {
// if any comment line is removed, the ICE disappears
// adding more lines keep the ICE alive
//
//
//
//
//
//
//
//
//
assert!(vec!(1.0), vec!(1.0))
}

Backtrace:

$ RUST_BACKTRACE=1 rustc ice.rs
<std macros>:8:12: 13:23 error: cannot apply unary operator `!` to type `std::vec::Vec<<generic float #0>>`
<std macros>:8 if !$cond {
<std macros>:9 fail!($($arg),+)
<std macros>:10 }
<std macros>:11 );
<std macros>:12 )
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://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'index out of bounds: the len is 12 but the index is 12', /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/src/libsyntax/lib.rs:1
stack backtrace:
1: 0x7f0c3dda8180 - rt::backtrace::imp::write::h706b65acfe967902xTF::v0.11.pre
2: 0x7f0c3dd11730 - rt::unwind::begin_unwind_inner::hcc57db58853efcfdAtF::v0.11.pre
3: 0x7f0c3dda7e10 - <unknown>
4: 0x7f0c3dda7d30 - rust_fail_bounds_check
5: 0x7f0c3ddb9a90 - failure::fail_bounds_check::h8ed58f060b870dd6EwF::v0.11.pre
6: 0x7f0c3d1d80f0 - codemap::FileMap::get_line::hbf104ad3bfda6f77Drd::v0.11.pre
7: 0x7f0c3d1d4e90 - <unknown>
8: 0x7f0c3d1ccd40 - diagnostic::EmitterWriter.Emitter::emit::h7c42f3840a82760aQcc::v0.11.pre
9: 0x7f0c3d1c9f90 - diagnostic::Handler::emit::h971cc5635478154dV0b::v0.11.pre
10: 0x7f0c3d1c8ec0 - diagnostic::SpanHandler::span_err::h3735f152282993cc3Sb::v0.11.pre
11: 0x7f0c3eadda90 - middle::typeck::infer::InferCtxt<'a>::type_error_message_str_with_expected::he1b302cd7901cc2apJq::v0.11.pre
12: 0x7f0c3eb7f0e0 - middle::typeck::infer::InferCtxt<'a>::type_error_message::h6e536a01d806a7af7Qq::v0.11.pre
13: 0x7f0c3eb8d9f0 - <unknown>
14: 0x7f0c3eb8b250 - <unknown>
15: 0x7f0c3eb8d650 - <unknown>
16: 0x7f0c3eb7fb20 - <unknown>
17: 0x7f0c3eb7fb20 - <unknown>
18: 0x7f0c3eb5fd00 - middle::typeck::check::check_block_with_expected::hec61a0d86b711c5ck7c::v0.11.pre
19: 0x7f0c3eb5af90 - <unknown>
20: 0x7f0c3eb5ad30 - <unknown>
21: 0x7f0c3eb53790 - middle::typeck::check::check_item::he7c19452bac809220R8::v0.11.pre
22: 0x7f0c3eb5ab30 - middle::typeck::check::check_item_types::hca38e25e2d3c1969ek8::v0.11.pre
23: 0x7f0c3ec9d280 - <unknown>
24: 0x7f0c3ec9c090 - middle::typeck::check_crate::h540b9b663571145fQgw::v0.11.pre
25: 0x7f0c3f0e8e90 - driver::driver::phase_3_run_analysis_passes::h129732fc31300f8bbei::v0.11.pre
26: 0x7f0c3f0eef10 - driver::driver::compile_input::h36b4d97be6c65511gEi::v0.11.pre
27: 0x7f0c3f1143c0 - run_compiler::hd111892d49d8dfe1saq::v0.11.pre
28: 0x7f0c3f12ffb0 - <unknown>
29: 0x7f0c3f12e860 - <unknown>
30: 0x7f0c3f129020 - <unknown>
31: 0x7f0c3e2ce670 - <unknown>
32: 0x7f0c3dd9f430 - <unknown>
33: 0x7f0c3ddc04a0 - rust_try
34: 0x7f0c3dd9f270 - rt::task::Task::run::hd2e6ec18f16de5eeiiD::v0.11.pre
35: 0x7f0c3e2ce440 - <unknown>
36: 0x7f0c3dda6c60 - <unknown>
37: 0x7f0c3ba9c000 - start_thread
38: 0x7f0c3d9e43d9 - clone
39: 0x0 - <unknown>

Version:

$ rustc --version
rustc 0.11-pre (1001635 2014-05-10 09:56:34 -0700)
host: x86_64-unknown-linux-gnu