Skip to content

Commit 8c96487

Browse files
ouz-aMark-Simulacrum
authored andcommitted
Add one more case to avoid ICE
1 parent 9b2a465 commit 8c96487

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

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

+9
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
313313
) => {
314314
// A reborrow has no effect before a dereference.
315315
}
316+
// Catch cases which have Deref(None)
317+
// having them slip to bug! causes ICE
318+
// see #94291 for more info
319+
(&[Adjustment { kind: Adjust::Deref(None), .. }], _) => {
320+
self.tcx.sess.delay_span_bug(
321+
DUMMY_SP,
322+
&format!("Can't compose Deref(None) expressions"),
323+
)
324+
}
316325
// FIXME: currently we never try to compose autoderefs
317326
// and ReifyFnPointer/UnsafeFnPointer, but we could.
318327
_ => bug!(
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use std::collections::VecDeque;
2+
3+
pub struct BuildPlanBuilder {
4+
acc: VecDeque<(String, String)>,
5+
current_provides: String,
6+
current_requires: String,
7+
}
8+
9+
impl BuildPlanBuilder {
10+
pub fn or(&mut self) -> &mut Self {
11+
self.acc.push_back(self.current_provides, self.current_requires);
12+
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
13+
self
14+
}
15+
}
16+
17+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0061]: this function takes 1 argument but 2 arguments were supplied
2+
--> $DIR/wrong_argument_ice.rs:11:18
3+
|
4+
LL | self.acc.push_back(self.current_provides, self.current_requires);
5+
| ^^^^^^^^^ --------------------- --------------------- supplied 2 arguments
6+
|
7+
note: associated function defined here
8+
--> $SRC_DIR/alloc/src/collections/vec_deque/mod.rs:LL:COL
9+
|
10+
LL | pub fn push_back(&mut self, value: T) {
11+
| ^^^^^^^^^
12+
help: use parentheses to construct a tuple
13+
|
14+
LL | self.acc.push_back((self.current_provides, self.current_requires));
15+
| + +
16+
17+
error: aborting due to previous error
18+
19+
For more information about this error, try `rustc --explain E0061`.

0 commit comments

Comments
 (0)