Skip to content

ICE matching a tuple containing a string #14393

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
lucy opened this issue May 24, 2014 · 0 comments
Closed

ICE matching a tuple containing a string #14393

lucy opened this issue May 24, 2014 · 0 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@lucy
Copy link
Contributor

lucy commented May 24, 2014

Code:

fn main() {
    match ("", ()) {
        (_, _) => (),
        ("", _) => (),
    }
}

Output:

~ > rustc test.rs
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 0 but the index is 0', /build/rust-git/src/rust/src/librustc/middle/check_match.rs:262
stack backtrace:
   1:     0x7fb6b7174290 - rt::backtrace::imp::write::h2bd81792b12baabaPUy::v0.11.0.pre
   2:     0x7fb6b70f1020 - rt::unwind::begin_unwind_inner::hf025459ac89965dbXuy::v0.11.0.pre
   3:     0x7fb6b70e97e0 - rt::unwind::begin_unwind_fmt::hdf2abde05ea171af7ty::v0.11.0.pre
   4:     0x7fb6b7174030 - rust_begin_unwind
   5:     0x7fb6b71b6120 - failure::begin_unwind::hd8511e7163654fd6IOv::v0.11.0.pre
   6:     0x7fb6b71b6d70 - failure::fail_bounds_check::ha1974902474a29f7IMv::v0.11.0.pre
   7:     0x7fb6b7e3d900 - <unknown>
   8:     0x7fb6b7e3d900 - <unknown>
   9:     0x7fb6b7e43830 - <unknown>
  10:     0x7fb6b7e3d900 - <unknown>
  11:     0x7fb6b7e43830 - <unknown>
  12:     0x7fb6b7e3d900 - <unknown>
  13:     0x7fb6b7e37170 - <unknown>
  14:     0x7fb6b7e3ced0 - <unknown>
  15:     0x7fb6b7e39d90 - <unknown>
  16:     0x7fb6b7e3a960 - <unknown>
  17:     0x7fb6b7e3a010 - middle::check_match::check_crate::h4ecc262850114c4bYQw::v0.11.0.pre
  18:     0x7fb6b7e32380 - <unknown>
  19:     0x7fb6b82a2f60 - driver::driver::phase_3_run_analysis_passes::h9fe69b3bb03d321dITj::v0.11.0.pre
  20:     0x7fb6b829c160 - driver::driver::compile_input::hc60c22b08c843c82iJj::v0.11.0.pre
  21:     0x7fb6b8367980 - <unknown>
  22:     0x7fb6b83678a0 - <unknown>
  23:     0x7fb6b837cb70 - <unknown>
  24:     0x7fb6b8377e60 - <unknown>
  25:     0x7fb6ba209f10 - <unknown>
  26:     0x7fb6b716e410 - <unknown>
  27:     0x7fb6b71cbdf0 - rust_try
  28:     0x7fb6b716e360 - rt::task::Task::run::h5672b3545148c66eAjw::v0.11.0.pre
  29:     0x7fb6ba209cc0 - <unknown>
  30:     0x7fb6b7172690 - <unknown>
  31:     0x7fb6b6ab8060 - start_thread
  32:     0x7fb6b6db8489 - __clone
  33:                0x0 - <unknown>
~ > rustc -v
rustc 0.11.0-pre (87ad19e 2014-05-22 15:16:31 -0700)
host: x86_64-unknown-linux-gnu
@lucy lucy changed the title ICE matching a string tuple ICE matching a tuple containing a string May 24, 2014
@bors bors closed this as completed in 76f7eee Jun 21, 2014
nrc pushed a commit to nrc/rust that referenced this issue Aug 22, 2014
String patterns should have a single constructor of arity 0.
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 5, 2023
…th-expr, r=HKalbasi

Normalize associated types in paths in expressions

Part of rust-lang#14393

When we resolve paths in expressions (either path expressions or paths in struct expressions), there's a need of projection normalization, which `TyLoweringContext` cannot do on its own. We've been properly applying normalization for paths in struct expressions without type anchor, but not for others:

```rust
enum E {
    S { v: i32 }
    Empty,
}

impl Foo for Bar {
    type Assoc = E;
    fn foo() {
        let _ = Self::Assoc::S { v: 42 };   // path in struct expr without type anchor; we already support this
        let _ = <Self>::Assoc::S { v: 42 }; // path in struct expr with type anchor; resolves with this PR
        let _ = Self::Assoc::Empty;         // path expr; resolves with this PR
    }
}
```

With this PR we correctly resolve the whole path, but we need some more tweaks in HIR and/or IDE layers to properly resolve a qualifier (prefix) of such paths and provide IDE features that are pointed out in rust-lang#14393 to be currently broken.
flip1995 added a commit to flip1995/rust that referenced this issue Mar 20, 2025
Last part of rust-lang/rust-clippy#11421.

Now all ui tests require annotations.

The change in `ui_test` is to add `ICE:` errors.

changelog: Make internals ui tests annotations mandatory

r? @flip1995
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

2 participants