Skip to content

Commit 725b213

Browse files
committed
add regression test for 148684
1 parent 8573ee6 commit 725b213

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ fn shrink_file(
749749
let hi_byte = spans.iter().map(|s| s.hi()).max()?;
750750
let hi_loc = sm.lookup_char_pos(hi_byte);
751751

752-
if lo_loc.file.name != hi_loc.file.name {
752+
if lo_loc.file.stable_id != hi_loc.file.stable_id {
753753
// this may happen when spans cross file boundaries due to macro expansion.
754754
return None;
755755
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
struct A {
2+
b: Vec<u8>,
3+
c: usize,
4+
}
5+
6+
fn main() {
7+
A(2, vec![])
8+
//~^ ERROR expected function, tuple struct or tuple variant, found struct `A`
9+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
WARN rustc_errors::emitter Invalid span $SRC_DIR/alloc/src/macros.rs:LL:COL (#4), error=SourceNotAvailable { filename: Real(Remapped { local_path: None, virtual_name: "$SRC_DIR/alloc/src/macros.rs" }) }
2+
WARN rustc_errors::emitter Invalid span $SRC_DIR/alloc/src/macros.rs:LL:COL (#4), error=SourceNotAvailable { filename: Real(Remapped { local_path: None, virtual_name: "$SRC_DIR/alloc/src/macros.rs" }) }
3+
WARN rustc_errors::emitter Invalid span $SRC_DIR/alloc/src/macros.rs:LL:COL (#4), error=SourceNotAvailable { filename: Real(Remapped { local_path: None, virtual_name: "$SRC_DIR/alloc/src/macros.rs" }) }
4+
WARN rustc_errors::emitter Invalid span $SRC_DIR/alloc/src/macros.rs:LL:COL (#4), error=SourceNotAvailable { filename: Real(Remapped { local_path: None, virtual_name: "$SRC_DIR/alloc/src/macros.rs" }) }
5+
WARN rustc_errors::emitter Invalid span $SRC_DIR/alloc/src/macros.rs:LL:COL (#4), error=SourceNotAvailable { filename: Real(Remapped { local_path: None, virtual_name: "$SRC_DIR/alloc/src/macros.rs" }) }
6+
WARN rustc_errors::emitter Invalid span $SRC_DIR/alloc/src/macros.rs:LL:COL (#4), error=SourceNotAvailable { filename: Real(Remapped { local_path: None, virtual_name: "$SRC_DIR/alloc/src/macros.rs" }) }
7+
error[E0423]: expected function, tuple struct or tuple variant, found struct `A`
8+
--> $DIR/ice-line-bounds-issue-148684.rs:7:5
9+
|
10+
LL | / struct A {
11+
LL | | b: Vec<u8>,
12+
LL | | c: usize,
13+
LL | | }
14+
| |_- `A` defined here
15+
...
16+
LL | A(2, vec![])
17+
| ^^^^^^^^^^^^
18+
|
19+
20+
error: aborting due to 1 previous error
21+
22+
For more information about this error, try `rustc --explain E0423`.

0 commit comments

Comments
 (0)