]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/lint.rs
auto merge of #10165 : dcrewi/rust/missing-doc-on-private-trait, r=cmr
[rust.git] / src / librustc / middle / lint.rs
index e1602ee0896dbdb18bb6cd99a24c1909da4df950..4517e19f48e3edd138a5d7bab809821df8619372 100644 (file)
@@ -34,6 +34,7 @@
 //! Context itself, span_lint should be used instead of add_lint.
 
 use driver::session;
+use middle::trans::adt; // for `adt::is_ffi_safe`
 use middle::ty;
 use middle::pat_util;
 use metadata::csearch;
@@ -627,6 +628,14 @@ fn check_ty(cx: &Context, ty: &ast::Ty) {
                                 "found rust type `uint` in foreign module, while \
                                 libc::c_uint or libc::c_ulong should be used");
                     }
+                    ast::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");
+                            // NOTE this message could be more helpful
+                        }
+                    }
                     _ => ()
                 }
             }