File tree 3 files changed +35
-0
lines changed
src/test/ui/include-macros
3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ fn main ( ) {
12
+ let b: & [ u8 ] = include_str ! ( "file.txt" ) ; //~ ERROR mismatched types
13
+ let s: & str = include_bytes ! ( "file.txt" ) ; //~ ERROR mismatched types
14
+ }
Original file line number Diff line number Diff line change
1
+ error[E0308]: mismatched types
2
+ --> $DIR/mismatched-types.rs:12:20
3
+ |
4
+ LL | let b: &[u8] = include_str!("file.txt"); //~ ERROR mismatched types
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found str
6
+ |
7
+ = note: expected type `&[u8]`
8
+ found type `&'static str`
9
+
10
+ error[E0308]: mismatched types
11
+ --> $DIR/mismatched-types.rs:13:19
12
+ |
13
+ LL | let s: &str = include_bytes!("file.txt"); //~ ERROR mismatched types
14
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found array of 0 elements
15
+ |
16
+ = note: expected type `&str`
17
+ found type `&'static [u8; 0]`
18
+
19
+ error: aborting due to 2 previous errors
20
+
21
+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments