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

Segfault from using casted trait #4333

Closed
14427 opened this Issue Jan 2, 2013 · 5 comments

Comments

Projects
None yet
3 participants
@14427
Contributor

14427 commented Jan 2, 2013

Updated Test Case (warning: may not be faithful to the original problem)

use core::io::ReaderUtil;
use core::io::Reader;

fn foo(r:@Reader) -> ~str { r.read_line() }
fn baz<R:Reader>(r:R) -> ~str { r.read_line() }
fn waz<R:ReaderUtil>(r:R) -> ~str { r.read_line() }

fn main() {
    let _m = foo(io::stdin());
    let _m = baz(io::stdin());
    let _m = waz(io::stdin());
}

Original Report

The following code compiles, but causes a segmentation fault when run:

let stdin = io::stdin() as &io::ReaderUtil;
let _m = stdin.read_line();

This is using master on Ubuntu.

@ghost ghost assigned catamorphism Jan 3, 2013

@catamorphism

This comment has been minimized.

Show comment
Hide comment
@catamorphism

catamorphism Jan 3, 2013

Contributor

I'll look at this, since I was working on something similar.

Contributor

catamorphism commented Jan 3, 2013

I'll look at this, since I was working on something similar.

@pnkfelix

This comment has been minimized.

Show comment
Hide comment
@pnkfelix

pnkfelix Mar 25, 2013

Member

I cannot duplicate this on Mac OS X.

Member

pnkfelix commented Mar 25, 2013

I cannot duplicate this on Mac OS X.

@pnkfelix

This comment has been minimized.

Show comment
Hide comment
@pnkfelix

pnkfelix Mar 25, 2013

Member

Note that in my comment above, I was testing against an "updated" version of the code that may not be faithful to the original bug scenario. But if that is the case, it may also be the case that this bug has gone away with type-checker changes since it was filed...

Member

pnkfelix commented Mar 25, 2013

Note that in my comment above, I was testing against an "updated" version of the code that may not be faithful to the original bug scenario. But if that is the case, it may also be the case that this bug has gone away with type-checker changes since it was filed...

catamorphism added a commit to catamorphism/rust that referenced this issue Mar 29, 2013

@catamorphism

This comment has been minimized.

Show comment
Hide comment
@catamorphism

catamorphism Mar 29, 2013

Contributor

Seems to be fixed; pending #5619 for the test case. (I chose to add the original test case, except with stdin changed to stdout so we don't have a test case reading input, for fidelity to the original bug.)

Contributor

catamorphism commented Mar 29, 2013

Seems to be fixed; pending #5619 for the test case. (I chose to add the original test case, except with stdin changed to stdout so we don't have a test case reading input, for fidelity to the original bug.)

@catamorphism

This comment has been minimized.

Show comment
Hide comment
@catamorphism

catamorphism Apr 1, 2013

Contributor

Test case merged in 318d926 - closing

Contributor

catamorphism commented Apr 1, 2013

Test case merged in 318d926 - closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment