Skip to content

Commit 7f6d5fe

Browse files
authored
Rollup merge of #144912 - LorrensP-2158466:smart-resolver, r=petrochenkov
Resolver: introduce a conditionally mutable Resolver for (non-)speculative resolution. This pr introduces a `CmResolver`, a wrapper around the main resolver which gives out mutable access given a condition. `CmResolver` only allows mutation when we’re not in speculative import resolution. This ensures we can’t accidentally mutate the resolver during this process, which is important as we move towards a batched resolution algorithm. This also changes functions that are used during speculative import resolution to take a `CmResolver` instead of a `&mut Resolver`. Also introduces a new kind of "smart pointer" which has the behaviour described above: ```rust /// A wrapper around a mutable reference that conditionally allows mutable access. pub(crate) struct RefOrMut<'a, T> { p: &'a mut T, mutable: bool, } type CmResolver<'r, 'ra, 'tcx> = RefOrMut<'r, Resolver<'ra, 'tcx>>; ``` r? petrochenkov
2 parents ae30f3a + 31ad2a5 commit 7f6d5fe

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)