Skip to content

Commit 1de927c

Browse files
authored
library/windows_targets: Fix macro expansion error in 'link' macro
A recent change altered the definition of the link! macro when the windows_raw_dylib feature is enabled, changing its syntax from pub macro {..} to pub macro($tt:tt) {..} in #143592 This change introduced a build failure with the error: "macros that expand to items must be delimited with braces or followed by a semicolon". We add a semicolon to the line causing the issue as we also modify the non windows_raw_dylib link to make use of the link_dylib macro
1 parent 5d22242 commit 1de927c

File tree

1 file changed

+3
-13
lines changed
  • library/windows_targets/src

1 file changed

+3
-13
lines changed

library/windows_targets/src/lib.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,12 @@ pub macro link_dylib {
3434

3535
#[cfg(feature = "windows_raw_dylib")]
3636
pub macro link($($tt:tt)*) {
37-
$crate::link_raw_dylib!($($tt)*)
37+
$crate::link_raw_dylib!($($tt)*);
3838
}
3939

4040
#[cfg(not(feature = "windows_raw_dylib"))]
41-
pub macro link {
42-
($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => (
43-
// Note: the windows-targets crate uses a pre-built Windows.lib import library which we don't
44-
// have in this repo. So instead we always link kernel32.lib and add the rest of the import
45-
// libraries below by using an empty extern block. This works because extern blocks are not
46-
// connected to the library given in the #[link] attribute.
47-
#[link(name = "kernel32")]
48-
unsafe extern $abi {
49-
$(#[link_name=$link_name])?
50-
pub fn $($function)*;
51-
}
52-
)
41+
pub macro link($($tt:tt)*) {
42+
$crate::link_dylib!($($tt)*);
5343
}
5444

5545
#[cfg(not(feature = "windows_raw_dylib"))]

0 commit comments

Comments
 (0)