Skip to content

Commit ef7d3e1

Browse files
Anton Lofgrenalexcrichton
authored andcommitted
lint: Improve ffi-unsafe enum lint warning
I think this is an improvement of the previous warning message, which - like the comment that I removed implies - is in need of some improvement. I've opted to point the user in the right direction w.r.t how to fix the problem, which I think is good form. Not being familiar with the repr(...) attribute, I personally had to check the lint rules myself to figure out what was wrong. Hopefully, this will save he next person some time and headache. Signed-off-by: Anton Lofgren <[email protected]>
1 parent c2ac7fd commit ef7d3e1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustc/lint/builtin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,9 @@ impl LintPass for CTypes {
358358
def::DefTy(def_id) => {
359359
if !adt::is_ffi_safe(cx.tcx, def_id) {
360360
cx.span_lint(CTYPES, ty.span,
361-
"found enum type without foreign-function-safe \
362-
representation annotation in foreign module");
363-
// hmm... this message could be more helpful
361+
"found enum type without foreign-function-safe
362+
representation annotation in foreign module, consider \
363+
adding a #[repr(...)] attribute to the enumeration");
364364
}
365365
}
366366
_ => ()

0 commit comments

Comments
 (0)