From d1b2d29528b7794b41e66fc2136e395a02f8529b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:59:35 +0200 Subject: Merging upstream version 1.73.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/argument-suggestions/extra_arguments.rs | 26 ++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'tests/ui/argument-suggestions/extra_arguments.rs') 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(_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 } -- cgit v1.2.3