]> git.lizzy.rs Git - rust.git/commitdiff
lint: Improve ffi-unsafe enum lint warning
authorAnton Lofgren <alofgren@op5.com>
Tue, 22 Jul 2014 06:33:03 +0000 (08:33 +0200)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 29 Jul 2014 22:43:21 +0000 (15:43 -0700)
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 <alofgren@op5.com>
src/librustc/lint/builtin.rs

index 3f4f51236997191403f8add494035fcf0a408d68..1667f2b6d5f0a7ec9cc17f1cc5e6f3ec27bc4661 100644 (file)
@@ -358,9 +358,9 @@ fn check_ty(cx: &Context, ty: &ast::Ty) {
                         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");
                             }
                         }
                         _ => ()