about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-10-01 16:43:45 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-10-01 16:49:39 -0700
commit24fbf88230f37d63bb236569d6a9600ad9560f6f (patch)
tree3949f3e0c86801f9ac3a2859bde9ce519f46d4af
parente480e19694b234ba3eca20748947a4e47e805341 (diff)
downloadrust-24fbf88230f37d63bb236569d6a9600ad9560f6f.tar.gz
rust-24fbf88230f37d63bb236569d6a9600ad9560f6f.zip
In lint, don't complain about infer mode if legacy modes aren't enabled
-rw-r--r--src/rustc/middle/lint.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/rustc/middle/lint.rs b/src/rustc/middle/lint.rs
index 266ee056e2c..bba2430d95e 100644
--- a/src/rustc/middle/lint.rs
+++ b/src/rustc/middle/lint.rs
@@ -683,7 +683,8 @@ fn check_fn_deprecated_modes(tcx: ty::ctxt, fn_ty: ty::t, decl: ast::fn_decl,
                        mode_to_str(arg_ast.mode));
                 match arg_ast.mode {
                     ast::expl(ast::by_copy) => {
-                        /* always allow by-copy */
+                        // This should warn, but we can't yet
+                        // since it's still used. -- tjc
                     }
 
                     ast::expl(_) => {
@@ -694,14 +695,16 @@ fn check_fn_deprecated_modes(tcx: ty::ctxt, fn_ty: ty::t, decl: ast::fn_decl,
                     }
 
                     ast::infer(_) => {
-                        let kind = ty::type_kind(tcx, arg_ty.ty);
-                        if !ty::kind_is_safe_for_default_mode(kind) {
-                            tcx.sess.span_lint(
-                                deprecated_mode, id, id,
-                                span,
-                                fmt!("argument %d uses the default mode \
-                                      but shouldn't",
-                                     counter));
+                        if tcx.legacy_modes {
+                            let kind = ty::type_kind(tcx, arg_ty.ty);
+                            if !ty::kind_is_safe_for_default_mode(kind) {
+                                tcx.sess.span_lint(
+                                    deprecated_mode, id, id,
+                                    span,
+                                    fmt!("argument %d uses the default mode \
+                                          but shouldn't",
+                                         counter));
+                            }
                         }
                     }
                 }