Skip to content

Commit

Permalink
delay bug instead of skipping check_expr
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors authored and Mark-Simulacrum committed Mar 14, 2022
1 parent 27b6c44 commit 7237f15
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
13 changes: 8 additions & 5 deletions compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
// FIXME: currently we never try to compose autoderefs
// and ReifyFnPointer/UnsafeFnPointer, but we could.
_ => bug!(
"while adjusting {:?}, can't compose {:?} and {:?}",
expr,
entry.get(),
adj
_ => self.tcx.sess.delay_span_bug(
expr.span,
&format!(
"while adjusting {:?}, can't compose {:?} and {:?}",
expr,
entry.get(),
adj
),
),
};
*entry.get_mut() = adj;
Expand Down
17 changes: 17 additions & 0 deletions src/test/ui/tuple/wrong_argument_ice-3.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
struct Process;

pub type Group = (Vec<String>, Vec<Process>);

fn test(process: &Process, groups: Vec<Group>) -> Vec<Group> {
let new_group = vec![String::new()];

if groups.capacity() == 0 {
groups.push(new_group, vec![process]);
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
return groups;
}

todo!()
}

fn main() {}
17 changes: 17 additions & 0 deletions src/test/ui/tuple/wrong_argument_ice-3.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/wrong_argument_ice-3.rs:9:16
|
LL | groups.push(new_group, vec![process]);
| ^^^^ --------- ------------- supplied 2 arguments
| |
| expected 1 argument
|
note: associated function defined here
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
LL | pub fn push(&mut self, value: T) {
| ^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0061`.

0 comments on commit 7237f15

Please sign in to comment.