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)",
"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"
"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"
/// 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.
/// 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
/// 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
/// 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.
/// 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
/// 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
/// 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.
/// 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
/// 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
_ => 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
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
}
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) {
}
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);
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);
run_lints!(cx, check_impl_item_post, late_passes, impl_item);
});
});
+ self.generics = generics;
}
fn visit_lifetime(&mut self, lt: &'tcx hir::Lifetime) {
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.
-Subproject commit 281bd790de7b992831a1ff8a589c0fc38c842c95
+Subproject commit f76225e3887170743403af9204887918b5db5a80
miri = "Broken"
# ping @Manishearth @llogiq @mcarton @oli-obk
-clippy = "Broken"
+clippy = "Compiling"
# ping @nrc
rls = "Testing"