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 abf212c commit 27dad00Copy full SHA for 27dad00
compiler/rustc_infer/src/infer/mod.rs
@@ -67,6 +67,13 @@ pub mod resolve;
67
pub(crate) mod snapshot;
68
mod type_variable;
69
70
+/// `InferOk<'tcx, ()>` is used a lot. It may seem like a useless wrapper
71
+/// around `Vec<PredicateObligation<'tcx>>`, but it has one important property:
72
+/// because `InferOk` is marked with `#[must_use]`, if you have a method
73
+/// `InferCtxt::f` that returns `InferResult<'tcx, ()>` and you call it with
74
+/// `infcx.f()?;` you'll get a warning about the obligations being discarded
75
+/// without use, which is probably unintentional and has been a source of bugs
76
+/// in the past.
77
#[must_use]
78
#[derive(Debug)]
79
pub struct InferOk<'tcx, T> {
0 commit comments