-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-DSTsArea: Dynamically-sized types (DSTs)Area: Dynamically-sized types (DSTs)A-type-systemArea: Type systemArea: Type system
Description
Most of the time it happens automatically due to DST coercions &[T; N] => &[T], but sometimes additional care is required.
One example, where it currently doesn't work, is comparison operators between slices/arrays/vectors:
fn main() {
let a: &[u8; 3] = &[1, 2, 3];
let b: &[u8] = &[1, 2, 3];
// Both comparisons doesn't compile
a == b;
b == a;
}
When #18465 is implemented, the code comparing byte string literals with slices will break. A lot of such code can be found, for example, in libstd/path.
Metadata
Metadata
Assignees
Labels
A-DSTsArea: Dynamically-sized types (DSTs)Area: Dynamically-sized types (DSTs)A-type-systemArea: Type systemArea: Type system