More upstream lint changes
This commit is contained in:
parent
7dc724bf88
commit
7e694e7115
2 changed files with 7 additions and 27 deletions
|
@ -1358,7 +1358,8 @@ impl LintPass for MissingDoc {
|
||||||
declare_lint!(DEPRECATED, Warn,
|
declare_lint!(DEPRECATED, Warn,
|
||||||
"detects use of #[deprecated] items")
|
"detects use of #[deprecated] items")
|
||||||
|
|
||||||
declare_lint!(EXPERIMENTAL, Warn,
|
// FIXME #6875: Change to Warn after std library stabilization is complete
|
||||||
|
declare_lint!(EXPERIMENTAL, Allow,
|
||||||
"detects use of #[experimental] items")
|
"detects use of #[experimental] items")
|
||||||
|
|
||||||
declare_lint!(UNSTABLE, Allow,
|
declare_lint!(UNSTABLE, Allow,
|
||||||
|
@ -1411,32 +1412,11 @@ impl LintPass for Stability {
|
||||||
_ => return
|
_ => return
|
||||||
};
|
};
|
||||||
|
|
||||||
let stability = if ast_util::is_local(id) {
|
// stability attributes are promises made across crates; do not
|
||||||
// this crate
|
// check anything for crate-local usage.
|
||||||
let s = cx.tcx.map.with_attrs(id.node, |attrs| {
|
if ast_util::is_local(id) { return }
|
||||||
attrs.map(|a| attr::find_stability(a.as_slice()))
|
|
||||||
});
|
|
||||||
match s {
|
|
||||||
Some(s) => s,
|
|
||||||
|
|
||||||
// no possibility of having attributes
|
let stability = cx.tcx.stability.borrow_mut().lookup(&cx.tcx.sess.cstore, id);
|
||||||
// (e.g. it's a local variable), so just
|
|
||||||
// ignore it.
|
|
||||||
None => return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// cross-crate
|
|
||||||
|
|
||||||
let mut s = None;
|
|
||||||
// run through all the attributes and take the first
|
|
||||||
// stability one.
|
|
||||||
csearch::get_item_attrs(&cx.sess().cstore, id, |attrs| {
|
|
||||||
if s.is_none() {
|
|
||||||
s = attr::find_stability(attrs.as_slice())
|
|
||||||
}
|
|
||||||
});
|
|
||||||
s
|
|
||||||
};
|
|
||||||
|
|
||||||
let (lint, label) = match stability {
|
let (lint, label) = match stability {
|
||||||
// no stability attributes == Unstable
|
// no stability attributes == Unstable
|
||||||
|
|
|
@ -411,7 +411,7 @@ impl<'a> Context<'a> {
|
||||||
impl<'a> AstConv for Context<'a>{
|
impl<'a> AstConv for Context<'a>{
|
||||||
fn tcx<'a>(&'a self) -> &'a ty::ctxt { self.tcx }
|
fn tcx<'a>(&'a self) -> &'a ty::ctxt { self.tcx }
|
||||||
|
|
||||||
fn get_item_ty(&self, id: ast::DefId) -> ty::ty_param_bounds_and_ty {
|
fn get_item_ty(&self, id: ast::DefId) -> ty::Polytype {
|
||||||
ty::lookup_item_type(self.tcx, id)
|
ty::lookup_item_type(self.tcx, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue