Merge pull request #3152 from PSeitz/master

fixes #3151 by skipping the lint instead of crashing
This commit is contained in:
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer 2018-09-10 13:44:47 +02:00 committed by GitHub
commit 1c1030f83f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

View file

@ -1810,9 +1810,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitHasher {
let generics_suggestion_span = generics.span.substitute_dummy({
let pos = snippet_opt(cx, item.span.until(target.span()))
.and_then(|snip| Some(item.span.lo() + BytePos(snip.find("impl")? as u32 + 4)))
.expect("failed to create span for type arguments");
Span::new(pos, pos, item.span.data().ctxt)
.and_then(|snip| Some(item.span.lo() + BytePos(snip.find("impl")? as u32 + 4)));
if let Some(pos) = pos {
Span::new(pos, pos, item.span.data().ctxt)
} else {
return;
}
});
let mut ctr_vis = ImplicitHasherConstructorVisitor::new(cx, target);

View file

@ -0,0 +1,13 @@
#[derive(Clone)]
pub struct HashMap<V, S> {
hash_builder: S,
table: RawTable<V>,
}
#[derive(Clone)]
pub struct RawTable<V> {
size: usize,
val: V
}
fn main() {}