Skip to content

Commit 2aa1d3a

Browse files
committed
---
yaml --- r: 221106 b: refs/heads/tmp c: 0ca8e49 h: refs/heads/master v: v3
1 parent b8dcae1 commit 2aa1d3a

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: c8bab9d06a179028a0d5129aa62f09d694d9cc49
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 22502154e6c1aee835554216d4b5054fd8f570f8
28+
refs/heads/tmp: 0ca8e4994ee43ba9dfbded6e129b30ff5fe7a994
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: e58601ab085591c71a27ae82137fc313222c2270
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/librustc_lint/builtin.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ use syntax::{abi, ast};
5353
use syntax::ast_util::{self, is_shift_binop, local_def};
5454
use syntax::attr::{self, AttrMetaMethods};
5555
use syntax::codemap::{self, Span};
56-
use syntax::feature_gate::{KNOWN_ATTRIBUTES, AttributeType, emit_feature_err};
56+
use syntax::feature_gate::{KNOWN_ATTRIBUTES, AttributeType};
5757
use syntax::parse::token;
5858
use syntax::ast::{TyIs, TyUs, TyI8, TyU8, TyI16, TyU16, TyI32, TyU32, TyI64, TyU64};
5959
use syntax::ptr::P;
@@ -382,11 +382,13 @@ impl LintPass for TypeLimits {
382382

383383
fn check_unsigned_negation_feature(cx: &Context, span: Span) {
384384
if !cx.sess().features.borrow().negate_unsigned {
385-
emit_feature_err(
386-
&cx.sess().parse_sess.span_diagnostic,
387-
"negate_unsigned",
388-
span,
389-
"unary negation of unsigned integers may be removed in the future");
385+
// FIXME(#27141): change this to syntax::feature_gate::emit_feature_err…
386+
cx.sess().span_warn(span,
387+
"unary negation of unsigned integers will be feature gated in the future");
388+
// …and remove following two expressions.
389+
if option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some() { return; }
390+
cx.sess().fileline_help(span, "add #![feature(negate_unsigned)] to the \
391+
crate attributes to enable the gate in advance");
390392
}
391393
}
392394
}

branches/tmp/src/test/compile-fail/feature-gate-negate-unsigned.rs renamed to branches/tmp/src/test/run-pass/feature-gate-negate-unsigned.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ impl std::ops::Neg for S {
1818
}
1919

2020
const _MAX: usize = -1;
21-
//~^ ERROR unary negation of unsigned integers may be removed in the future
21+
//~^ WARN unary negation of unsigned integers will be feature gated in the future
2222

2323
fn main() {
2424
let a = -1;
25-
//~^ ERROR unary negation of unsigned integers may be removed in the future
25+
//~^ WARN unary negation of unsigned integers will be feature gated in the future
2626
let _b : u8 = a; // for infering variable a to u8.
2727

2828
-a;
29-
//~^ ERROR unary negation of unsigned integers may be removed in the future
29+
//~^ WARN unary negation of unsigned integers will be feature gated in the future
3030

3131
let _d = -1u8;
32-
//~^ ERROR unary negation of unsigned integers may be removed in the future
32+
//~^ WARN unary negation of unsigned integers will be feature gated in the future
3333

3434
for _ in -10..10u8 {}
35-
//~^ ERROR unary negation of unsigned integers may be removed in the future
35+
//~^ WARN unary negation of unsigned integers will be feature gated in the future
3636

3737
-S; // should not trigger the gate; issue 26840
3838
}

0 commit comments

Comments
 (0)