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

Conversation

Projects
None yet
7 participants
@nrc
Copy link
Member

nrc commented Apr 20, 2015

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

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Apr 21, 2015

Should this be cherry-picked into 1.0?

@nrc

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

bombless commented Apr 22, 2015

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

Hmm, not 3 weeks from now?

@bors

This comment has been minimized.

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

This comment has been minimized.

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?

P1start added a commit to P1start/rust that referenced this pull request Apr 23, 2015

Make `UnsafeCell`, `RefCell`, `Mutex`, and `RwLock` accept DSTs
This + DST coercions (rust-lang#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to
be simplified to `Rc<RefCell<Trait>>`.

@steveklabnik steveklabnik referenced this pull request Apr 30, 2015

Closed

ICE: Trait in an Rc #24984

bors added a commit that referenced this pull request May 1, 2015

Auto merge of #24737 - P1start:dst-cell, r=luqmana
This + DST coercions (#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to be simplified to `Rc<RefCell<Trait>>`.

P1start added a commit to P1start/rust that referenced this pull request May 1, 2015

Make `UnsafeCell`, `RefCell`, `Mutex`, and `RwLock` accept DSTs
This + DST coercions (rust-lang#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to
be simplified to `Rc<RefCell<Trait>>`.
@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented May 1, 2015

@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.

bors added a commit that referenced this pull request May 1, 2015

Auto merge of #24737 - P1start:dst-cell, r=luqmana
This + DST coercions (#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to be simplified to `Rc<RefCell<Trait>>`.

P1start added a commit to P1start/rust that referenced this pull request May 2, 2015

Make `UnsafeCell`, `RefCell`, `Mutex`, and `RwLock` accept DSTs
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 2, 2015

Auto merge of #24737 - P1start:dst-cell, r=alexcrichton
This + DST coercions (#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

Auto merge of #24737 - P1start:dst-cell, r=alexcrichton
This + DST coercions (#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

Auto merge of #24737 - P1start:dst-cell, r=alexcrichton
This + DST coercions (#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to be simplified to `Rc<RefCell<Trait>>`.
@bluss

This comment has been minimized.

Copy link
Contributor

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 some commits Apr 14, 2015

Fix a bunch of bugs
* 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 nrc force-pushed the nrc:rc-coerce branch from 89dd48c to 31bb4ab May 13, 2015

@nrc

This comment has been minimized.

Copy link
Member Author

nrc commented May 13, 2015

@bors r=nikomatsakis 4446d44

@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 13, 2015

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

bors added a commit that referenced this pull request May 13, 2015

Auto merge of #24619 - nrc:rc-coerce, r=nikomatsakis
r? @nikomatsakis (note a few TODOs left in the code where I wasn't sure about stuff).
@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 13, 2015

💔 Test failed - auto-mac-64-opt

@nrc nrc force-pushed the nrc:rc-coerce branch from 4446d44 to b799cd8 May 13, 2015

@nrc

This comment has been minimized.

Copy link
Member Author

nrc commented May 13, 2015

@bors r=nikomatsakis b799cd8

@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 13, 2015

⌛️ Testing commit b799cd8 with merge 32f3bff...

bors added a commit that referenced this pull request May 13, 2015

Auto merge of #24619 - nrc:rc-coerce, r=nikomatsakis
r? @nikomatsakis (note a few TODOs left in the code where I wasn't sure about stuff).
@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 13, 2015

⛄️ The build was interrupted to prioritize another pull request.

@bors

This comment has been minimized.

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

Auto merge of #24619 - nrc:rc-coerce, r=nikomatsakis
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

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

bors added a commit that referenced this pull request May 16, 2015

Auto merge of #25460 - P1start:rc-unsized-impls, r=luqmana
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

Rollup merge of rust-lang#40319 - eddyb:it's-"unsize"-not-"unsound", …
…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

Rollup merge of rust-lang#40319 - eddyb:it's-"unsize"-not-"unsound", …
…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

Ariel Ben-Yehuda
Rollup merge of rust-lang#40319 - eddyb:it's-"unsize"-not-"unsound", …
…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

Ariel Ben-Yehuda
Rollup merge of rust-lang#40319 - eddyb:it's-"unsize"-not-"unsound", …
…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

Ariel Ben-Yehuda
Rollup merge of rust-lang#40319 - eddyb:it's-"unsize"-not-"unsound", …
…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

Rollup merge of rust-lang#40319 - eddyb:it's-"unsize"-not-"unsound", …
…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

Ariel Ben-Yehuda
Rollup merge of rust-lang#40319 - eddyb:it's-"unsize"-not-"unsound", …
…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

Ariel Ben-Yehuda
Rollup merge of rust-lang#40319 - eddyb:it's-"unsize"-not-"unsound", …
…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
You can’t perform that action at this time.