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

librustc: Have the kind checker check sub-bounds in trait casts. #15352

Closed

Conversation

pcwalton
Copy link
Contributor

@pcwalton pcwalton commented Jul 2, 2014

This can break code that looked like:

struct S<T> {
    val: T,
}
trait Gettable<T> {
    ...
}
impl<T: Copy> Gettable<T> for S<T> {
    ...
}
let t: Box<S<String>> = box S {
    val: "one".to_string(),
};
let a = t as Box<Gettable<String>>;
//                        ^ note no `Copy` bound

Change this code to:

impl<T> Gettable<T> for S<T> {
//   ^ remove `Copy` bound
    ...
}

Closes #14061.

[breaking-change]

r? @nick29581

"trait cast not in vtable \
map?!")
}
Some(vtable_res) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block would be better off in its own function

@nrc
Copy link
Member

nrc commented Jul 2, 2014

r=me with the above small changes

(as a note, I was confused as to why we had to go through the vtable stuff to find the type substs, it turns out these things are just really badly named :-( )

@sfackler
Copy link
Member

sfackler commented Jul 3, 2014

Looks like there are some build errors: https://travis-ci.org/rust-lang/rust/jobs/29019229

This can break code that looked like:

    struct S<T> {
        val: T,
    }
    trait Gettable<T> {
        ...
    }
    impl<T: Copy> Gettable<T> for S<T> {
        ...
    }
    let t: Box<S<String>> = box S {
        val: "one".to_string(),
    };
    let a = t as Box<Gettable<String>>;
    //                        ^ note no `Copy` bound

Change this code to:

    impl<T> Gettable<T> for S<T> {
    //   ^ remove `Copy` bound
        ...
    }

Closes rust-lang#14061.

[breaking-change]
bors added a commit that referenced this pull request Jul 3, 2014
Closes #15276 (Guide: if)
Closes #15280 (std::os - Add join_paths, make setenv non-utf8 capable)
Closes #15314 (Guide: functions)
Closes #15327 (Simplify PatIdent to contain an Ident rather than a Path)
Closes #15340 (Guide: add mutable binding section)
Closes #15342 (Fix ICE with nested macro_rules!-style macros)
Closes #15350 (Remove duplicated slash in install script path)
Closes #15351 (correct a few spelling mistakes in the tutorial)
Closes #15352 (librustc: Have the kind checker check sub-bounds in trait casts.)
Closes #15359 (Fix spelling errors.)
Closes #15361 (Rename set_broadast() to set_broadcast().)
Closes #15366 (Simplify creating a parser from a token tree)
Closes #15367 (Add examples for StrVector methods)
Closes #15372 (Vec::grow should use reserve_additional, Vec::reserve should check against capacity)
Closes #15373 (Fix minor issues in the documentation of libtime.)
@bors bors closed this in #15377 Jul 3, 2014
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 this pull request may close these issues.

segmentation fault: moved value not detected due to trait usage
3 participants