1
Fork 0

shuffle ownership of external_traits

constraints:

- clean/inline.rs needs this map to fill in traits when inlining
- fold.rs needs this map to allow passes to fold trait items
- html/render.rs needs this map to seed the Cache.traits map of all
  known traits

The first two are the real problem, since `DocFolder` only operates on
`clean::Crate` but `clean/inline.rs` only sees the `DocContext`. The
introduction of early passes means that these two now exist at the same
time, so they need to share ownership of the map. Even better, the use
of `Crate` in a rustc thread pool means that it needs to be Sync, so it
can't use `Lrc<Lock>` to manually activate thread-safety.

`parking_lot` is reused from elsewhere in the tree to allow use of its
`ReentrantMutex`, as the relevant parts of rustdoc are still
single-threaded and this allows for easier use in that context.
This commit is contained in:
QuietMisdreavus 2018-09-01 21:20:39 -05:00
parent c754e8240c
commit 354507e61f
9 changed files with 31 additions and 24 deletions

View file

@ -49,6 +49,7 @@ extern crate rustc_errors as errors;
extern crate pulldown_cmark;
extern crate tempfile;
extern crate minifier;
extern crate parking_lot;
extern crate serialize as rustc_serialize; // used by deriving