Add one more case to avoid ICE
This commit is contained in:
parent
9b2a46591a
commit
8c96487052
@ -313,6 +313,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
) => {
|
) => {
|
||||||
// A reborrow has no effect before a dereference.
|
// A reborrow has no effect before a dereference.
|
||||||
}
|
}
|
||||||
|
// Catch cases which have Deref(None)
|
||||||
|
// having them slip to bug! causes ICE
|
||||||
|
// see #94291 for more info
|
||||||
|
(&[Adjustment { kind: Adjust::Deref(None), .. }], _) => {
|
||||||
|
self.tcx.sess.delay_span_bug(
|
||||||
|
DUMMY_SP,
|
||||||
|
&format!("Can't compose Deref(None) expressions"),
|
||||||
|
)
|
||||||
|
}
|
||||||
// FIXME: currently we never try to compose autoderefs
|
// FIXME: currently we never try to compose autoderefs
|
||||||
// and ReifyFnPointer/UnsafeFnPointer, but we could.
|
// and ReifyFnPointer/UnsafeFnPointer, but we could.
|
||||||
_ => bug!(
|
_ => bug!(
|
||||||
|
17
src/test/ui/tuple/wrong_argument_ice.rs
Normal file
17
src/test/ui/tuple/wrong_argument_ice.rs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
|
pub struct BuildPlanBuilder {
|
||||||
|
acc: VecDeque<(String, String)>,
|
||||||
|
current_provides: String,
|
||||||
|
current_requires: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BuildPlanBuilder {
|
||||||
|
pub fn or(&mut self) -> &mut Self {
|
||||||
|
self.acc.push_back(self.current_provides, self.current_requires);
|
||||||
|
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
19
src/test/ui/tuple/wrong_argument_ice.stderr
Normal file
19
src/test/ui/tuple/wrong_argument_ice.stderr
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
error[E0061]: this function takes 1 argument but 2 arguments were supplied
|
||||||
|
--> $DIR/wrong_argument_ice.rs:11:18
|
||||||
|
|
|
||||||
|
LL | self.acc.push_back(self.current_provides, self.current_requires);
|
||||||
|
| ^^^^^^^^^ --------------------- --------------------- supplied 2 arguments
|
||||||
|
|
|
||||||
|
note: associated function defined here
|
||||||
|
--> $SRC_DIR/alloc/src/collections/vec_deque/mod.rs:LL:COL
|
||||||
|
|
|
||||||
|
LL | pub fn push_back(&mut self, value: T) {
|
||||||
|
| ^^^^^^^^^
|
||||||
|
help: use parentheses to construct a tuple
|
||||||
|
|
|
||||||
|
LL | self.acc.push_back((self.current_provides, self.current_requires));
|
||||||
|
| + +
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0061`.
|
Loading…
x
Reference in New Issue
Block a user