forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue where array types were recorded as [x; _] and hence aliasi…
…ng (rust-lang#15)
- Loading branch information
Showing
2 changed files
with
30 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
const SIZE1: usize = 1; | ||
const SIZE2: usize = 2; | ||
|
||
pub static TABLE1: [(u64, u64); SIZE1] = [(0, 1)]; | ||
|
||
pub static TABLE2: [(u64, u64); SIZE2] = [(2, 3), (4, 5)]; | ||
|
||
// This is to ensure that we don't just constant propagate away the assertion | ||
fn test_equal(a: u64, b: u64) -> bool { | ||
a == b | ||
} | ||
|
||
fn main() { | ||
let x = TABLE1[0]; | ||
assert!(test_equal(x.1, 1)); | ||
let y = TABLE2[0]; | ||
assert!(test_equal(y.1, 3)); | ||
let z = TABLE2[1]; | ||
assert!(test_equal(z.1, 5)); | ||
} |