Skip to content

Commit 5e30f05

Browse files
committed
Auto merge of rust-lang#23974 - pnkfelix:fix-23973, r=alexcrichton
Do not suggest `#![feature(...)]` if we are in beta or stable channel. Fix rust-lang#23973
2 parents d17d6e7 + f6a0680 commit 5e30f05

8 files changed

+6
-8
lines changed

Diff for: src/libsyntax/feature_gate.rs

+6
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,19 @@ impl<'a> Context<'a> {
409409

410410
pub fn emit_feature_err(diag: &SpanHandler, feature: &str, span: Span, explain: &str) {
411411
diag.span_err(span, explain);
412+
413+
// #23973: do not suggest `#![feature(...)]` if we are in beta/stable
414+
if option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some() { return; }
412415
diag.fileline_help(span, &format!("add #![feature({})] to the \
413416
crate attributes to enable",
414417
feature));
415418
}
416419

417420
pub fn emit_feature_warn(diag: &SpanHandler, feature: &str, span: Span, explain: &str) {
418421
diag.span_warn(span, explain);
422+
423+
// #23973: do not suggest `#![feature(...)]` if we are in beta/stable
424+
if option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some() { return; }
419425
if diag.handler.can_emit_warnings {
420426
diag.fileline_help(span, &format!("add #![feature({})] to the \
421427
crate attributes to silence this warning",

Diff for: src/test/compile-fail-fulldeps/gated-macro-reexports.rs

-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@
1919
#[macro_use] #[no_link]
2020
extern crate macro_reexport_1;
2121
//~^ ERROR macros reexports are experimental and possibly buggy
22-
//~| HELP add #![feature(macro_reexport)] to the crate attributes to enable

Diff for: src/test/compile-fail/gated-box-patterns.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ fn main() {
1616
match x {
1717
box 1 => (),
1818
//~^ box pattern syntax is experimental
19-
//~| add #![feature(box_patterns)] to the crate attributes to enable
2019
_ => ()
2120
};
2221
}

Diff for: src/test/compile-fail/gated-box-syntax.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@
1313
fn main() {
1414
let x = box 3;
1515
//~^ ERROR box expression syntax is experimental; you can call `Box::new` instead.
16-
//~| HELP add #![feature(box_syntax)] to the crate attributes to enable
1716
}

Diff for: src/test/compile-fail/gated-link-args.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@
1414
#[link_args = "aFdEfSeVEEE"]
1515
extern {}
1616
//~^ ERROR the `link_args` attribute is not portable across platforms
17-
//~| HELP add #![feature(link_args)] to the crate attributes to enable
1817

1918
fn main() { }

Diff for: src/test/compile-fail/gated-link-llvm-intrinsics.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ extern {
1212
#[link_name = "llvm.sqrt.f32"]
1313
fn sqrt(x: f32) -> f32;
1414
//~^ ERROR linking to LLVM intrinsics is experimental
15-
//~| HELP add #![feature(link_llvm_intrinsics)] to the crate attributes
1615
}
1716

1817
fn main(){

Diff for: src/test/compile-fail/gated-plugin_registrar.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@
1515
#[plugin_registrar]
1616
pub fn registrar() {}
1717
//~^ ERROR compiler plugins are experimental
18-
//~| HELP add #![feature(plugin_registrar)] to the crate attributes to enable
1918
fn main() {}

Diff for: src/test/compile-fail/gated-unsafe-destructor.rs

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ struct D<'a>(&'a u32);
1818

1919
#[unsafe_destructor]
2020
//~^ ERROR `#[unsafe_destructor]` does nothing anymore
21-
//~| HELP: add #![feature(unsafe_destructor)] to the crate attributes to enable
22-
// (but of couse there is no point in doing so)
2321
impl<'a> Drop for D<'a> {
2422
fn drop(&mut self) { }
2523
}

0 commit comments

Comments
 (0)