mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 01:42:54 +03:00
unused_must_use: Add extra test for types that are still generic
This commit is contained in:
@@ -91,3 +91,11 @@ fn main() {
|
||||
controlflow_infallible_unit();
|
||||
controlflow_never();
|
||||
}
|
||||
|
||||
trait AssocTypeBeforeMonomorphisation {
|
||||
type Error;
|
||||
fn generate(&self) -> Result<(), Self::Error>;
|
||||
fn process(&self) {
|
||||
self.generate(); //~ ERROR: unused `Result` that must be used
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,5 +62,17 @@ help: use `let _ = ...` to ignore the resulting value
|
||||
LL | let _ = controlflow_unit();
|
||||
| +++++++
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: unused `Result` that must be used
|
||||
--> $DIR/must_use-result-unit-uninhabited.rs:99:9
|
||||
|
|
||||
LL | self.generate();
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this `Result` may be an `Err` variant, which should be handled
|
||||
help: use `let _ = ...` to ignore the resulting value
|
||||
|
|
||||
LL | let _ = self.generate();
|
||||
| +++++++
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user