Skip to content
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

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

Closed
huonw opened this issue Mar 26, 2013 · 2 comments
Closed

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

huonw opened this issue Mar 26, 2013 · 2 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@huonw
Copy link
Member

huonw commented Mar 26, 2013

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

@catamorphism
Copy link
Contributor

Works now, I'll check in a test case

@ghost ghost assigned catamorphism May 24, 2013
@catamorphism
Copy link
Contributor

Test case checked in in 9a06ff0. Closing

flip1995 pushed a commit to flip1995/rust that referenced this issue May 11, 2020
Allow `use super::*;` glob imports

changelog: Allow super::* glob imports

fixes rust-lang#5554
fixes rust-lang#5569

A first pass at rust-lang#5554 - this allows all `use super::*` to pass, which may or may not be desirable. The original issue was around allowing test modules to import their entire parent modules - I'm happy to modify this to do that instead, may just need some guidance on how to implement that (I played around a bit with #[cfg(test)] but from what I can gather, clippy itself isn't in test mode when running, even if the code in question is being checked for the test target).
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