diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-06-12 10:27:44 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-06-13 13:53:34 -0700 |
| commit | b612ae9edea26cb8704363c47a66d583b644ad09 (patch) | |
| tree | 42052d147d0bec55448f00adaca2eac306a9b95e /src/libcore | |
| parent | 00e1a6923773500f0d5b9bad64d05eb5d4a24c53 (diff) | |
| download | rust-b612ae9edea26cb8704363c47a66d583b644ad09.tar.gz rust-b612ae9edea26cb8704363c47a66d583b644ad09.zip | |
rustc: [T, ..N] and [T, ..N+1] are not the same
This commit fixes a bug in the calculation of the hash of a type which didn't factor in the length of a constant-sized vector. As a result of this, a type placed into an Any of a fixed length could be peeled out with any other fixed length in a safe manner.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/any.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcore/any.rs b/src/libcore/any.rs index ed743f40a4b..2657cd53483 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -263,6 +263,14 @@ mod tests { let s = format!("{}", b); assert_eq!(s.as_slice(), "&Any"); } + + #[test] + fn any_fixed_vec() { + let test = [0u, ..8]; + let test = &test as &Any; + assert!(test.is::<[uint, ..8]>()); + assert!(!test.is::<[uint, ..10]>()); + } } #[cfg(test)] |
