Skip to content

ICE with repeated bound in impl and macro variable declaration #5554

Closed
@huonw

Description

@huonw

The macro is required, as is that exact order of the bounds, and the use of the repeated bound in the impl. (It's not specific to Zero though.)

// compile with --test

use core::num::Zero;

pub struct X<T> {
  a: T
}

// reordering these bounds stops the ICE
impl<T: Zero + Eq + Zero>
  Zero for X<T> {
    fn zero() -> X<T> {
      X { a: Zero::zero() }
    }
}

macro_rules! constants {
  () => {
    let _0 : X<int> = Zero::zero();
   }
}


fn test_X() {
  constants!();
}

RUST_LOG=.. output: https://gist.github.com/huonw/5246555

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions