You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
clone-abort-3.rs:14:4: 14:14 error: cannot call a method whose type contains a self-type through an object
clone-abort-3.rs:14 x.clone();
^~~~~~~~~~
error: aborting due to previous error
task 'rustc' failed at 'explicit failure', /home/huon/rust/src/libsyntax/diagnostic.rs:102
task '<main>' failed at 'explicit failure', /home/huon/rust/src/librustc/lib.rs:395
It seems like that should prefer the (~Foo).clone() method rather than trying to call the .clone that the compiler knows that the inner type must have.
The text was updated successfully, but these errors were encountered:
That is not how method resolution works. Object methods are preferred (for various reasons, among them that otherwise you cannot impl Trait for ~Trait). Eventually universal method call syntax should allow you to be explicit for now you can write:
new lint: `missing_asserts_for_indexing`
Fixesrust-lang#8296
This lint looks for repeated slice indexing and suggests adding an `assert!` beforehand that helps LLVM elide bounds checks. The lint documentation has an example.
I'm not really sure what category this should be in. It seems like a nice lint for the `perf` category but I suspect this has a pretty high FP rate, so it might have to be a pedantic lint or something.
I'm also not sure about the name. If someone knows a better name for this lint, I'd be fine with changing it.
changelog: new lint [`missing_asserts_for_indexing`]
It seems like that should prefer the
(~Foo).clone()
method rather than trying to call the.clone
that the compiler knows that the inner type must have.The text was updated successfully, but these errors were encountered: