diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index f446c4daefb..3a69489df2a 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -253,10 +253,19 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { None => { // This is an 'unmarked' API, which should not exist // in the standard library. - self.tcx.sess.span_err(span, "use of unmarked library feature"); - self.tcx.sess.span_note(span, "this is either a bug in the library you are \ - using or a bug in the compiler - there is \ - no way to use this feature"); + if self.tcx.sess.features.borrow().unmarked_api { + self.tcx.sess.span_warn(span, "use of unmarked library feature"); + self.tcx.sess.span_note(span, "this is either a bug in the library you are \ + using and a bug in the compiler - please \ + report it in both places"); + } else { + self.tcx.sess.span_err(span, "use of unmarked library feature"); + self.tcx.sess.span_note(span, "this is either a bug in the library you are \ + using and a bug in the compiler - please \ + report it in both places"); + self.tcx.sess.span_note(span, "use #![feature(unmarked_api)] in the \ + crate attributes to override this"); + } } } } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 4e76359e930..d7a51e1149f 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -119,6 +119,9 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[ // Allows use of #[staged_api] ("staged_api", "1.0.0", Active), + + // Allows using items which are missing stability attributes + ("unmarked_api", "1.0.0", Active) ]; enum Status { @@ -145,6 +148,7 @@ pub struct Features { pub quote: bool, pub old_orphan_check: bool, pub simd_ffi: bool, + pub unmarked_api: bool, pub lib_features: Vec<(InternedString, Span)> } @@ -157,6 +161,7 @@ impl Features { quote: false, old_orphan_check: false, simd_ffi: false, + unmarked_api: false, lib_features: Vec::new() } } @@ -566,6 +571,7 @@ fn check_crate_inner(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::C quote: cx.has_feature("quote"), old_orphan_check: cx.has_feature("old_orphan_check"), simd_ffi: cx.has_feature("simd_ffi"), + unmarked_api: cx.has_feature("unmarked_api"), lib_features: unknown_features } }