Skip to content

Commit cc60e21

Browse files
authored
Rollup merge of rust-lang#107489 - compiler-errors:non_lifetime_binders, r=cjgillot
Implement partial support for non-lifetime binders This implements support for non-lifetime binders. It's pretty useless currently, but I wanted to put this up so the implementation can be discussed. Specifically, this piggybacks off of the late-bound lifetime collection code in `rustc_hir_typeck::collect::lifetimes`. This seems like a necessary step given the fact we don't resolve late-bound regions until this point, and binders are sometimes merged. Q: I'm not sure if I should go along this route, or try to modify the earlier nameres code to compute the right bound var indices for type and const binders eagerly... If so, I'll need to rename all these queries to something more appropriate (I've done this for `resolve_lifetime::Region` -> `resolve_lifetime::ResolvedArg`) cc rust-lang/types-team#81 r? `@ghost`
2 parents dd6534a + 27a4768 commit cc60e21

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_lints/src/ptr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -505,13 +505,13 @@ fn check_mut_from_ref<'tcx>(cx: &LateContext<'tcx>, sig: &FnSig<'_>, body: Optio
505505
if let FnRetTy::Return(ty) = sig.decl.output
506506
&& let Some((out, Mutability::Mut, _)) = get_ref_lm(ty)
507507
{
508-
let out_region = cx.tcx.named_region(out.hir_id);
508+
let out_region = cx.tcx.named_bound_var(out.hir_id);
509509
let args: Option<Vec<_>> = sig
510510
.decl
511511
.inputs
512512
.iter()
513513
.filter_map(get_ref_lm)
514-
.filter(|&(lt, _, _)| cx.tcx.named_region(lt.hir_id) == out_region)
514+
.filter(|&(lt, _, _)| cx.tcx.named_bound_var(lt.hir_id) == out_region)
515515
.map(|(_, mutability, span)| (mutability == Mutability::Not).then_some(span))
516516
.collect();
517517
if let Some(args) = args

0 commit comments

Comments
 (0)