Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't link legacy_stdio_definitions from std #3226

Merged
merged 1 commit into from Apr 26, 2023

Conversation

ChrisDenton
Copy link
Contributor

std on windows-msvc does not use printf or fprintf so never needs the legacy_stdio_definitions.lib import library and will always work fine without it.

@rustbot
Copy link
Collaborator

rustbot commented Apr 26, 2023

r? @JohnTitor

(rustbot has picked a reviewer for you, use r? to override)

std on Windows does not use `printf` or `fprintf` so never needs the `legacy_stdio_definitions.lib` import library.
@JohnTitor
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 26, 2023

📌 Commit 34866c1 has been approved by JohnTitor

It is now in the queue for this repository.

Comment on lines +281 to +291
cfg_if! {
if #[cfg(not(feature = "rustc-dep-of-std"))] {
#[cfg_attr(
all(windows, target_env = "msvc"),
link(name = "legacy_stdio_definitions")
)]
extern "C" {
pub fn printf(format: *const c_char, ...) -> ::c_int;
pub fn fprintf(stream: *mut FILE, format: *const c_char, ...) -> ::c_int;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cfg_if! {
if #[cfg(not(feature = "rustc-dep-of-std"))] {
#[cfg_attr(
all(windows, target_env = "msvc"),
link(name = "legacy_stdio_definitions")
)]
extern "C" {
pub fn printf(format: *const c_char, ...) -> ::c_int;
pub fn fprintf(stream: *mut FILE, format: *const c_char, ...) -> ::c_int;
}
}
#[cfg(not(feature = "rustc-dep-of-std"))]
#[cfg_attr(
all(windows, target_env = "msvc"),
link(name = "legacy_stdio_definitions")
)]
extern "C" {
pub fn printf(format: *const c_char, ...) -> ::c_int;
pub fn fprintf(stream: *mut FILE, format: *const c_char, ...) -> ::c_int;
}

nit: no need to use cfg_if! here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was what I originally did. but the style checker complained.

@bors
Copy link
Contributor

bors commented Apr 26, 2023

⌛ Testing commit 34866c1 with merge 8a3a8be...

@bors
Copy link
Contributor

bors commented Apr 26, 2023

☀️ Test successful - checks-actions, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13, checks-cirrus-freebsd-14
Approved by: JohnTitor
Pushing 8a3a8be to master...

@bors bors merged commit 8a3a8be into rust-lang:master Apr 26, 2023
11 checks passed
@ChrisDenton ChrisDenton deleted the std-no-legacy branch April 26, 2023 16:04
@OwenLu88
Copy link

Which version will update? Now, I using "rustc 1.69.0 (84c898d65 2023-04-16)". Is it the latest version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants