-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Rewrite rc::Rc using cell::Cell #12654
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
Conversation
Using a |
Good point. I'll try |
Can this wait until the issue is discussed? I don't think |
It seems wrong to say that To me, this is the reason why markers should not be used in favor of types with safe interfaces like |
No, nothing would go wrong if we told LLVM an If the meaning of |
I agree we definitely want I also agree with @thestinger, we ought to discuss. Whether this is the right call seems to hinge on just what we want the definition of I finally think this PR is not the place to have such a discussion. |
After some more thought I have modified my opinion and I am still in favor of using |
The patch has been updated to use |
The patch looks good! We probably do want to tweak the def'n of Freeze from "reaches mutable" to "interior mutability". Presumably we should do that before we land this patch. |
The current plan is to possibly remove the I don't have much of a preference on whether this uses Implementation-wise, it seems odd to introduce a one-off trait for these two pointer types. Sure it's not exported, but there's no other clean way to do it? I feel like something returning |
I agree that As far as the trait goes, it seemed to me like an impl detail that wouldn't be reflected in the docs and just allowed us to shave off some duplicate code, which seems like a good thing. @alexcrichton you disagree? |
I don't really find |
@thestinger I see. Yes, I guess you're right, if we think of |
/me not a big fan of our current treatment of |
Doesn't that seem a little odd? By that same logic, nothing should be |
I'm not sure what logic you're referencing. The The |
@edwardw, this patch needs a rebase, and could you also make these changes?
|
How about |
The latest commit demonstrates the |
The point of this patch is to not use |
(What @alexcrichton said) |
So |
I'd rather not leave this lingering, is it possible to fix the tests before the kind inference is updated? |
Sure. Maybe with an FIXME in it? |
Is it really necessary to have a FIXME? Can the test be modified? |
Unfortunately, they specifically test for being frozen: ast.rs and interner.rs. |
The test in ast.rs is fine to ignore, and I don't understand why the |
I guess because no other place tries to instantiate |
Can you switch the tests over to just using |
Certainly. I'll try to submit a new patch then. |
Closing due to inactivity, but feel free to reopen with a rebase! |
Rebased. Since |
r? |
} | ||
} | ||
|
||
#[allow(missing_doc)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add some docs? I'd like us to avoid merging patches that add undocumented features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an internal implementation trait, I think, so I'm not sure that docs are needed since these methods aren't publicly available and their purpose is fairly clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough.
Side Note: I personally prefer to have everything documented even internal and pretty obvious things. I think it's good for the language and to make newcomers life easier.
Since `Arc` has been using `Atomic`, this closes 12625. Closes rust-lang#12625.
Since `Arc` has been using `Atomic`, this closes 12625. Closes #12625.
…ust-lang#14367) There were two bugs here. Let's assume `T` is a singleton type implementing `Default` and that `f()` takes a `T`: - `f(<T>::default())` cannot be replaced by `f(<T)` as it was (incorrect spans – this is tricky because the type relative path uses a base span covering only `T`, not `<T>`) (third commit) - The argument of `f(<_>::default())` is inferred correctly, but cannot be replaced by `<_>` or `_`, as this cannot be used to infer an instance of a singleton type (first commit). The second commit offers better error messages by pointing at the whole expression. Fix rust-lang#12654 changelog: [`default_constructed_unit_struct`]: do not suggest incorrect fix when using a type surrounded by brackets
Since
Arc
has been usingAtomic
, this closes 12625.Closes #12625.