Skip to content

Stable 1.34.0 compiler panic unexpected const parent in type_of_def_id() #60704

Closed

Description

@pantaloons

Following code sample causes a compiler panic. <32> should be <u32>.

use std::convert::TryInto;

fn main() {
    let x: u32 = 5i32.try_into::<32>().unwrap();
}
error: internal compiler error: src/librustc_typeck/collect.rs:1320: unexpected const parent in type_of_def_id(): Expr(expr(2289: entry.portfolio_id.try_into::<>()))

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:620:9
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to previous error


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: rustc 1.34.0 (91856ed52 2019-04-10) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C debuginfo=2 -C linker=external/ts_cc/gcc5/bin/x86_64-unknown-linux-gnu-gcc -C link-args=-lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -pass-exit-codes -Wl,-fuse-ld=gold -L/usr/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu -Wl,--gc-sections -static-libgcc --crate-type rlib

Activity

  1. added
    A-const-genericsArea: const generics (parameters and arguments)
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on May 10, 2019
  2. jonas-schievink commented on May 10, 2019

    @jonas-schievink
    Contributor

    Also happens on nightly. Likely due to const generics changes (cc @varkor).

  3. Centril commented on May 10, 2019

    @Centril
    Contributor

    Minimal reproduction:

    struct S;
    
    fn main() {
        S.f::<0>();
    }
  4. Centril commented on May 10, 2019

    @Centril
    Contributor

    Another case:

    struct S;
    
    fn main() {
        S::<0>;
    }
  5. added a commit that references this issue on May 13, 2019
    25b5d30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions