-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Replace Rc with Lrc for shared data #48586
Conversation
cc @rust-lang/compiler - I think this step seems pretty clearly desirable. |
I'll take a closer look tomorrow! |
@michaelwoerister -- hope that's ok, just feeling a bit overwhelmed with reviews right now :) |
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.
Thanks for the PR, @Zoxc! This looks good to me. I'd still like to wait for feedback about the change in libproc_macro
but otherwise this has my r+.
We should make sure to add at least one build that compiles with parallel queries enabled to our CI. I'll open an issue for that.
It would also be interesting to see the performance impact of switching to atomic reference counting. We can do a try-build once the PR is merged.
@@ -306,7 +307,7 @@ pub struct LineColumn { | |||
#[unstable(feature = "proc_macro", issue = "38356")] | |||
#[derive(Clone)] | |||
pub struct SourceFile { | |||
filemap: Rc<FileMap>, | |||
filemap: Lrc<FileMap>, |
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.
@rust-lang/compiler @alexcrichton, is it safe to modify these definitions? Or are they part of a public interface?
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.
Nah these are unstable and just private fields, so should be all good!
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.
Great, thanks for the quick feedback!
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 IMO problematic because it will eventually be observable in user code - you should impl !Send
and !Sync
on SourceFile
to hide the difference before we forget and stabilize it.
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.
There probably also other types this applies to in libproc_macro
.
src/libsyntax/ext/expand.rs
Outdated
@@ -437,7 +438,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { | |||
} | |||
} | |||
|
|||
fn expand_invoc(&mut self, invoc: Invocation, ext: Rc<SyntaxExtension>) -> Option<Expansion> { | |||
fn expand_invoc(&mut self, invoc: Invocation, ext: Lrc<SyntaxExtension>) -> Option<Expansion> { |
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.
These should probably just use &SyntaxExtension
.
@rust-lang/infra: Upping the priority since this patch has such a big risk of bitrotting. @bors p=10 |
|
4e2efcf
to
5539554
Compare
@bors r+ |
📌 Commit 5539554 has been approved by |
🔒 Merge conflict |
@Zoxc, you can just r=me after resolving such merge conflicts. |
@bors r=michaelwoerister |
💔 Test failed - status-appveyor |
@bors retry timeout smashes something |
⌛ Testing commit fce7201 with merge c57c60edd9b07424c98a8bbcf4d8ce0a495e0c72... |
💔 Test failed - status-appveyor |
@bors retry appveyor timeout again smashes another thing |
Replace Rc with Lrc for shared data This replaces `Rc`s reachable from `TyCtxt` with `Lrc`. This has no effect unless `cfg(parallel_queries)` is set. It also contains a fix for the `Decodable` impl for `Arc`. r? @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
🎉 |
🎉 smashes something |
This replaces
Rc
s reachable fromTyCtxt
withLrc
. This has no effect unlesscfg(parallel_queries)
is set. It also contains a fix for theDecodable
impl forArc
.r? @nikomatsakis