forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#137726 - tmiasko:rm-nocapture, r=<try>
Remove incorrect use of nocapture attribute When using indirect pass mode, a callee can obtain an address of an argument and capture it. The nocapture attribute promises this does not happen and so it cannot be added unconditionally.
- Loading branch information
Showing
8 changed files
with
25 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Regression test for issue #137668 where an indirect argument have been marked as nocapture | ||
// despite the fact that callee did in fact capture the address. | ||
// | ||
//@ run-pass | ||
//@ compile-flags: -Copt-level=2 | ||
|
||
#[inline(never)] | ||
pub fn f(a: [u32; 64], b: [u32; 64]) -> bool { | ||
&a as *const _ as usize != &b as *const _ as usize | ||
} | ||
|
||
fn main() { | ||
static S: [u32; 64] = [0; 64]; | ||
assert!(f(S, S)); | ||
} |