Skip to content

Commit 8bc2eba

Browse files
committed
---
yaml --- r: 235597 b: refs/heads/stable c: 0ca8e49 h: refs/heads/master i: 235595: a046703 v: v3
1 parent 3aa63b0 commit 8bc2eba

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
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 22502154e6c1aee835554216d4b5054fd8f570f8
32+
refs/heads/stable: 0ca8e4994ee43ba9dfbded6e129b30ff5fe7a994
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

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