diff options
| author | bors <bors@rust-lang.org> | 2013-05-28 10:11:05 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-28 10:11:05 -0700 |
| commit | 833ed21f87e1994ec76a757f3cbf2b8deedf55e1 (patch) | |
| tree | 6958ae6b19b24bd7558dc22c5a47ea47a7b987bb | |
| parent | 05735a934a807333f9cbeadd9ef4dc431240bec2 (diff) | |
| parent | accc5272f8913af57e7ebfd6a13247ecde146006 (diff) | |
auto merge of #6786 : thestinger/rust/revert-noalias-mut-rptr, r=nikomatsakis
it can alias `&const` and `@mut`
| -rw-r--r-- | src/librustc/middle/trans/base.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 28aed536818..0518f699329 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -1694,16 +1694,13 @@ pub fn create_llargs_for_fn_args(cx: fn_ctxt, let arg = &args[i]; let llarg = llvm::LLVMGetParam(cx.llfn, arg_n as c_uint); - // Mark `&mut T` as no-alias, as the borrowck pass ensures it's true match arg.ty.node { - ast::ty_rptr(_, mt) => { - if mt.mutbl == ast::m_mutbl { - llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint); - } - } + // `~` pointers never alias other parameters, because ownership was transferred ast::ty_uniq(_) => { llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint); } + // FIXME: #6785: `&mut` can only alias `&const` and `@mut`, we should check for + // those in the other parameters and then mark it as `noalias` if there aren't any _ => {} } |
