summaryrefslogtreecommitdiffstats
path: root/tests/ui/argument-suggestions/extra_arguments.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /tests/ui/argument-suggestions/extra_arguments.rs
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/argument-suggestions/extra_arguments.rs')
-rw-r--r--tests/ui/argument-suggestions/extra_arguments.rs26
1 files changed, 22 insertions, 4 deletions
diff --git a/tests/ui/argument-suggestions/extra_arguments.rs b/tests/ui/argument-suggestions/extra_arguments.rs
index 144206232..4f2f3517d 100644
--- a/tests/ui/argument-suggestions/extra_arguments.rs
+++ b/tests/ui/argument-suggestions/extra_arguments.rs
@@ -1,12 +1,18 @@
fn empty() {}
-fn one_arg(_a: i32) {}
+fn one_arg<T>(_a: T) {}
fn two_arg_same(_a: i32, _b: i32) {}
fn two_arg_diff(_a: i32, _b: &str) {}
macro_rules! foo {
- ($x:expr) => {
+ ($x:expr, ~) => {
empty($x, 1); //~ ERROR function takes
- }
+ };
+ ($x:expr, $y:expr) => {
+ empty($x, $y); //~ ERROR function takes
+ };
+ (~, $y:expr) => {
+ empty(1, $y); //~ ERROR function takes
+ };
}
fn main() {
@@ -39,5 +45,17 @@ fn main() {
1,
""
);
- foo!(1);
+
+ // Check with macro expansions
+ foo!(1, ~);
+ foo!(~, 1);
+ foo!(1, 1);
+ one_arg(1, panic!()); //~ ERROR function takes
+ one_arg(panic!(), 1); //~ ERROR function takes
+ one_arg(stringify!($e), 1); //~ ERROR function takes
+
+ // Not a macro, but this also has multiple spans with equal source code,
+ // but different expansion contexts.
+ // https://github.com/rust-lang/rust/issues/114255
+ one_arg(for _ in 1.. {}, 1); //~ ERROR function takes
}