mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
auto merge of #15454 : jakub-/rust/15453, r=huonw
I forget we now have byte string literals.
This commit is contained in:
commit
4c0cab7f2f
@ -563,6 +563,7 @@ pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: ty::t) ->
|
||||
ty::ty_rptr(_, ty::mt { ty: ty, .. }) => match ty::get(ty).sty {
|
||||
ty::ty_vec(_, None) => match *ctor {
|
||||
Slice(length) => length,
|
||||
ConstantValue(_) => 0u,
|
||||
_ => unreachable!()
|
||||
},
|
||||
ty::ty_str => 0u,
|
||||
|
@ -46,6 +46,13 @@ pub fn main() {
|
||||
_ => fail!(),
|
||||
}
|
||||
|
||||
let buf = vec!(97u8, 98, 99, 100);
|
||||
assert_eq!(match buf.slice(0, 3) {
|
||||
b"def" => 1u,
|
||||
b"abc" => 2u,
|
||||
_ => 3u
|
||||
}, 2);
|
||||
|
||||
assert_eq!(BAZ, &[97u8, 92u8, 110u8]);
|
||||
assert_eq!(br"a\n", &[97u8, 92u8, 110u8]);
|
||||
assert_eq!(br"a\n", b"a\\n");
|
||||
|
Loading…
Reference in New Issue
Block a user