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

Compiler crash with self.into::<i64>() #53251

Closed
jD91mZM2 opened this issue Aug 10, 2018 · 2 comments
Closed

Compiler crash with self.into::<i64>() #53251

jD91mZM2 opened this issue Aug 10, 2018 · 2 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@jD91mZM2
Copy link
Contributor

I got a compiler crash and idk what any of it means but here you go.

I tried this code:
compiler-crash branch on jrust.

cargo check --example concat

I expected to see this happen:
stuff would work

Instead, this happened:
Rust was eaten by velociraptors.

Meta

Backtrace

rustc --version --verbose:

rustc 1.28.0 (9634041f0 2018-07-30)
binary: rustc
commit-hash: 9634041f0e8c0f3191d2867311276f19d0a42564
commit-date: 2018-07-30
host: x86_64-unknown-linux-gnu
release: 1.28.0
LLVM version: 6.0
@jD91mZM2 jD91mZM2 changed the title Compiler crash trying to specify trait on which to call function Compiler crash with self.into::<i64>() Aug 10, 2018
@jD91mZM2
Copy link
Contributor Author

Smaller example:

pub trait JavaAdd<T> {
    type Target;

    fn add(self, other: T) -> Self::Target;
}

macro_rules! impl_add {
    ($($primitive:ident),*) => {
        $(impl<T: Into<i64>> JavaAdd<T> for $primitive {
            type Target = i64;

            fn add(self, other: T) -> Self::Target {
                self.into::<i64>() + other.into::<i64>()
            }
        })*
    }
}

impl_add!(i8, i16);

@kennytm kennytm added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Aug 10, 2018
@dtolnay
Copy link
Member

dtolnay commented Aug 13, 2018

Reduced some more:

struct S;

impl S {
    fn f() {}
}

macro_rules! impl_add {
    ($($n:ident)*) => {
        $(
            fn $n() {
                S::f::<i64>();
            }
        )*
    }
}

impl_add!(a b);

estebank added a commit to estebank/rust that referenced this issue Aug 13, 2018
kennytm added a commit to kennytm/rust that referenced this issue Aug 14, 2018
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

3 participants