Skip to content

Conversation

@LorrensP-2158466
Copy link
Contributor

@LorrensP-2158466 LorrensP-2158466 commented Oct 27, 2025

There are some places where we use a &mut CmResolver inside of FnMut arguments. That is because when we do CmResolver::reborrow() inside of a closure, it fails to compile due to region constraints. This pr changes these to bare CmResolver arguments.

When #148329 is merged, this can be merged as well.

r? @petrochenkov

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 27, 2025
@LorrensP-2158466
Copy link
Contributor Author

cc @petrochenkov Because you reviewed and approved the first pr and because it's linked to our work in #145108

@LorrensP-2158466
Copy link
Contributor Author

@rustbot blocked

Blocked until #148289 is fixed;

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 31, 2025
@LorrensP-2158466 LorrensP-2158466 changed the title Hack RefOrMut to allow use in closures. Remove uses of &mut CmResolver Oct 31, 2025
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] jiff test:false 8.028 error: lifetime may not live long enough --> compiler/rustc_resolve/src/ident.rs:437:28 | 42 | impl<'ra, 'tcx> Resolver<'ra, 'tcx> { | --- ---- lifetime `'tcx` defined here | | | lifetime `'ra` defined here ... 437 | let break_result = self.visit_scopes( | ____________________________^ 438 | | scope_set, 439 | | parent_scope, 440 | | orig_ident.span.ctxt(), ... | 748 | | }, 749 | | ); | |_________^ argument requires that `'ra` must outlive `'tcx` | = help: consider adding the following bound: `'ra: 'tcx` = note: requirement occurs because of the type `RefOrMut<'_, Resolver<'_, '_>>`, which makes the generic argument `Resolver<'_, '_>` invariant = note: the struct `RefOrMut<'a, T>` is invariant over the parameter `T` = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance error: lifetime may not live long enough --> compiler/rustc_resolve/src/imports.rs:876:9 | 302 | impl<'ra, 'tcx> Resolver<'ra, 'tcx> { | --- ---- lifetime `'tcx` defined here | | | lifetime `'ra` defined here ... 876 | / self.per_ns_cm(|mut this, ns| { 877 | | if !type_ns_only || ns == TypeNS { 878 | | if bindings[ns].get() != PendingBinding::Pending { 879 | | return; ... | 934 | | }); | |__________^ argument requires that `'ra` must outlive `'tcx` | = help: consider adding the following bound: `'ra: 'tcx` = note: requirement occurs because of the type `RefOrMut<'_, Resolver<'_, '_>>`, which makes the generic argument `Resolver<'_, '_>` invariant = note: the struct `RefOrMut<'a, T>` is invariant over the parameter `T` = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance [RUSTC-TIMING] rustc_resolve test:false 2.729 error: could not compile `rustc_resolve` (lib) due to 2 previous errors warning: build failed, waiting for other jobs to finish... 
@rustbot rustbot assigned petrochenkov and unassigned lcnr Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

5 participants