summaryrefslogtreecommitdiffstats
path: root/tests/ui/argument-suggestions/extra_arguments.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
}