-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Warn when relying on default musl target static linkage behaviour #144513
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ declare_lint_pass! { | |
MISPLACED_DIAGNOSTIC_ATTRIBUTES, | ||
MISSING_ABI, | ||
MISSING_UNSAFE_ON_EXTERN, | ||
MUSL_MISSING_CRT_STATIC, | ||
MUST_NOT_SUSPEND, | ||
NAMED_ARGUMENTS_USED_POSITIONALLY, | ||
NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE, | ||
|
@@ -5099,3 +5100,16 @@ declare_lint! { | |
report_in_deps: true, | ||
}; | ||
} | ||
|
||
declare_lint! { | ||
/// The `musl_missing_crt_static` lint detects when code is compiled for a target using musl libc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This lint will be seen by a lot of people, many of which may not be familiar with the details of compiler flags. I think this lint documents here should spend more effort explaining exactly how to pass the flag (via RUSTFLAGS) and what exactly it means (what is libc, what are the differences between static and dynamic linkage, why is this change being made exactly etc) in an accessible way. I can write down such a text if you want to, or you can do it yourself. The lint output should then contain a link to this documentation here in the rustc book. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because I think there are a lot of projects that have just copied the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alternatively all these details can be in the blog post and we link to the blog post. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really mind where the details are, I think both ways are fine. However, before I write such a blog post, I'd like to know for how long we want to keep the lint around before we change the behavior, since I'd have to mention that in the blog post and it needs to be decided on either way, so better start that process now than later |
||
/// without explicitly specifying `+crt-static` or `-crt-static`. | ||
/// | ||
/// ### Explanation | ||
/// | ||
/// The musl targets will change to be dynamically linked by default in the future, to avoid a | ||
/// sudden change in behavior, the desired linkage should be specified in the interim period. | ||
pub MUSL_MISSING_CRT_STATIC, | ||
Warn, | ||
"on musl targets, the default for `crt-static` will change; explicitly set `+crt-static` or `-crt-static`", | ||
} |
Uh oh!
There was an error while loading. Please reload this page.