Resolver: Wrap arenas in WorkerLocal#159019
Conversation
This comment has been minimized.
This comment has been minimized.
| let prefix = Segment::names_to_string(&prefix); | ||
| self.r.dcx().span_err( | ||
| use_tree.span(), | ||
| format!("cannot resolve a prelude import `{prefix}`: {path_res:?}"), |
There was a problem hiding this comment.
There's a CI failure due to this change.
Also {path_res:?} is leaking internal debug output into a user-visible message.
| let key = | ||
| BindingKey::new_disambiguated(ident, ns, || (child_index + 1).try_into().unwrap()); | ||
| if resolutions | ||
| .entry(key) |
There was a problem hiding this comment.
Can use insert here, we are always adding a new entry, there's a span_bug check for this below.
| .entry(key) | ||
| .or_insert_with(|| self.arenas.alloc_name_resolution(orig_ident_span)) | ||
| .borrow_mut_unchecked() // only 1 thread builds extern tables | ||
| .non_glob_decl |
There was a problem hiding this comment.
non_glob_decl can be set immediately after the resolution is created with alloc_name_resolution.
And if we hand-roll alloc_name_resolution we can even avoid borrow_mut_unchecked here.
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
|
⌛ Trying commit 4e7b0b3 with merge 8921b29… To cancel the try build, run the command Workflow: https://github.com/rust-lang/rust/actions/runs/29032517142 |
Resolver: Wrap arenas in `WorkerLocal`
|
The PR description needs an update, it's not only about arenas. |
|
Reminder, once the PR becomes ready for a review, use |
…l import resolution.
4e7b0b3 to
3f0bbad
Compare
In preperation of parallel import resolution #158845 this pr wraps the resolver arenas in
WorkerLocalto ensure we don't need any synchronization to access an arena. This is common in the compiler.r? @petrochenkov