Skip to content

Struct inheritance goes wrong for unit-like and tuple structs #15096

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

Closed
ben0x539 opened this issue Jun 22, 2014 · 2 comments
Closed

Struct inheritance goes wrong for unit-like and tuple structs #15096

ben0x539 opened this issue Jun 22, 2014 · 2 comments

Comments

@ben0x539
Copy link
Contributor

This compiles and segfaults (or anyway prints weird values):

#![feature(struct_inherit)]

virtual struct Foo {
    x: Box<int>
}

struct Bar : Foo;

fn main() {
    println!("{}", Bar.x);
}

An inheriting tuple struct (surprisingly spelled eg. struct Bar : Foo (int, int); too!) also compiles and does broken things.

Edit: The other way around is probably also wrong, with a non-record-like base struct.

@ben0x539 ben0x539 changed the title Struct inheritance goes wrong for nullary and enum-like structs Struct inheritance goes wrong for unit-like and tuple structs Jun 23, 2014
@emberian
Copy link
Member

emberian commented Jul 1, 2014

cc @nick29581

@ghost
Copy link

ghost commented Oct 25, 2014

Struct inheritance has been removed, closing.

@ghost ghost closed this as completed Oct 25, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 17, 2023
Change comparsion for checking if number is negative to include 128

The last byte in Little-Endian representation of negative integers start at 128 (Ox80) till 255 (OxFF). The comparison before the fix didn't check for 128 which made is_negative variable as false.

Potentially fixes rust-lang#15096
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants