From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../min_const_generics/macro-fail.rs | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/ui/const-generics/min_const_generics/macro-fail.rs (limited to 'tests/ui/const-generics/min_const_generics/macro-fail.rs') diff --git a/tests/ui/const-generics/min_const_generics/macro-fail.rs b/tests/ui/const-generics/min_const_generics/macro-fail.rs new file mode 100644 index 000000000..7fb69032e --- /dev/null +++ b/tests/ui/const-generics/min_const_generics/macro-fail.rs @@ -0,0 +1,39 @@ +struct Example; + +macro_rules! external_macro { + () => {{ + //~^ ERROR expected type + const X: usize = 1337; + X + }} +} + +trait Marker {} +impl Marker for Example {} + +fn make_marker() -> impl Marker { + //~^ ERROR: type provided when a constant was expected + Example:: +} + +fn from_marker(_: impl Marker<{ + #[macro_export] + macro_rules! inline { () => {{ 3 }} }; inline!() +}>) {} + +fn main() { + let _ok = Example::<{ + #[macro_export] + macro_rules! gimme_a_const { + ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} + //~^ ERROR expected type + //~| ERROR expected type + }; + gimme_a_const!(run) + }>; + + let _fail = Example::; + + let _fail = Example::; + //~^ ERROR unexpected end of macro invocation +} -- cgit v1.2.3