]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_borrowck/borrowck/mod.rs
rustc: always include elidable lifetimes in HIR types.
[rust.git] / src / librustc_borrowck / borrowck / mod.rs
index 4ce6c9527571e3f505b9fd512cd06254f7c3032b..46179b31d5cb45bc2c212baad7a898355109e9e0 100644 (file)
@@ -939,12 +939,12 @@ pub fn report_aliasability_violation(&self,
     /// Given a type, if it is an immutable reference, return a suggestion to make it mutable
     fn suggest_mut_for_immutable(&self, pty: &hir::Ty) -> Option<String> {
         // Check wether the argument is an immutable reference
-        if let hir::TyRptr(opt_lifetime, hir::MutTy {
+        if let hir::TyRptr(lifetime, hir::MutTy {
             mutbl: hir::Mutability::MutImmutable,
             ref ty
         }) = pty.node {
             // Account for existing lifetimes when generating the message
-            if let Some(lifetime) = opt_lifetime {
+            if !lifetime.is_elided() {
                 if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(ty.span) {
                     if let Ok(lifetime_snippet) = self.tcx.sess.codemap()
                         .span_to_snippet(lifetime.span) {