Skip to content

Commit 97554e4

Browse files
committed
Auto merge of #45033 - eddyb:capture-me-not, r=nikomatsakis
rustc_trans: do not set NoCapture for anonymous lifetime &T arguments. This was both unsound (due to lifetime elision & unsafe code) and dead code (we erase lifetimes). r? @nikomatsakis
2 parents 150b625 + ac25a4a commit 97554e4

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/librustc_trans/abi.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,7 @@ impl<'a, 'tcx> FnType<'tcx> {
751751
Some(ty.boxed_ty())
752752
}
753753

754-
ty::TyRef(b, mt) => {
755-
use rustc::ty::{BrAnon, ReLateBound};
756-
754+
ty::TyRef(_, mt) => {
757755
// `&mut` pointer parameters never alias other parameters, or mutable global data
758756
//
759757
// `&T` where `T` contains no `UnsafeCell<U>` is immutable, and can be marked as
@@ -779,13 +777,6 @@ impl<'a, 'tcx> FnType<'tcx> {
779777
arg.attrs.set(ArgAttribute::ReadOnly);
780778
}
781779

782-
// When a reference in an argument has no named lifetime, it's
783-
// impossible for that reference to escape this function
784-
// (returned or stored beyond the call by a closure).
785-
if let ReLateBound(_, BrAnon(_)) = *b {
786-
arg.attrs.set(ArgAttribute::NoCapture);
787-
}
788-
789780
Some(mt.ty)
790781
}
791782
_ => None

0 commit comments

Comments
 (0)