Skip to content

Commit

Permalink
Auto merge of #23974 - pnkfelix:fix-23973, r=alexcrichton
Browse files Browse the repository at this point in the history
Do not suggest `#![feature(...)]` if we are in beta or stable channel.

Fix #23973
  • Loading branch information
bors committed Apr 3, 2015
2 parents d17d6e7 + f6a0680 commit 5e30f05
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,19 @@ impl<'a> Context<'a> {

pub fn emit_feature_err(diag: &SpanHandler, feature: &str, span: Span, explain: &str) {
diag.span_err(span, explain);

// #23973: do not suggest `#![feature(...)]` if we are in beta/stable
if option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some() { return; }
diag.fileline_help(span, &format!("add #![feature({})] to the \
crate attributes to enable",
feature));
}

pub fn emit_feature_warn(diag: &SpanHandler, feature: &str, span: Span, explain: &str) {
diag.span_warn(span, explain);

// #23973: do not suggest `#![feature(...)]` if we are in beta/stable
if option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some() { return; }
if diag.handler.can_emit_warnings {
diag.fileline_help(span, &format!("add #![feature({})] to the \
crate attributes to silence this warning",
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail-fulldeps/gated-macro-reexports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@
#[macro_use] #[no_link]
extern crate macro_reexport_1;
//~^ ERROR macros reexports are experimental and possibly buggy
//~| HELP add #![feature(macro_reexport)] to the crate attributes to enable
1 change: 0 additions & 1 deletion src/test/compile-fail/gated-box-patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ fn main() {
match x {
box 1 => (),
//~^ box pattern syntax is experimental
//~| add #![feature(box_patterns)] to the crate attributes to enable
_ => ()
};
}
1 change: 0 additions & 1 deletion src/test/compile-fail/gated-box-syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
fn main() {
let x = box 3;
//~^ ERROR box expression syntax is experimental; you can call `Box::new` instead.
//~| HELP add #![feature(box_syntax)] to the crate attributes to enable
}
1 change: 0 additions & 1 deletion src/test/compile-fail/gated-link-args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@
#[link_args = "aFdEfSeVEEE"]
extern {}
//~^ ERROR the `link_args` attribute is not portable across platforms
//~| HELP add #![feature(link_args)] to the crate attributes to enable

fn main() { }
1 change: 0 additions & 1 deletion src/test/compile-fail/gated-link-llvm-intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ extern {
#[link_name = "llvm.sqrt.f32"]
fn sqrt(x: f32) -> f32;
//~^ ERROR linking to LLVM intrinsics is experimental
//~| HELP add #![feature(link_llvm_intrinsics)] to the crate attributes
}

fn main(){
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/gated-plugin_registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
#[plugin_registrar]
pub fn registrar() {}
//~^ ERROR compiler plugins are experimental
//~| HELP add #![feature(plugin_registrar)] to the crate attributes to enable
fn main() {}
2 changes: 0 additions & 2 deletions src/test/compile-fail/gated-unsafe-destructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ struct D<'a>(&'a u32);

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

0 comments on commit 5e30f05

Please sign in to comment.