Skip to content

Commit 7e694e7

Browse files
author
Keegan McAllister
committed
More upstream lint changes
1 parent 7dc724b commit 7e694e7

File tree

2 files changed

+7
-27
lines changed

2 files changed

+7
-27
lines changed

src/librustc/lint/builtin.rs

+6-26
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,8 @@ impl LintPass for MissingDoc {
13581358
declare_lint!(DEPRECATED, Warn,
13591359
"detects use of #[deprecated] items")
13601360

1361-
declare_lint!(EXPERIMENTAL, Warn,
1361+
// FIXME #6875: Change to Warn after std library stabilization is complete
1362+
declare_lint!(EXPERIMENTAL, Allow,
13621363
"detects use of #[experimental] items")
13631364

13641365
declare_lint!(UNSTABLE, Allow,
@@ -1411,32 +1412,11 @@ impl LintPass for Stability {
14111412
_ => return
14121413
};
14131414

1414-
let stability = if ast_util::is_local(id) {
1415-
// this crate
1416-
let s = cx.tcx.map.with_attrs(id.node, |attrs| {
1417-
attrs.map(|a| attr::find_stability(a.as_slice()))
1418-
});
1419-
match s {
1420-
Some(s) => s,
1415+
// stability attributes are promises made across crates; do not
1416+
// check anything for crate-local usage.
1417+
if ast_util::is_local(id) { return }
14211418

1422-
// no possibility of having attributes
1423-
// (e.g. it's a local variable), so just
1424-
// ignore it.
1425-
None => return
1426-
}
1427-
} else {
1428-
// cross-crate
1429-
1430-
let mut s = None;
1431-
// run through all the attributes and take the first
1432-
// stability one.
1433-
csearch::get_item_attrs(&cx.sess().cstore, id, |attrs| {
1434-
if s.is_none() {
1435-
s = attr::find_stability(attrs.as_slice())
1436-
}
1437-
});
1438-
s
1439-
};
1419+
let stability = cx.tcx.stability.borrow_mut().lookup(&cx.tcx.sess.cstore, id);
14401420

14411421
let (lint, label) = match stability {
14421422
// no stability attributes == Unstable

src/librustc/lint/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ impl<'a> Context<'a> {
411411
impl<'a> AstConv for Context<'a>{
412412
fn tcx<'a>(&'a self) -> &'a ty::ctxt { self.tcx }
413413

414-
fn get_item_ty(&self, id: ast::DefId) -> ty::ty_param_bounds_and_ty {
414+
fn get_item_ty(&self, id: ast::DefId) -> ty::Polytype {
415415
ty::lookup_item_type(self.tcx, id)
416416
}
417417

0 commit comments

Comments
 (0)