Skip to content

Debuginfo changes causing ICE #55606

Closed

Description

@sophiajt

A recent change to debug info (possibly 0db7abe) seems to be causing ICEs with code like the following:

#![feature(never_type)]
#![feature(nll)]

#[derive(Copy, Clone)]
pub struct Entity {
    private: std::num::NonZeroU32,
}

#[derive(Copy, Clone, PartialEq, Eq)]
pub struct Declaration;

impl TypeFamily for Declaration {
    type Base = Base;
    type Placeholder = !;

    fn intern_base_data(_: BaseKind<Self>) {}
}

#[derive(Copy, Clone)]
pub struct Base;

pub trait TypeFamily: Copy + 'static {
    type Base: Copy;
    type Placeholder: Copy;

    fn intern_base_data(_: BaseKind<Self>);
}

#[derive(Copy, Clone)]
pub enum BaseKind<F: TypeFamily> {
    Named(Entity),
    Placeholder(F::Placeholder),
    Error,
}

Compiled with:

rustc src/lib.rs -C debuginfo=2  --crate-type lib 

Edit: Platform info:

jonathan@pop-os:~/Source/lark/components/lark-ty$ rustc --version
rustc 1.31.0-nightly (de9666f12 2018-10-31)

Activity

  1. nikomatsakis commented on Nov 2, 2018

    @nikomatsakis
    Contributor

    cc @tromey -- we believe this was caused by #54004 (bisection)

  2. nikomatsakis commented on Nov 2, 2018

    @nikomatsakis
    Contributor

    Also, note that the exact rustc line is required (in particular, --crate-type lib).

    The assertion failures I see are:

    thread 'main' panicked at 'assertion failed: `(left == right)`
      left: `18446744073709551615`,
     right: `340282366920938463463374607431768211455`', librustc_codegen_llvm/debuginfo/metadata.rs:1367:29
    note: Run with `RUST_BACKTRACE=1` for a backtrace.
    

    with this backtrace found here.

  3. self-assigned this
    on Nov 2, 2018
  4. tromey commented on Nov 2, 2018

    @tromey
    Contributor

    You can make it fail without --crate-type lib by adding a main that uses BaseKind:

    pub fn main() {
        let x = BaseKind::Error::<Declaration>;
        let y = 7;
    }
    
  5. tromey commented on Nov 2, 2018

    @tromey
    Contributor

    This assert:

    assert_eq!(niche as u64 as u128, niche);
    

    is wrong if niche underflows to -1u128.

    Just removing the assert is probably fine. However I wonder if the values should actually be truncated to the size of the tag slot.

  6. added a commit that references this issue on Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions