-
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
Move REGISTERED_DIAGNOSTICS to a ParseSess field #48808
Conversation
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.
Looks good to me. However, I think it would really be an improvement if we had a Lock::with()
method as that would encourage making locking ranges more visible and explicit.
src/libsyntax/diagnostics/plugin.rs
Outdated
)); | ||
} | ||
}); | ||
let mut diagnostics = ecx.parse_sess.registered_diagnostics.lock(); |
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 we add a with
method to Lock
? That would make it clearer in many cases whether the lock is held until the end of the block intentionally or not.
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.
That's probably not a bad idea. with
sounds a little innocent for a lock though.
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.
with_lock()
maybe?
I added methods to lock in a closure. |
👍 @bors r+ |
📌 Commit 728c16c has been approved by |
Move REGISTERED_DIAGNOSTICS to a ParseSess field r? @michaelwoerister
r? @michaelwoerister