Skip to content

Commit b423d95

Browse files
committed
---
yaml --- r: 178747 b: refs/heads/master c: b64572c h: refs/heads/master i: 178745: 9e6c819 178743: d3a4f8a v: v3
1 parent 32f865d commit b423d95

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 4aa661ab3608551edab18584b958d281f8e4c094
2+
refs/heads/master: b64572cefe9f37c58c07af745afc91bfd0303c30
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3b2ed14906fd9f9daa27cc7d1dad263d2f5ff450
55
refs/heads/try: ccf8fedf1cffcb8f6f3581d53d220039e192fe77

trunk/src/librustc/middle/stability.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,19 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
253253
None => {
254254
// This is an 'unmarked' API, which should not exist
255255
// in the standard library.
256-
self.tcx.sess.span_err(span, "use of unmarked library feature");
257-
self.tcx.sess.span_note(span, "this is either a bug in the library you are \
258-
using or a bug in the compiler - there is \
259-
no way to use this feature");
256+
if self.tcx.sess.features.borrow().unmarked_api {
257+
self.tcx.sess.span_warn(span, "use of unmarked library feature");
258+
self.tcx.sess.span_note(span, "this is either a bug in the library you are \
259+
using and a bug in the compiler - please \
260+
report it in both places");
261+
} else {
262+
self.tcx.sess.span_err(span, "use of unmarked library feature");
263+
self.tcx.sess.span_note(span, "this is either a bug in the library you are \
264+
using and a bug in the compiler - please \
265+
report it in both places");
266+
self.tcx.sess.span_note(span, "use #![feature(unmarked_api)] in the \
267+
crate attributes to override this");
268+
}
260269
}
261270
}
262271
}

trunk/src/libsyntax/feature_gate.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
119119

120120
// Allows use of #[staged_api]
121121
("staged_api", "1.0.0", Active),
122+
123+
// Allows using items which are missing stability attributes
124+
("unmarked_api", "1.0.0", Active)
122125
];
123126

124127
enum Status {
@@ -145,6 +148,7 @@ pub struct Features {
145148
pub quote: bool,
146149
pub old_orphan_check: bool,
147150
pub simd_ffi: bool,
151+
pub unmarked_api: bool,
148152
pub lib_features: Vec<(InternedString, Span)>
149153
}
150154

@@ -157,6 +161,7 @@ impl Features {
157161
quote: false,
158162
old_orphan_check: false,
159163
simd_ffi: false,
164+
unmarked_api: false,
160165
lib_features: Vec::new()
161166
}
162167
}
@@ -566,6 +571,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::C
566571
quote: cx.has_feature("quote"),
567572
old_orphan_check: cx.has_feature("old_orphan_check"),
568573
simd_ffi: cx.has_feature("simd_ffi"),
574+
unmarked_api: cx.has_feature("unmarked_api"),
569575
lib_features: unknown_features
570576
}
571577
}

0 commit comments

Comments
 (0)