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

Overflow while adding drop-check rules. #33545

Closed
kaminsod opened this issue May 10, 2016 · 4 comments
Closed

Overflow while adding drop-check rules. #33545

kaminsod opened this issue May 10, 2016 · 4 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@kaminsod
Copy link

Not sure if this is a bug or something I missed in my code, but seems to be the same as #29844. Issue present in stable, beta and nightly.

https://play.rust-lang.org/?gist=5d30e353c7fac8f23e871367f774f9b0&version=stable&backtrace=0

#[derive(Debug)]
enum E1<T> {
    V1(T),
    V2(Box<E1<E2<T>>>)
}

#[derive(Debug)]
enum E2<T> {
    V1(usize, T),
    V2(usize, T, T)
}

fn main() {
    let wub = E1::V2(Box::new(E1::V1(E2::V1(1, "wub"))));

    println!("{:?}", wub);
}

Issues on stable (similar issues on beta and nightly):

:14:9: 14:12 error: overflow while adding drop-check rules for E1<&str> [E0320]
:14 let wub = E1::V2(Box::new(E1::V1(E2::V1(1, "wub"))));
^~~
:14:9: 14:12 note: overflowed on enum E2 variant V1 field #0 type: usize
:14 let wub = E1::V2(Box::new(E1::V1(E2::V1(1, "wub"))));
^~~
:14:15: 14:57 error: overflow while adding drop-check rules for E1<&str> [E0320]
:14 let wub = E1::V2(Box::new(E1::V1(E2::V1(1, "wub"))));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:14:15: 14:57 note: overflowed on enum E2 variant V1 field #0 type: usize
:14 let wub = E1::V2(Box::new(E1::V1(E2::V1(1, "wub"))));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:14:22: 14:56 error: overflow while adding drop-check rules for Box<E1<E2<&str>>> [E0320]
:14 let wub = E1::V2(Box::new(E1::V1(E2::V1(1, "wub"))));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:14:22: 14:56 note: overflowed on enum E1 variant V1 field #0 type: E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<E2<&str>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
:14 let wub = E1::V2(Box::new(E1::V1(E2::V1(1, "wub"))));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:14:31: 14:55 error: overflow while adding drop-check rules for E1<E2<&str>> [E0320]
:14 let wub = E1::V2(Box::new(E1::V1(E2::V1(1, "wub"))));
^~~~~~~~~~~~~~~~~~~~~~~~
:14:31: 14:55 note: overflowed on enum E2 variant V1 field #0 type: usize
:14 let wub = E1::V2(Box::new(E1::V1(E2::V1(1, "wub"))));

@kaminsod
Copy link
Author

kaminsod commented May 10, 2016

Slightly simplified version of code producing same issue.

#[derive(Debug)]
enum A<T> {
    A1(T),
    A2(Box<A<B<T>>>)
}

#[derive(Debug)]
enum B<T> {
    B(T)
}

fn main() {
    let wub = A::A2(Box::new(A::A1(B::B("wub"))));

    println!("{:?}", wub);
}

https://play.rust-lang.org/?gist=b5faaff96db3a386eb7906461f81d5a8&version=stable&backtrace=0

@nagisa
Copy link
Member

nagisa commented May 10, 2016

Even more minimal:

enum A<T> {
    A1(T),
    A2(Box<A<::std::marker::PhantomData<T>>>)
}

fn main() {
    A::A1(());
}

@pnkfelix
Copy link
Member

I think this is a duplicate of #4287

@arielb1 arielb1 added the A-diagnostics Area: Messages for errors, warnings, and lints label May 10, 2016
@Mark-Simulacrum
Copy link
Member

Closing in favor of #4287.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

5 participants