提交 b64572ce 编写于 作者: M Manish Goregaokar

Add unmarked_api feature (fixes #21884)

上级 4aa661ab
......@@ -253,10 +253,19 @@ fn check(&mut self, id: ast::DefId, span: Span, stab: &Option<Stability>) {
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");
}
}
}
}
......
......@@ -119,6 +119,9 @@
// 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 @@ pub fn new() -> 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<F>(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
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册