Skip to content

Commit c30acc7

Browse files
committed
Auto merge of #52160 - euclio:include-macros, r=oli-obk
add regression test for #48835 Fixes #48835. The underlying issue was fixed in #51978.
2 parents ec039c7 + 1be1d90 commit c30acc7

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/test/ui/include-macros/file.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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`.

0 commit comments

Comments
 (0)