Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7237f15

Browse files
compiler-errorsMark-Simulacrum
authored andcommitted
delay bug instead of skipping check_expr
1 parent 27b6c44 commit 7237f15

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed

compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
315315
}
316316
// FIXME: currently we never try to compose autoderefs
317317
// and ReifyFnPointer/UnsafeFnPointer, but we could.
318-
_ => bug!(
319-
"while adjusting {:?}, can't compose {:?} and {:?}",
320-
expr,
321-
entry.get(),
322-
adj
318+
_ => self.tcx.sess.delay_span_bug(
319+
expr.span,
320+
&format!(
321+
"while adjusting {:?}, can't compose {:?} and {:?}",
322+
expr,
323+
entry.get(),
324+
adj
325+
),
323326
),
324327
};
325328
*entry.get_mut() = adj;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
struct Process;
2+
3+
pub type Group = (Vec<String>, Vec<Process>);
4+
5+
fn test(process: &Process, groups: Vec<Group>) -> Vec<Group> {
6+
let new_group = vec![String::new()];
7+
8+
if groups.capacity() == 0 {
9+
groups.push(new_group, vec![process]);
10+
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
11+
return groups;
12+
}
13+
14+
todo!()
15+
}
16+
17+
fn main() {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0061]: this function takes 1 argument but 2 arguments were supplied
2+
--> $DIR/wrong_argument_ice-3.rs:9:16
3+
|
4+
LL | groups.push(new_group, vec![process]);
5+
| ^^^^ --------- ------------- supplied 2 arguments
6+
| |
7+
| expected 1 argument
8+
|
9+
note: associated function defined here
10+
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
11+
|
12+
LL | pub fn push(&mut self, value: T) {
13+
| ^^^^
14+
15+
error: aborting due to previous error
16+
17+
For more information about this error, try `rustc --explain E0061`.

0 commit comments

Comments
 (0)