Skip to content

ICE on a combination of type params, indexing a method and matching #16401

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
ghost opened this issue Aug 10, 2014 · 2 comments · Fixed by #16554
Closed

ICE on a combination of type params, indexing a method and matching #16401

ghost opened this issue Aug 10, 2014 · 2 comments · Fixed by #16554
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@ghost
Copy link

ghost commented Aug 10, 2014

Input:

extern crate syntax;

use std::gc::Gc;
use syntax::{ast, codemap};

fn main() {
    let v = vec![];
    match *v.get[0] {
        codemap::Spanned { node: ast::MetaWord(ref trace_type) } =>
            trace_type.get().to_string(),
        _ => unreachable!()
    }
}

Output:

src/trace_calls.rs:39:48: 39:51 error: attempted to take value of method `get` on type `&ReInfer(0) collections::vec::Vec<Gc<syntax::codemap::Spanned<syntax::ast::MetaItem_>>>`
src/trace_calls.rs:39             let trace_type = match *attributes.get[0] {
                                                                     ^~~
src/trace_calls.rs:39:48: 39:51 note: maybe a missing `()` to call it? If not, try an anonymous function.
src/trace_calls.rs:39             let trace_type = match *attributes.get[0] {
                                                                     ^~~
src/instrument.rs:1:1: 1:1 error: internal compiler error: Type parameter <generic #0>:syntax::ast::DefId{krate: 14u32, node: 109287u32} out of range when substituting (root type=<generic #0>:syntax::ast::DefId{krate: 14u32, node: 109287u32})
src/instrument.rs:1 /*!
                    ^
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /Users/jakub/rust/src/libsyntax/ast_util.rs:784
@ghost
Copy link
Author

ghost commented Aug 10, 2014

Backtrace:

stack backtrace:
   1:        0x104be15d5 - rt::backtrace::imp::write::hae68a22ce56435beoiq
   2:        0x104be4793 - failure::on_fail::hf8967f369f5e74c5Tyq
   3:        0x104ea2055 - unwind::begin_unwind_inner::h1f48c1ec631c1dc8S5d
   4:        0x102c8e882 - unwind::begin_unwind::h5926505211794541144
   5:        0x102c8e815 - diagnostic::SpanHandler::span_bug::he2a6db0f09da46ebsTD
   6:        0x10195f445 - driver::session::Session::span_bug::h0e901731857e85fbBKx
   7:        0x101a3b056 - middle::subst::SubstFolder<'a>.TypeFolder::fold_ty::h7eac83746cb1333bixW
   8:        0x101a3a72e - middle::subst::T.Subst::subst_spanned::h15305841671447511745
   9:        0x101c7c8fc - middle::ty::lookup_field_type::h9895f97838f2e255WgG
  10:        0x101cd4236 - middle::typeck::check::_match::check_struct_pat_fields::hc26eb96e6850c1e1WfI
  11:        0x101cd6d3d - middle::typeck::check::_match::check_struct_pat::h5dfa3b3fa3d630e2EmI
  12:        0x101ccc424 - middle::typeck::check::_match::check_pat::h1f95cf980fc0f59bhrI
  13:        0x101cc9880 - middle::typeck::check::_match::check_match::h3b8792269b558fddrWH
  14:        0x101d7fc90 - middle::typeck::check::check_expr_with_unifier::hdcfe0833f5648e0bzyT
  15:        0x101dd918c - middle::typeck::check::check_decl_local::hbcdc38469e486e90dAV
  16:        0x101dd93df - middle::typeck::check::check_stmt::h9388d42ea0e31e12kCV
  17:        0x101d48b0b - middle::typeck::check::check_block_with_expected::h311c10d48ccca09cvGV
  18:        0x101d803cf - middle::typeck::check::check_expr_with_unifier::hdcfe0833f5648e0bzyT
  19:        0x101cc99ee - middle::typeck::check::_match::check_match::h3b8792269b558fddrWH
  20:        0x101d7fc90 - middle::typeck::check::check_expr_with_unifier::hdcfe0833f5648e0bzyT
  21:        0x101d48e99 - middle::typeck::check::check_block_with_expected::h311c10d48ccca09cvGV
  22:        0x101d44dfe - middle::typeck::check::check_fn::h75db1c8be68fa789TQQ
  23:        0x101d44782 - middle::typeck::check::check_bare_fn::h5d961d8a6b77d5d0JFQ
  24:        0x101d3dbd2 - middle::typeck::check::check_item::h43514e2feccb4bb4xeR

@ftxqxd
Copy link
Contributor

ftxqxd commented Aug 11, 2014

Reduced test case:

extern crate syntax;
use syntax::codemap;

fn main() {
    match () {
        codemap::Spanned { node: 0 } => (),
        _ => unreachable!()
    }
}

bors added a commit to rust-lang-ci/rust that referenced this issue Jan 21, 2024
Expand lint tables && make clippy happy 🎉

This PR expands the lint tables on `./Cargo.toml` and thereby makes `cargo clippy` exit successfully! 🎉

Fixes rust-lang#15918

## How?

In the beginning there are some warnings for rustc.

Next, and most importantly, there is the clippy lint table. There are a few sections in there.

First there are the lint groups.

Second there are all lints which are permanently allowed with the reasoning why they are allowed.

Third there is a huge list of temporarily allowed lints. They should be removed in the mid-term, but incur a substantial amount of work, therefore they are allowed for now and can be worked on bit by bit.

Fourth there are all lints which should warn.

Additionally there are a few allow statements in the code for lints which should be permanently allowed in this specific place, but not in the whole code base.

## Follow up work
- [ ] Run clippy in CI
- [ ] Remove tidy test (at least `@Veykril` wrote this in rust-lang#15017)
- [ ] Work on temporarily allowed lints
bors added a commit to rust-lang-ci/rust that referenced this issue Jan 21, 2024
Work through temporarily allowed clippy lints, part 1

This is the first batch of not allowing but actually fixing the clippy lints. Each commit removes one lint from the lint table and then fixes the resulting warnings.

Follow-up to rust-lang#16401
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Feb 5, 2024
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

Successfully merging a pull request may close this issue.

2 participants