Skip to content

lint: Improve ffi-unsafe enum lint warning #15893

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

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ impl LintPass for CTypes {
def::DefTy(def_id) => {
if !adt::is_ffi_safe(cx.tcx, def_id) {
cx.span_lint(CTYPES, ty.span,
"found enum type without foreign-function-safe \
representation annotation in foreign module");
// hmm... this message could be more helpful
"found enum type without foreign-function-safe
representation annotation in foreign module, consider \
adding a #[repr(...)] attribute to the enumeration");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course, the message is only a suggestion - if someone's got something even better I'll happily change it. As long as the resulting message actually tells me what I could do to fix it, I'll be happy :-)

}
}
_ => ()
Expand Down