]> git.lizzy.rs Git - rust.git/blob - tests/ui/rfcs/rfc-2005-default-binding-mode/lit.rs
Rollup merge of #103702 - WaffleLapkin:lift-sized-bounds-from-pointer-methods-where...
[rust.git] / tests / ui / rfcs / rfc-2005-default-binding-mode / lit.rs
1 // run-pass
2 #![allow(dead_code)]
3 fn with_u8() {
4     let s = 5u8;
5     let r = match &s {
6         4 => false,
7         5 => true,
8         _ => false,
9     };
10     assert!(r);
11 }
12
13 // A string literal isn't mistaken for a non-ref pattern (in which case we'd
14 // deref `s` and mess things up).
15 fn with_str() {
16     let s: &'static str = "abc";
17     match s {
18             "abc" => true,
19             _ => panic!(),
20     };
21 }
22
23 // Ditto with byte strings.
24 fn with_bytes() {
25     let s: &'static [u8] = b"abc";
26     match s {
27         b"abc" => true,
28         _ => panic!(),
29     };
30 }
31
32 pub fn main() {
33     with_str();
34 }