about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-03-04 22:58:36 +0100
committerGitHub <noreply@github.com>2022-03-04 22:58:36 +0100
commit3064d6ec4d5f4679ac3c73eaa26a91c5faf63797 (patch)
treeb6d518e957512f1749cc46f31785aa53eab272b0 /src/test
parentf27466d7e21d346811c8ef8627937d9fb19cae09 (diff)
parent8af683de3424ff96c96728dc97c829275d66cdda (diff)
downloadrust-3064d6ec4d5f4679ac3c73eaa26a91c5faf63797.tar.gz
rust-3064d6ec4d5f4679ac3c73eaa26a91c5faf63797.zip
Rollup merge of #94596 - compiler-errors:delay-adjustment-duplicate, r=estebank
Delay bug in expr adjustment when check_expr is called multiple times

Instead of including slightly more complicated logic in `check_argument_types` to fix the bug (#94516) I introduced in #94438, and inevitably have this bug appear once again when some other diagnostic is written that causes `check_expr` to be called an expression during a (bad) code path, just delay the bug in adjustment logic.

I am open to other implementations that don't delay the bug here.

Fixes #94516
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/mismatched_types/overloaded-calls-bad.rs1
-rw-r--r--src/test/ui/mismatched_types/overloaded-calls-bad.stderr8
-rw-r--r--src/test/ui/tuple/wrong_argument_ice-3.rs17
-rw-r--r--src/test/ui/tuple/wrong_argument_ice-3.stderr17
4 files changed, 42 insertions, 1 deletions
diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.rs b/src/test/ui/mismatched_types/overloaded-calls-bad.rs
index 902a6ec81d6..d62625faaaa 100644
--- a/src/test/ui/mismatched_types/overloaded-calls-bad.rs
+++ b/src/test/ui/mismatched_types/overloaded-calls-bad.rs
@@ -30,4 +30,5 @@ fn main() {
     //~^ ERROR this function takes 1 argument but 0 arguments were supplied
     let ans = s("burma", "shave");
     //~^ ERROR this function takes 1 argument but 2 arguments were supplied
+    //~| ERROR mismatched types
 }
diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr
index 264d7cbb9b1..9ae9c474162 100644
--- a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr
+++ b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr
@@ -18,6 +18,12 @@ note: associated function defined here
 LL |     extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
    |                           ^^^^^^^^
 
+error[E0308]: mismatched types
+  --> $DIR/overloaded-calls-bad.rs:31:17
+   |
+LL |     let ans = s("burma", "shave");
+   |                 ^^^^^^^ expected `isize`, found `&str`
+
 error[E0057]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/overloaded-calls-bad.rs:31:15
    |
@@ -32,7 +38,7 @@ note: associated function defined here
 LL |     extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
    |                           ^^^^^^^^
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
 
 Some errors have detailed explanations: E0057, E0308.
 For more information about an error, try `rustc --explain E0057`.
diff --git a/src/test/ui/tuple/wrong_argument_ice-3.rs b/src/test/ui/tuple/wrong_argument_ice-3.rs
new file mode 100644
index 00000000000..951687c3759
--- /dev/null
+++ b/src/test/ui/tuple/wrong_argument_ice-3.rs
@@ -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() {}
diff --git a/src/test/ui/tuple/wrong_argument_ice-3.stderr b/src/test/ui/tuple/wrong_argument_ice-3.stderr
new file mode 100644
index 00000000000..f0d64d2a4e1
--- /dev/null
+++ b/src/test/ui/tuple/wrong_argument_ice-3.stderr
@@ -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`.