mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
rustc_trans: do not set NoCapture for anonymous lifetime &T arguments.
This commit is contained in:
parent
417ffc98df
commit
ac25a4ac32
@ -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<U>` 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
|
||||
|
Loading…
Reference in New Issue
Block a user