mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Merge pull request #701 from mcarton/fix-700
Fix ICE with match_def_path
This commit is contained in:
commit
f38be64afc
2 changed files with 14 additions and 1 deletions
|
@ -133,8 +133,12 @@ pub fn in_external_macro<T: LintContext>(cx: &T, span: Span) -> bool {
|
|||
/// ```
|
||||
pub fn match_def_path(cx: &LateContext, def_id: DefId, path: &[&str]) -> bool {
|
||||
cx.tcx.with_path(def_id, |iter| {
|
||||
iter.zip(path)
|
||||
let mut len = 0;
|
||||
|
||||
iter.inspect(|_| len += 1)
|
||||
.zip(path)
|
||||
.all(|(nm, p)| nm.name().as_str() == *p)
|
||||
&& len == path.len()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
9
tests/run-pass/ice-700.rs
Executable file
9
tests/run-pass/ice-700.rs
Executable file
|
@ -0,0 +1,9 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
#![deny(clippy)]
|
||||
|
||||
fn core() {}
|
||||
|
||||
fn main() {
|
||||
core();
|
||||
}
|
Loading…
Reference in a new issue