Add sugar for &pin (const|mut) types
This commit is contained in:
parent
7caad69253
commit
ae698f8199
23 changed files with 284 additions and 63 deletions
|
@ -779,7 +779,7 @@ impl<'ra: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'r
|
|||
let prev = self.diag_metadata.current_trait_object;
|
||||
let prev_ty = self.diag_metadata.current_type_path;
|
||||
match &ty.kind {
|
||||
TyKind::Ref(None, _) => {
|
||||
TyKind::Ref(None, _) | TyKind::PinnedRef(None, _) => {
|
||||
// Elided lifetime in reference: we resolve as if there was some lifetime `'_` with
|
||||
// NodeId `ty.id`.
|
||||
// This span will be used in case of elision failure.
|
||||
|
@ -2326,7 +2326,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
|
|||
impl<'ra> Visitor<'ra> for FindReferenceVisitor<'_, '_, '_> {
|
||||
fn visit_ty(&mut self, ty: &'ra Ty) {
|
||||
trace!("FindReferenceVisitor considering ty={:?}", ty);
|
||||
if let TyKind::Ref(lt, _) = ty.kind {
|
||||
if let TyKind::Ref(lt, _) | TyKind::PinnedRef(lt, _) = ty.kind {
|
||||
// See if anything inside the &thing contains Self
|
||||
let mut visitor =
|
||||
SelfVisitor { r: self.r, impl_self: self.impl_self, self_found: false };
|
||||
|
|
|
@ -3482,7 +3482,7 @@ struct LifetimeFinder<'ast> {
|
|||
|
||||
impl<'ast> Visitor<'ast> for LifetimeFinder<'ast> {
|
||||
fn visit_ty(&mut self, t: &'ast Ty) {
|
||||
if let TyKind::Ref(_, mut_ty) = &t.kind {
|
||||
if let TyKind::Ref(_, mut_ty) | TyKind::PinnedRef(_, mut_ty) = &t.kind {
|
||||
self.seen.push(t);
|
||||
if t.span.lo() == self.lifetime.lo() {
|
||||
self.found = Some(&mut_ty.ty);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue