提交 b8ed1368 编写于 作者: C Corey Richardson

Address review

上级 7febdb7b
......@@ -246,7 +246,8 @@ fn get_extern_rust_fn(ccx: &CrateContext, inputs: &[ty::t], output: ty::t,
pub fn decl_rust_fn(ccx: &CrateContext, has_env: bool,
inputs: &[ty::t], output: ty::t,
name: &str) -> ValueRef {
use middle::ty::{FreeRegion, BrAnon, ReFree, ReLateBound};
use middle::ty::{BrAnon, ReLateBound};
let llfty = type_of_rust_fn(ccx, has_env, inputs, output);
let llfn = decl_cdecl_fn(ccx.llmod, name, llfty, output);
......@@ -270,8 +271,7 @@ pub fn decl_rust_fn(ccx: &CrateContext, has_env: bool,
// When a reference in an argument has no named lifetime, it's
// impossible for that reference to escape this function(ie, be
// returned).
ty::ty_rptr(ReFree(FreeRegion { scope_id: _, bound_region: BrAnon(_) }), _) |
ty::ty_rptr(ReLateBound(_, BrAnon(_)), _) => {
ty::ty_rptr(ReLateBound(_, BrAnon(_)), _) => {
debug!("marking argument of {} as nocapture because of anonymous lifetime", name);
unsafe {
llvm::LLVMAddAttribute(llarg, lib::llvm::NoCaptureAttribute as c_uint);
......
......@@ -708,8 +708,9 @@ pub fn trans_call_inner<'a>(
debug!("trans_callee_inner: first_arg_offset={}", first_arg_offset);
for (idx, &t) in ty::ty_fn_args(callee_ty).iter().enumerate().map(|(i, v)| (i+first_arg_offset, v)) {
use middle::ty::{FreeRegion, BrAnon, ReFree, ReLateBound};
for (idx, &t) in ty::ty_fn_args(callee_ty).iter().enumerate()
.map(|(i, v)| (i+first_arg_offset, v)) {
use middle::ty::{BrAnon, ReLateBound};
if !type_is_immediate(ccx, t) {
// if it's not immediate, we have a program-invisible pointer,
// which it can't possibly capture
......@@ -720,10 +721,9 @@ pub fn trans_call_inner<'a>(
let t_ = ty::get(t);
match t_.sty {
ty::ty_rptr(ReFree(FreeRegion { scope_id: _, bound_region: BrAnon(_) }), _) |
ty::ty_rptr(ReLateBound(_, BrAnon(_)), _) => {
debug!("trans_callee_inner: argument {} nocapture because of anonymous lifetime", idx);
ty::ty_rptr(ReLateBound(_, BrAnon(_)), _) => {
debug!("trans_callee_inner: argument {} nocapture because \
of anonymous lifetime", idx);
attrs.push((idx, NoCaptureAttribute));
},
_ => { }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册