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 4dc6a55 commit 6516aaaCopy full SHA for 6516aaa
compiler/rustc_infer/src/infer/mod.rs
@@ -68,6 +68,13 @@ 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
72
+/// around `Vec<PredicateObligation<'tcx>>`, but it has one important property:
73
+/// because `InferOk` is marked with `#[must_use]`, if you have a method
74
+/// `InferCtxt::f` that returns `InferResult<'tcx, ()>` and you call it with
75
+/// `infcx.f()?;` you'll get a warning about the obligations being discarded
76
+/// without use, which is probably unintentional and has been a source of bugs
77
+/// in the past.
78
#[must_use]
79
#[derive(Debug)]
80
pub struct InferOk<'tcx, T> {
0 commit comments