Skip to content

Commit dd5fc65

Browse files
committed
---
yaml --- r: 228526 b: refs/heads/try c: 0ca8e49 h: refs/heads/master v: v3
1 parent ae61ba0 commit dd5fc65

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 22502154e6c1aee835554216d4b5054fd8f570f8
4+
refs/heads/try: 0ca8e4994ee43ba9dfbded6e129b30ff5fe7a994
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/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/try/src/test/compile-fail/feature-gate-negate-unsigned.rs renamed to branches/try/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)