Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/macro_expansion_tests/mbe/regression.rs')
-rw-r--r--crates/hir-def/src/macro_expansion_tests/mbe/regression.rs56
1 files changed, 40 insertions, 16 deletions
diff --git a/crates/hir-def/src/macro_expansion_tests/mbe/regression.rs b/crates/hir-def/src/macro_expansion_tests/mbe/regression.rs
index 485f72e92c..1bbed01443 100644
--- a/crates/hir-def/src/macro_expansion_tests/mbe/regression.rs
+++ b/crates/hir-def/src/macro_expansion_tests/mbe/regression.rs
@@ -139,7 +139,7 @@ STRUCT!{struct D3DVSHADERCAPS2_0 {Caps: u8,}}
STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct D3DCONTENTPROTECTIONCAPS {Caps : u8 ,}}
"#,
- expect![[r##"
+ expect![[r#"
macro_rules! STRUCT {
($(#[$attrs:meta])* struct $name:ident {
$($field:ident: $ftype:ty,)+
@@ -194,7 +194,7 @@ impl Clone for D3DCONTENTPROTECTIONCAPS {
}
}
}
-"##]],
+"#]],
);
}
@@ -214,7 +214,7 @@ macro_rules! int_base {
}
int_base!{Binary for isize as usize -> Binary}
"#,
- expect![[r##"
+ expect![[r#"
macro_rules! int_base {
($Trait:ident for $T:ident as $U:ident -> $Radix:ident) => {
#[stable(feature = "rust1", since = "1.0.0")]
@@ -230,7 +230,7 @@ macro_rules! int_base {
Binary.fmt_int(*self as usize, f)
}
}
-"##]],
+"#]],
);
}
@@ -318,7 +318,7 @@ impl_fn_for_zst ! {
}
"#,
- expect![[r##"
+ expect![[r#"
macro_rules! impl_fn_for_zst {
{$( $( #[$attr: meta] )*
struct $Name: ident impl$( <$( $lifetime : lifetime ),+> )? Fn =
@@ -410,7 +410,7 @@ impl FnOnce<(char, )> for CharEscapeDefault {
}
}
-"##]],
+"#]],
);
}
@@ -511,7 +511,7 @@ cfg_if! {
@__apply cfg(all(not(any(not(any(target_os = "solaris", target_os = "illumos")))))),
}
"#,
- expect![[r##"
+ expect![[r#"
macro_rules! cfg_if {
($(if #[cfg($($meta:meta),*)] { $($it:item)* } )else* else { $($it2:item)* })
=> {
@@ -534,7 +534,7 @@ __cfg_if_items! {
}
-"##]],
+"#]],
);
}
@@ -618,7 +618,7 @@ RIDL!{interface ID3D11Asynchronous(ID3D11AsynchronousVtbl): ID3D11DeviceChild(ID
fn GetDataSize(&mut self) -> UINT
}}
"#,
- expect![[r##"
+ expect![[r#"
#[macro_export]
macro_rules! RIDL {
(interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident)
@@ -639,7 +639,7 @@ impl ID3D11Asynchronous {
((*self .lpVtbl).GetDataSize)(self )
}
}
-"##]],
+"#]],
);
}
@@ -676,7 +676,7 @@ quick_error ! (
);
"#,
- expect![[r##"
+ expect![[r#"
macro_rules! quick_error {
(SORT [enum $name:ident $( #[$meta:meta] )*]
items [$($( #[$imeta:meta] )*
@@ -697,7 +697,7 @@ macro_rules! quick_error {
}
quick_error!(ENUMINITION[enum Wrapped#[derive(Debug)]]body[]queue[ = > One: UNIT[] = > Two: TUPLE[s: String]]);
-"##]],
+"#]],
)
}
@@ -746,7 +746,7 @@ delegate_impl ! {
[G, &'a mut G, deref] pub trait Data: GraphBase {@section type type NodeWeight;}
}
"#,
- expect![[r##"
+ expect![[r#"
macro_rules! delegate_impl {
([$self_type:ident, $self_wrap:ty, $self_map:ident]
pub trait $name:ident $(: $sup:ident)* $(+ $more_sup:ident)* {
@@ -785,7 +785,7 @@ macro_rules! delegate_impl {
}
}
impl <> Data for &'amut G where G: Data {}
-"##]],
+"#]],
);
}
@@ -959,14 +959,14 @@ macro_rules! with_std {
with_std! {mod m;mod f;}
"#,
- expect![[r##"
+ expect![[r#"
macro_rules! with_std {
($($i:item)*) => ($(#[cfg(feature = "std")]$i)*)
}
#[cfg(feature = "std")] mod m;
#[cfg(feature = "std")] mod f;
-"##]],
+"#]],
)
}
@@ -1144,3 +1144,27 @@ mod any {
"#]],
);
}
+
+#[test]
+fn regression_18148() {
+ check(
+ r#"
+macro_rules! m {
+ ( $e:expr ) => {};
+}
+
+fn foo() {
+ m!(r#const);
+}
+"#,
+ expect![[r#"
+macro_rules! m {
+ ( $e:expr ) => {};
+}
+
+fn foo() {
+ ;
+}
+"#]],
+ );
+}