Fix len_zero ICE

This commit is contained in:
Oliver Schneider 2017-09-04 17:05:47 +02:00
parent 009f5aaf83
commit 7757c893ef
No known key found for this signature in database
GPG key ID: A69F8D225B3AD7D9
3 changed files with 28 additions and 19 deletions

View file

@ -182,3 +182,10 @@ fn test_slice(b: &[u8]) {
if b.len() != 0 {
}
}
// this used to ICE
pub trait Foo: Sized {}
pub trait DependsOnFoo: Foo {
fn len(&mut self) -> usize;
}

View file

@ -86,5 +86,13 @@ error: length comparison to zero
182 | if b.len() != 0 {
| ^^^^^^^^^^^^ help: using `is_empty` is more concise: `!b.is_empty()`
error: aborting due to 11 previous errors
error: trait `DependsOnFoo` has a `len` method but no (possibly inherited) `is_empty` method
--> $DIR/len_zero.rs:189:1
|
189 | / pub trait DependsOnFoo: Foo {
190 | | fn len(&mut self) -> usize;
191 | | }
| |_^
error: aborting due to 12 previous errors