Skip to content

rustc panic due to improper string split #24182

Closed
@offlinemark

Description

@offlinemark

I tried this code:

fn main() {
    let st = "this is a string";
    let a: Vec(&str) = st.split(' ').collect();
    println!("{:?}", a);
}

and got this compiler output:

$ rustc str.rs
str.rs:3:12: 3:21 error: parenthesized parameters may only be used with a trait [E0214]
str.rs:3     let a: Vec(&str) = st.split(' ').collect();
                    ^~~~~~~~~
str.rs:3:15: 3:21 error: associated type bindings are not allowed here [E0229]
str.rs:3     let a: Vec(&str) = st.split(' ').collect();
                       ^~~~~~
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: !predicates.has_escaping_regions()', /Users/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-mac/build/src/librustc_typeck/check/mod.rs:1885

so here is my bug report!

Meta

$ rustc --verbose --version
rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02)
binary: rustc
commit-hash: 9854143cba679834bc4ef932858cd5303f015a0e
commit-date: 2015-04-02
build-date: 2015-04-02
host: x86_64-apple-darwin
release: 1.0.0-beta
$ RUST_BACKTRACE=1 rustc str.rs
str.rs:3:12: 3:21 error: parenthesized parameters may only be used with a trait [E0214]
str.rs:3     let a: Vec(&str) = st.split(' ').collect();
                    ^~~~~~~~~
str.rs:3:15: 3:21 error: associated type bindings are not allowed here [E0229]
str.rs:3     let a: Vec(&str) = st.split(' ').collect();
                       ^~~~~~
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: !predicates.has_escaping_regions()', /Users/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-mac/build/src/librustc_typeck/check/mod.rs:1885

stack backtrace:
   1:        0x109886f77 - sys::backtrace::write::h799ab135045ca9ca1LC
   2:        0x1098b4e4d - panicking::on_panic::h9502e488a92fc8bcHAI
   3:        0x1097d92de - rt::unwind::begin_unwind_inner::hf0537788ee16eadbiiI
   4:        0x105def32f - rt::unwind::begin_unwind::h4512943908055748573
   5:        0x105e654c9 - check::FnCtxt<'a, 'tcx>::add_obligations_for_parameters::hce6795515219f2632Ep
   6:        0x105eac589 - check::wf::BoundsChecker<'cx, 'tcx>.TypeFolder<'tcx>::fold_ty::h64128c0bf80f4889MBl
   7:        0x105ed7a92 - check::GatherLocalsVisitor<'a, 'tcx>.Visitor<'tcx>::visit_local::h83d3d99027249c87yUn
   8:        0x105eb5d85 - check::check_fn::h410d0ffafb47f675l1n
   9:        0x105ed432e - check::check_bare_fn::h05c77be534ada2cfUQn
  10:        0x105ecdee2 - check::check_item::h9d89bedf29e4fe82F9n
  11:        0x105faa676 - check_crate::closure.36302
  12:        0x105fa4ae7 - check_crate::h09aa7856a322fd44bwC
  13:        0x105cc7355 - driver::phase_3_run_analysis_passes::h1af60e7c926ca39dgGa
  14:        0x105caba85 - driver::compile_input::h27cf4320fd56e5cbQba
  15:        0x105d69a15 - run_compiler::h93c68a2a3c26052bV4b
  16:        0x105d671e2 - boxed::F.FnBox<A>::call_box::h4498816167135712709
  17:        0x105d666d7 - rt::unwind::try::try_fn::h2387014819904265058
  18:        0x10993eea8 - rust_try_inner
  19:        0x10993ee95 - rust_try
  20:        0x105d669ca - boxed::F.FnBox<A>::call_box::h4850138824497903476
  21:        0x10989e37d - sys::thread::create::thread_start::h42d6d904fce5365aihH
  22:     0x7fff9112f267 - _pthread_body
  23:     0x7fff9112f1e4 - _pthread_start

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions