2023-05-29 10:43:15 -05:00
|
|
|
// FIXME(tschottdorf): we want these to compile, but they don't.
|
2017-10-06 15:30:23 -05:00
|
|
|
|
|
|
|
fn with_str() {
|
|
|
|
let s: &'static str = "abc";
|
2023-05-29 10:43:15 -05:00
|
|
|
|
|
|
|
match &s {
|
|
|
|
"abc" => true, //~ ERROR mismatched types
|
2017-10-06 15:30:23 -05:00
|
|
|
_ => panic!(),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fn with_bytes() {
|
|
|
|
let s: &'static [u8] = b"abc";
|
2023-05-29 10:43:15 -05:00
|
|
|
|
|
|
|
match &s {
|
|
|
|
b"abc" => true, //~ ERROR mismatched types
|
2017-10-06 15:30:23 -05:00
|
|
|
_ => panic!(),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
with_str();
|
2023-05-29 10:43:15 -05:00
|
|
|
with_bytes();
|
2017-10-06 15:30:23 -05:00
|
|
|
}
|