We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
InferOk
1 parent 2e33271 commit a553672Copy full SHA for a553672
compiler/rustc_infer/src/infer/mod.rs
@@ -68,6 +68,12 @@ pub mod resolve;
68
pub(crate) mod snapshot;
69
mod type_variable;
70
71
+// `InferOk<'tcx, ()>` is used a lot. It may seem like a useless wrapper around
72
+// `Vec<PredicateObligation<'tcx>>`, but it has one important property: because
73
+// `InferOk` is marked with `#[must_use]`, if you have a method `InferCtxt::f`
74
+// that returns `InferResult<'tcx, ()>` and you call it with `infcx.f()?;`
75
+// you'll get a warning about the obligations being discarded without use,
76
+// which is probably unintentional and has been a source of bugs in the past.
77
#[must_use]
78
#[derive(Debug)]
79
pub struct InferOk<'tcx, T> {
0 commit comments