]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #45597 - DSpeckhals:rustfmt-update, r=nrc
authorbors <bors@rust-lang.org>
Sun, 29 Oct 2017 21:25:12 +0000 (21:25 +0000)
committerbors <bors@rust-lang.org>
Sun, 29 Oct 2017 21:25:12 +0000 (21:25 +0000)
tools: Update rustfmt and re-enable testing

This allows rustfmt and the RLS to test and compile again.

src/Cargo.lock
src/libcore/ptr.rs
src/librustc/hir/mod.rs
src/librustc/lint/context.rs
src/tools/clippy
src/tools/toolstate.toml

index 7b64633802d268a79e38dbfdf2ebd2978e4b8510..69c3789f337c69abb73efadff403f1cdd5abed3c 100644 (file)
@@ -290,6 +290,7 @@ version = "0.1.0"
 name = "clippy_lints"
 version = "0.0.166"
 dependencies = [
+ "if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -789,6 +790,11 @@ dependencies = [
  "unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "if_chain"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
 [[package]]
 name = "ignore"
 version = "0.2.2"
@@ -2665,6 +2671,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum html-diff 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5298d63081a642508fce965740ddb03a386c5d81bf1fef0579a815cf49cb8c68"
 "checksum html5ever 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a49d5001dd1bddf042ea41ed4e0a671d50b1bf187e66b349d7ec613bdce4ad90"
 "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d"
+"checksum if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "61bb90bdd39e3af69b0172dfc6130f6cd6332bf040fbb9bdd4401d37adbd48b8"
 "checksum ignore 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b3fcaf2365eb14b28ec7603c98c06cc531f19de9eb283d89a3dff8417c8c99f5"
 "checksum itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d3f2be4da1690a039e9ae5fd575f706a63ad5a2120f161b1d653c9da3930dd21"
 "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
index 0e8b5df85a96a8c5b2bee36335fe6cd74f0bd615..5cd672b03ffc9d1901364eae4246ad76789547cf 100644 (file)
@@ -228,7 +228,7 @@ pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
 /// moves the value out of `src` without preventing further usage of `src`.
 /// If `T` is not `Copy`, then care must be taken to ensure that the value at
 /// `src` is not used before the data is overwritten again (e.g. with `write`,
-/// `zero_memory`, or `copy_memory`). Note that `*src = foo` counts as a use
+/// `write_bytes`, or `copy`). Note that `*src = foo` counts as a use
 /// because it will attempt to drop the value previously at `*src`.
 ///
 /// The pointer must be aligned; use `read_unaligned` if that is not the case.
@@ -264,7 +264,7 @@ pub unsafe fn read<T>(src: *const T) -> T {
 /// moves the value out of `src` without preventing further usage of `src`.
 /// If `T` is not `Copy`, then care must be taken to ensure that the value at
 /// `src` is not used before the data is overwritten again (e.g. with `write`,
-/// `zero_memory`, or `copy_memory`). Note that `*src = foo` counts as a use
+/// `write_bytes`, or `copy`). Note that `*src = foo` counts as a use
 /// because it will attempt to drop the value previously at `*src`.
 ///
 /// # Examples
@@ -397,7 +397,7 @@ pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
 /// moves the value out of `src` without preventing further usage of `src`.
 /// If `T` is not `Copy`, then care must be taken to ensure that the value at
 /// `src` is not used before the data is overwritten again (e.g. with `write`,
-/// `zero_memory`, or `copy_memory`). Note that `*src = foo` counts as a use
+/// `write_bytes`, or `copy`). Note that `*src = foo` counts as a use
 /// because it will attempt to drop the value previously at `*src`.
 ///
 /// # Examples
@@ -871,7 +871,7 @@ pub fn wrapping_sub(self, count: usize) -> Self
     /// moves the value out of `self` without preventing further usage of `self`.
     /// If `T` is not `Copy`, then care must be taken to ensure that the value at
     /// `self` is not used before the data is overwritten again (e.g. with `write`,
-    /// `zero_memory`, or `copy_memory`). Note that `*self = foo` counts as a use
+    /// `write_bytes`, or `copy`). Note that `*self = foo` counts as a use
     /// because it will attempt to drop the value previously at `*self`.
     ///
     /// The pointer must be aligned; use `read_unaligned` if that is not the case.
@@ -925,7 +925,7 @@ pub unsafe fn read(self) -> T
     /// moves the value out of `self` without preventing further usage of `self`.
     /// If `T` is not `Copy`, then care must be taken to ensure that the value at
     /// `self` is not used before the data is overwritten again (e.g. with `write`,
-    /// `zero_memory`, or `copy_memory`). Note that `*self = foo` counts as a use
+    /// `write_bytes`, or `copy`). Note that `*self = foo` counts as a use
     /// because it will attempt to drop the value previously at `*self`.
     ///
     /// # Examples
@@ -961,7 +961,7 @@ pub unsafe fn read_volatile(self) -> T
     /// moves the value out of `self` without preventing further usage of `self`.
     /// If `T` is not `Copy`, then care must be taken to ensure that the value at
     /// `self` is not used before the data is overwritten again (e.g. with `write`,
-    /// `zero_memory`, or `copy_memory`). Note that `*self = foo` counts as a use
+    /// `write_bytes`, or `copy`). Note that `*self = foo` counts as a use
     /// because it will attempt to drop the value previously at `*self`.
     ///
     /// # Examples
@@ -1569,7 +1569,7 @@ pub fn wrapping_sub(self, count: usize) -> Self
     /// moves the value out of `self` without preventing further usage of `self`.
     /// If `T` is not `Copy`, then care must be taken to ensure that the value at
     /// `self` is not used before the data is overwritten again (e.g. with `write`,
-    /// `zero_memory`, or `copy_memory`). Note that `*self = foo` counts as a use
+    /// `write_bytes`, or `copy`). Note that `*self = foo` counts as a use
     /// because it will attempt to drop the value previously at `*self`.
     ///
     /// The pointer must be aligned; use `read_unaligned` if that is not the case.
@@ -1623,7 +1623,7 @@ pub unsafe fn read(self) -> T
     /// moves the value out of `self` without preventing further usage of `self`.
     /// If `T` is not `Copy`, then care must be taken to ensure that the value at
     /// `src` is not used before the data is overwritten again (e.g. with `write`,
-    /// `zero_memory`, or `copy_memory`). Note that `*self = foo` counts as a use
+    /// `write_bytes`, or `copy`). Note that `*self = foo` counts as a use
     /// because it will attempt to drop the value previously at `*self`.
     ///
     /// # Examples
@@ -1659,7 +1659,7 @@ pub unsafe fn read_volatile(self) -> T
     /// moves the value out of `self` without preventing further usage of `self`.
     /// If `T` is not `Copy`, then care must be taken to ensure that the value at
     /// `self` is not used before the data is overwritten again (e.g. with `write`,
-    /// `zero_memory`, or `copy_memory`). Note that `*self = foo` counts as a use
+    /// `write_bytes`, or `copy`). Note that `*self = foo` counts as a use
     /// because it will attempt to drop the value previously at `*self`.
     ///
     /// # Examples
index ca5ffe830488d7ad5cb84873f5959eaa26bef00c..58f1b1f9a41e73a05f5e110b000d92b343546f7c 100644 (file)
@@ -1854,6 +1854,19 @@ pub fn adt_kind(&self) -> Option<AdtKind> {
             _ => None,
         }
     }
+
+    pub fn generics(&self) -> Option<&Generics> {
+        Some(match *self {
+            ItemFn(_, _, _, _, ref generics, _) |
+            ItemTy(_, ref generics) |
+            ItemEnum(_, ref generics) |
+            ItemStruct(_, ref generics) |
+            ItemUnion(_, ref generics) |
+            ItemTrait(_, ref generics, _, _) |
+            ItemImpl(_, _, _, ref generics, _, _, _)=> generics,
+            _ => return None
+        })
+    }
 }
 
 /// A reference from an trait to one of its associated items. This
index 4d1374b69b85cdde7e26555543b7e03ae72a284a..601e0316d4af92cfe00a0dca46551e81d74dbd08 100644 (file)
@@ -352,6 +352,9 @@ pub struct LateContext<'a, 'tcx: 'a> {
     lint_sess: LintSession<'tcx, LateLintPassObject>,
 
     last_ast_node_with_lint_attrs: ast::NodeId,
+
+    /// Generic type parameters in scope for the item we are in.
+    pub generics: Option<&'tcx hir::Generics>,
 }
 
 /// Context for lint checking of the AST, after expansion, before lowering to
@@ -646,13 +649,16 @@ fn visit_body(&mut self, body: &'tcx hir::Body) {
     }
 
     fn visit_item(&mut self, it: &'tcx hir::Item) {
+        let generics = self.generics.take();
+        self.generics = it.node.generics();
         self.with_lint_attrs(it.id, &it.attrs, |cx| {
             cx.with_param_env(it.id, |cx| {
                 run_lints!(cx, check_item, late_passes, it);
                 hir_visit::walk_item(cx, it);
                 run_lints!(cx, check_item_post, late_passes, it);
             });
-        })
+        });
+        self.generics = generics;
     }
 
     fn visit_foreign_item(&mut self, it: &'tcx hir::ForeignItem) {
@@ -774,6 +780,8 @@ fn visit_generics(&mut self, g: &'tcx hir::Generics) {
     }
 
     fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
+        let generics = self.generics.take();
+        self.generics = Some(&trait_item.generics);
         self.with_lint_attrs(trait_item.id, &trait_item.attrs, |cx| {
             cx.with_param_env(trait_item.id, |cx| {
                 run_lints!(cx, check_trait_item, late_passes, trait_item);
@@ -781,9 +789,12 @@ fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
                 run_lints!(cx, check_trait_item_post, late_passes, trait_item);
             });
         });
+        self.generics = generics;
     }
 
     fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) {
+        let generics = self.generics.take();
+        self.generics = Some(&impl_item.generics);
         self.with_lint_attrs(impl_item.id, &impl_item.attrs, |cx| {
             cx.with_param_env(impl_item.id, |cx| {
                 run_lints!(cx, check_impl_item, late_passes, impl_item);
@@ -791,6 +802,7 @@ fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) {
                 run_lints!(cx, check_impl_item_post, late_passes, impl_item);
             });
         });
+        self.generics = generics;
     }
 
     fn visit_lifetime(&mut self, lt: &'tcx hir::Lifetime) {
@@ -991,6 +1003,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
         access_levels,
         lint_sess: LintSession::new(&tcx.sess.lint_store),
         last_ast_node_with_lint_attrs: ast::CRATE_NODE_ID,
+        generics: None,
     };
 
     // Visit the whole crate.
index 281bd790de7b992831a1ff8a589c0fc38c842c95..f76225e3887170743403af9204887918b5db5a80 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 281bd790de7b992831a1ff8a589c0fc38c842c95
+Subproject commit f76225e3887170743403af9204887918b5db5a80
index f1684f4c5acbe42f5f8eb94ba87a3408b9bd5bc9..e62597c52169fb6a5c15d860a2fcd1534b3794d9 100644 (file)
@@ -26,7 +26,7 @@
 miri = "Broken"
 
 # ping @Manishearth @llogiq @mcarton @oli-obk
-clippy = "Broken"
+clippy = "Compiling"
 
 # ping @nrc
 rls = "Testing"