Skip to content

Commit 833ed21

Browse files
committed
auto merge of #6786 : thestinger/rust/revert-noalias-mut-rptr, r=nikomatsakis
it can alias `&const` and `@mut`
2 parents 05735a9 + accc527 commit 833ed21

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/librustc/middle/trans/base.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1694,16 +1694,13 @@ pub fn create_llargs_for_fn_args(cx: fn_ctxt,
16941694
let arg = &args[i];
16951695
let llarg = llvm::LLVMGetParam(cx.llfn, arg_n as c_uint);
16961696

1697-
// Mark `&mut T` as no-alias, as the borrowck pass ensures it's true
16981697
match arg.ty.node {
1699-
ast::ty_rptr(_, mt) => {
1700-
if mt.mutbl == ast::m_mutbl {
1701-
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
1702-
}
1703-
}
1698+
// `~` pointers never alias other parameters, because ownership was transferred
17041699
ast::ty_uniq(_) => {
17051700
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
17061701
}
1702+
// FIXME: #6785: `&mut` can only alias `&const` and `@mut`, we should check for
1703+
// those in the other parameters and then mark it as `noalias` if there aren't any
17071704
_ => {}
17081705
}
17091706

0 commit comments

Comments
 (0)