Skip to content

Commit 24fbf88

Browse files
committed
In lint, don't complain about infer mode if legacy modes aren't enabled
1 parent e480e19 commit 24fbf88

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/rustc/middle/lint.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,8 @@ fn check_fn_deprecated_modes(tcx: ty::ctxt, fn_ty: ty::t, decl: ast::fn_decl,
683683
mode_to_str(arg_ast.mode));
684684
match arg_ast.mode {
685685
ast::expl(ast::by_copy) => {
686-
/* always allow by-copy */
686+
// This should warn, but we can't yet
687+
// since it's still used. -- tjc
687688
}
688689

689690
ast::expl(_) => {
@@ -694,14 +695,16 @@ fn check_fn_deprecated_modes(tcx: ty::ctxt, fn_ty: ty::t, decl: ast::fn_decl,
694695
}
695696

696697
ast::infer(_) => {
697-
let kind = ty::type_kind(tcx, arg_ty.ty);
698-
if !ty::kind_is_safe_for_default_mode(kind) {
699-
tcx.sess.span_lint(
700-
deprecated_mode, id, id,
701-
span,
702-
fmt!("argument %d uses the default mode \
703-
but shouldn't",
704-
counter));
698+
if tcx.legacy_modes {
699+
let kind = ty::type_kind(tcx, arg_ty.ty);
700+
if !ty::kind_is_safe_for_default_mode(kind) {
701+
tcx.sess.span_lint(
702+
deprecated_mode, id, id,
703+
span,
704+
fmt!("argument %d uses the default mode \
705+
but shouldn't",
706+
counter));
707+
}
705708
}
706709
}
707710
}

0 commit comments

Comments
 (0)