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

rustc panic due to improper string split #24182

Closed
offlinemark opened this issue Apr 8, 2015 · 5 comments
Closed

rustc panic due to improper string split #24182

offlinemark opened this issue Apr 8, 2015 · 5 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@offlinemark
Copy link
Contributor

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

@lilyball lilyball added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Apr 8, 2015
@JLeech
Copy link

JLeech commented Apr 19, 2015

You just mistype, as i think

let a: Vec<&str> = line.split(' ').collect();

@offlinemark
Copy link
Contributor Author

Yes, you're right. But even with the broken code, rustc shouldn't panic?

Edit: s/that/the broken code

@JLeech
Copy link

JLeech commented Apr 19, 2015

Why he should?
Types are correct: line break on str with iterator, which collected by collect() into Vec.

@richo
Copy link
Contributor

richo commented Apr 19, 2015

To be clear, there should be no inputs to rustc that cause it to panic, at
all.

On Sat, Apr 18, 2015 at 6:02 PM, JLeech notifications@github.com wrote:

Why he should?
Types are correct: line break on str with iterator, which collected by
collect() into Vec.


Reply to this email directly or view it on GitHub
#24182 (comment).

@arielb1
Copy link
Contributor

arielb1 commented Jun 18, 2015

Duplicate of #23589.

@arielb1 arielb1 closed this as completed Jun 18, 2015
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

No branches or pull requests

5 participants