Skip to content

ICE with nested slice pattern #35077

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
eefriedman opened this issue Jul 27, 2016 · 1 comment
Closed

ICE with nested slice pattern #35077

eefriedman opened this issue Jul 27, 2016 · 1 comment

Comments

@eefriedman
Copy link
Contributor

Testcase:

#![feature(slice_patterns)]
fn main() { let x: &[i32] = &[]; let &[[_a, ref _b..]..] = x; }

Gives:

error: internal compiler error: ../src/librustc_mir/build/matches/mod.rs:155: match pairs [MatchPair { lvalue: (*var0), pattern: Pattern { ty: [i32], span: <anon>:2:39: 2:57, kind: Slice { prefix: [], slice: Some(Pattern { ty: [i32], span: <anon>:2:40: 2:54, kind: Slice { prefix: [Pattern { ty: i32, span: <anon>:2:41: 2:43, kind: Binding { mutability: Not, name: _a(61), mode: ByValue, var: 20, ty: i32, subpattern: None } }], slice: Some(Pattern { ty: [i32], span: <anon>:2:45: 2:51, kind: Binding { mutability: Not, name: _b(62), mode: ByRef(ReScope(CodeExtent(14/Remainder(BlockRemainder { block: 6, first_statement_index: 1 }))), Shared), var: 21, ty: &[i32], subpattern: None } }), suffix: [] } }), suffix: [] } }, slice_len_checked: false }] remaining after simplifying irrefutable pattern
 --> <anon>:2:39
  |
2 | fn main() { let x: &[i32] = &[]; let &[[_a, ref _b..]..] = x; }
  |                                       ^^^^^^^^^^^^^^^^^^

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

thread 'rustc' panicked at 'Box<Any>', ../src/librustc_errors/lib.rs:580
note: Run with `RUST_BACKTRACE=1` for a backtrace.

CC @arielb1

@eefriedman
Copy link
Contributor Author

Actually, taking another look, closing this in favor of the original bug; it looks like the original issue still exists. The ICE is just a symptom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant