]> git.lizzy.rs Git - rust.git/commitdiff
More upstream lint changes
authorKeegan McAllister <kmcallister@mozilla.com>
Tue, 24 Jun 2014 17:29:08 +0000 (10:29 -0700)
committerKeegan McAllister <kmcallister@mozilla.com>
Tue, 24 Jun 2014 18:36:28 +0000 (11:36 -0700)
src/librustc/lint/builtin.rs
src/librustc/lint/context.rs

index 0a1f83fc79de9e973432d081923276ca6656c550..5078ae80d75c1157f7d3da871d8535fa64ff4e7f 100644 (file)
@@ -1358,7 +1358,8 @@ fn check_variant(&mut self, cx: &Context, v: &ast::Variant, _: &ast::Generics) {
 declare_lint!(DEPRECATED, Warn,
               "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")
 
 declare_lint!(UNSTABLE, Allow,
@@ -1411,32 +1412,11 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
             _ => return
         };
 
-        let stability = if ast_util::is_local(id) {
-            // this crate
-            let s = cx.tcx.map.with_attrs(id.node, |attrs| {
-                attrs.map(|a| attr::find_stability(a.as_slice()))
-            });
-            match s {
-                Some(s) => s,
+        // stability attributes are promises made across crates; do not
+        // check anything for crate-local usage.
+        if ast_util::is_local(id) { return }
 
-                // no possibility of having attributes
-                // (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 stability = cx.tcx.stability.borrow_mut().lookup(&cx.tcx.sess.cstore, id);
 
         let (lint, label) = match stability {
             // no stability attributes == Unstable
index 3ba948786d08dd3e46081372279d395e355152a9..79fbd73c23d3cbdbcffeef0ed299fcc604440657 100644 (file)
@@ -411,7 +411,7 @@ fn visit_ids(&self, f: |&mut ast_util::IdVisitor<Context>|) {
 impl<'a> AstConv for Context<'a>{
     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)
     }