mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
fixes #3151 by skipping the lint instead of crashing
This commit is contained in:
parent
fdd830f52c
commit
43549ebbf8
2 changed files with 19 additions and 3 deletions
|
@ -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);
|
||||
|
|
13
tests/run-pass/ice-3151.rs
Normal file
13
tests/run-pass/ice-3151.rs
Normal 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() {}
|
Loading…
Reference in a new issue