From ac25a4ac329a083a9693fe5d9d1600024db9b35c Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Thu, 5 Oct 2017 01:02:25 +0300 Subject: [PATCH] rustc_trans: do not set NoCapture for anonymous lifetime &T arguments. --- src/librustc_trans/abi.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/librustc_trans/abi.rs b/src/librustc_trans/abi.rs index 2aecc016a5c..1f72ae849e6 100644 --- a/src/librustc_trans/abi.rs +++ b/src/librustc_trans/abi.rs @@ -750,9 +750,7 @@ impl<'a, 'tcx> FnType<'tcx> { Some(ty.boxed_ty()) } - ty::TyRef(b, mt) => { - use rustc::ty::{BrAnon, ReLateBound}; - + ty::TyRef(_, mt) => { // `&mut` pointer parameters never alias other parameters, or mutable global data // // `&T` where `T` contains no `UnsafeCell` is immutable, and can be marked as @@ -768,13 +766,6 @@ impl<'a, 'tcx> FnType<'tcx> { arg.attrs.set(ArgAttribute::ReadOnly); } - // When a reference in an argument has no named lifetime, it's - // impossible for that reference to escape this function - // (returned or stored beyond the call by a closure). - if let ReLateBound(_, BrAnon(_)) = *b { - arg.attrs.set(ArgAttribute::NoCapture); - } - Some(mt.ty) } _ => None