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

DST coercions #24619

Merged
merged 7 commits into from
May 13, 2015
Merged

DST coercions #24619

merged 7 commits into from
May 13, 2015

Conversation

nrc
Copy link
Member

@nrc nrc commented Apr 20, 2015

r? @nikomatsakis (note a few TODOs left in the code where I wasn't sure about stuff).

@brson
Copy link
Contributor

brson commented Apr 21, 2015

Should this be cherry-picked into 1.0?

@nrc
Copy link
Member Author

nrc commented Apr 22, 2015

@brson I think no: it is a feature, not a fix, and it is large and thus potentially dangerous bug-wise. I think it is fine to wait an extra 6 weeks for.

@bombless
Copy link
Contributor

I think it is fine to wait an extra 6 weeks for.

Hmm, not 3 weeks from now?

@bors
Copy link
Contributor

bors commented Apr 22, 2015

☔ The latest upstream changes (presumably #24674) made this pull request unmergeable. Please resolve the merge conflicts.

@bstrie
Copy link
Contributor

bstrie commented Apr 23, 2015

This is awesome to see! I agree that it may be too late into the cycle to accept something this major into 1.0, but just for the heck of it do we know of any stdlib APIs that require unnecessarily-boxed trait objects that would benefit from this change?

ftxqxd added a commit to ftxqxd/rust that referenced this pull request Apr 23, 2015
This + DST coercions (rust-lang#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to
be simplified to `Rc<RefCell<Trait>>`.
bors added a commit that referenced this pull request May 1, 2015
This + DST coercions (#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to be simplified to `Rc<RefCell<Trait>>`.
ftxqxd added a commit to ftxqxd/rust that referenced this pull request May 1, 2015
This + DST coercions (rust-lang#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to
be simplified to `Rc<RefCell<Trait>>`.
@nikomatsakis
Copy link
Contributor

@nrc sorry for the delay. I'm going to try and finish this review today. I've been wanting to dig specifically into the question of higher-ranked bounds and the use of skip-binder in this code, which doesn't seem right to me-- but I needed some time in quiet to think it through.

ftxqxd added a commit to ftxqxd/rust that referenced this pull request May 2, 2015
This + DST coercions (rust-lang#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to
be simplified to `Rc<RefCell<Trait>>`.
bors added a commit that referenced this pull request May 3, 2015
This + DST coercions (#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to be simplified to `Rc<RefCell<Trait>>`.
@bluss
Copy link
Member

bluss commented May 10, 2015

How does this impact stable APIs? Is there any way we can merge it and let mature and not insta-stabilize?

nrc added 6 commits May 13, 2015 14:19
* segfault due to not copying drop flag when coercing
* fat pointer casts
* segfault due to not checking drop flag properly
* debuginfo for DST smart pointers
* unreachable code in drop glue
@nrc
Copy link
Member Author

nrc commented May 13, 2015

@bors r=nikomatsakis 4446d44

@bors
Copy link
Contributor

bors commented May 13, 2015

⌛ Testing commit 4446d44 with merge 17a4e3c...

@bors
Copy link
Contributor

bors commented May 13, 2015

💔 Test failed - auto-mac-64-opt

@nrc
Copy link
Member Author

nrc commented May 13, 2015

@bors r=nikomatsakis b799cd8

@bors
Copy link
Contributor

bors commented May 13, 2015

⌛ Testing commit b799cd8 with merge 32f3bff...

@bors
Copy link
Contributor

bors commented May 13, 2015

⛄ The build was interrupted to prioritize another pull request.

@bors
Copy link
Contributor

bors commented May 13, 2015

⌛ Testing commit b799cd8 with merge fa43387...

bors added a commit that referenced this pull request May 13, 2015
r? @nikomatsakis (note a few TODOs left in the code where I wasn't sure about stuff).
@bors bors merged commit b799cd8 into rust-lang:master May 13, 2015
bors added a commit that referenced this pull request May 16, 2015
Most of `Rc`’s trait implementations were DST-ified in #24619, but not these ones.
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Mar 10, 2017
…r=nikomatsakis

Disallow subtyping between T and U in T: Unsize<U>.

Because `&mut T` can be coerced to `&mut U`, `T` and `U` must be unified invariantly. Fixes rust-lang#40288.
E.g. coercing `&mut [&'a X; N]` to `&mut [&'b X]` must require `'a` be equal to `'b`, otherwise you can convert between `&'a X` and `&'b X` (in either direction), potentially unsoundly lengthening lifetimes.

Subtyping here was introduced with `Unsize` in rust-lang#24619 (landed in 1.1, original PR is rust-lang#23785).
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Mar 10, 2017
…r=nikomatsakis

Disallow subtyping between T and U in T: Unsize<U>.

Because `&mut T` can be coerced to `&mut U`, `T` and `U` must be unified invariantly. Fixes rust-lang#40288.
E.g. coercing `&mut [&'a X; N]` to `&mut [&'b X]` must require `'a` be equal to `'b`, otherwise you can convert between `&'a X` and `&'b X` (in either direction), potentially unsoundly lengthening lifetimes.

Subtyping here was introduced with `Unsize` in rust-lang#24619 (landed in 1.1, original PR is rust-lang#23785).
arielb1 pushed a commit to arielb1/rust that referenced this pull request Mar 10, 2017
…r=nikomatsakis

Disallow subtyping between T and U in T: Unsize<U>.

Because `&mut T` can be coerced to `&mut U`, `T` and `U` must be unified invariantly. Fixes rust-lang#40288.
E.g. coercing `&mut [&'a X; N]` to `&mut [&'b X]` must require `'a` be equal to `'b`, otherwise you can convert between `&'a X` and `&'b X` (in either direction), potentially unsoundly lengthening lifetimes.

Subtyping here was introduced with `Unsize` in rust-lang#24619 (landed in 1.1, original PR is rust-lang#23785).
arielb1 pushed a commit to arielb1/rust that referenced this pull request Mar 10, 2017
…r=nikomatsakis

Disallow subtyping between T and U in T: Unsize<U>.

Because `&mut T` can be coerced to `&mut U`, `T` and `U` must be unified invariantly. Fixes rust-lang#40288.
E.g. coercing `&mut [&'a X; N]` to `&mut [&'b X]` must require `'a` be equal to `'b`, otherwise you can convert between `&'a X` and `&'b X` (in either direction), potentially unsoundly lengthening lifetimes.

Subtyping here was introduced with `Unsize` in rust-lang#24619 (landed in 1.1, original PR is rust-lang#23785).
arielb1 pushed a commit to arielb1/rust that referenced this pull request Mar 10, 2017
…r=nikomatsakis

Disallow subtyping between T and U in T: Unsize<U>.

Because `&mut T` can be coerced to `&mut U`, `T` and `U` must be unified invariantly. Fixes rust-lang#40288.
E.g. coercing `&mut [&'a X; N]` to `&mut [&'b X]` must require `'a` be equal to `'b`, otherwise you can convert between `&'a X` and `&'b X` (in either direction), potentially unsoundly lengthening lifetimes.

Subtyping here was introduced with `Unsize` in rust-lang#24619 (landed in 1.1, original PR is rust-lang#23785).
arielb1 pushed a commit to arielb1/rust that referenced this pull request Mar 11, 2017
…r=nikomatsakis

Disallow subtyping between T and U in T: Unsize<U>.

Because `&mut T` can be coerced to `&mut U`, `T` and `U` must be unified invariantly. Fixes rust-lang#40288.
E.g. coercing `&mut [&'a X; N]` to `&mut [&'b X]` must require `'a` be equal to `'b`, otherwise you can convert between `&'a X` and `&'b X` (in either direction), potentially unsoundly lengthening lifetimes.

Subtyping here was introduced with `Unsize` in rust-lang#24619 (landed in 1.1, original PR is rust-lang#23785).
arielb1 pushed a commit to arielb1/rust that referenced this pull request Mar 11, 2017
…r=nikomatsakis

Disallow subtyping between T and U in T: Unsize<U>.

Because `&mut T` can be coerced to `&mut U`, `T` and `U` must be unified invariantly. Fixes rust-lang#40288.
E.g. coercing `&mut [&'a X; N]` to `&mut [&'b X]` must require `'a` be equal to `'b`, otherwise you can convert between `&'a X` and `&'b X` (in either direction), potentially unsoundly lengthening lifetimes.

Subtyping here was introduced with `Unsize` in rust-lang#24619 (landed in 1.1, original PR is rust-lang#23785).
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.

7 participants