-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
no way to bubble up Send/Freeze through raw pointers #9509
Comments
Nominating for the feature complete milestone. |
Can you give an example that doesn't work? @nikomatsakis thinks raw pointers already have the Send trait. |
It occurred to me that perhaps the point is that raw |
@catamorphism extern mod extra;
use std::cell::Cell;
use extra::rc::Rc;
fn is_freeze<T: Freeze>(_: T) {}
fn main() {
// is_freeze(Cell::new(1)); // error: [...] Cell [...] does not fulfill Freeze
is_freeze(Rc::from_send(Cell::new(1))); // compiles fine
} (I believe @thestinger may be planning to remove |
@nikomatsakis: yup, the point is that you can't make a smart pointer or vector type behaving like |
I've left out a way to construct from a `Send` type until #9509 is resolved. I am confident that this interface can remain backwards compatible though, assuming we name the `Pointer` trait method `borrow`. When there is a way to convert from `Send` (`from_send`), a future RAII-based `Mut` type can be used with this to implemented a mutable reference-counted pointer. For now, I've left around the `RcMut` type but it may drastically change or be removed.
I was thinking more about this problem. This ties in with some discussions that @pnkfelix and I were having regarding tracing GC: In particular, if you have smart pointers like This argues for replacing |
High but not 1.0 |
It's possible that the correct fix for this is just to change how we compute the kinds for |
If people REALLY want to hide the contents of their pointer from the type system, they can transmute to |
+1, going to close the |
I can incorporate that change into PR #10158 |
Hmm it is not clear from the links above which PR (if any) has committed the fix I believe was settled on (namely changing kind computation to traverse even a *TypeExpr) Posting to remind self to check on that later |
Fix sorting in ` cargo dev update_lints` script changelog: none The old code cloned and sorted `usable_lints` into `sorted_usable_lints`, but then failed to do anything with `sorted_usable_lints`. This was discovered by my new `collection_is_never_read` lint (rust-lang#9267) that I'm working on! Fix: I renamed the sorted vector to `usable_lints`. Therefore it now gets used where the unsorted one was used previously.
…llogiq Add `collection_is_never_read` Fixes rust-lang#9267 `@flip1995` and `@llogiq,` I talked with you about this one at Rust Nation in London last week. :-) This is my first contribution to Clippy, so lots of feedback would be greatly appreciated. - \[ ] Followed [lint naming conventions][lint_naming] - \[x] Added passing UI tests (including committed `.stderr` file) - \[x] `cargo test` passes locally - \[x] Executed `cargo dev update_lints` - \[x] Added lint documentation - \[x] Run `cargo dev fmt` `dogfood` found one true positive (see rust-lang#9509) and no false positives. `lintcheck` found no (true or false) positives, even when running on an extended set of crates. --- changelog: new lint [`collection_is_never_read`] [rust-lang#10415](rust-lang/rust-clippy#10415) <!-- changelog_checked -->
You can't write a correct smart pointer or vector type in a library at the moment.
The text was updated successfully, but these errors were encountered: