Skip to content

Commit dfbedf5

Browse files
authored
Rollup merge of rust-lang#97967 - BoxyUwU:at_docs_mention_trace, r=compiler-errors
Mention `infer::Trace` methods on `infer::At` methods' docs I missed that you could do `infcx.at(...).trace(...).eq(a, b)` when `a` and `b` dont implement `ToTrace` but does implement `Relate` these docs would have helped see that 😅
2 parents 5dc8f17 + 9f1d370 commit dfbedf5

File tree

1 file changed

+21
-0
lines changed
  • compiler/rustc_infer/src/infer

1 file changed

+21
-0
lines changed

compiler/rustc_infer/src/infer/at.rs

+21
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ impl<'a, 'tcx> At<'a, 'tcx> {
111111
}
112112

113113
/// Makes `a <: b`, where `a` may or may not be expected.
114+
///
115+
/// See [`At::trace_exp`] and [`Trace::sub`] for a version of
116+
/// this method that only requires `T: Relate<'tcx>`
114117
pub fn sub_exp<T>(self, a_is_expected: bool, a: T, b: T) -> InferResult<'tcx, ()>
115118
where
116119
T: ToTrace<'tcx>,
@@ -122,6 +125,9 @@ impl<'a, 'tcx> At<'a, 'tcx> {
122125
/// call like `foo(x)`, where `foo: fn(i32)`, you might have
123126
/// `sup(i32, x)`, since the "expected" type is the type that
124127
/// appears in the signature.
128+
///
129+
/// See [`At::trace`] and [`Trace::sub`] for a version of
130+
/// this method that only requires `T: Relate<'tcx>`
125131
pub fn sup<T>(self, expected: T, actual: T) -> InferResult<'tcx, ()>
126132
where
127133
T: ToTrace<'tcx>,
@@ -130,6 +136,9 @@ impl<'a, 'tcx> At<'a, 'tcx> {
130136
}
131137

132138
/// Makes `expected <: actual`.
139+
///
140+
/// See [`At::trace`] and [`Trace::sub`] for a version of
141+
/// this method that only requires `T: Relate<'tcx>`
133142
pub fn sub<T>(self, expected: T, actual: T) -> InferResult<'tcx, ()>
134143
where
135144
T: ToTrace<'tcx>,
@@ -138,6 +147,9 @@ impl<'a, 'tcx> At<'a, 'tcx> {
138147
}
139148

140149
/// Makes `expected <: actual`.
150+
///
151+
/// See [`At::trace_exp`] and [`Trace::eq`] for a version of
152+
/// this method that only requires `T: Relate<'tcx>`
141153
pub fn eq_exp<T>(self, a_is_expected: bool, a: T, b: T) -> InferResult<'tcx, ()>
142154
where
143155
T: ToTrace<'tcx>,
@@ -146,6 +158,9 @@ impl<'a, 'tcx> At<'a, 'tcx> {
146158
}
147159

148160
/// Makes `expected <: actual`.
161+
///
162+
/// See [`At::trace`] and [`Trace::eq`] for a version of
163+
/// this method that only requires `T: Relate<'tcx>`
149164
pub fn eq<T>(self, expected: T, actual: T) -> InferResult<'tcx, ()>
150165
where
151166
T: ToTrace<'tcx>,
@@ -176,6 +191,9 @@ impl<'a, 'tcx> At<'a, 'tcx> {
176191
/// this can result in an error (e.g., if asked to compute LUB of
177192
/// u32 and i32), it is meaningful to call one of them the
178193
/// "expected type".
194+
///
195+
/// See [`At::trace`] and [`Trace::lub`] for a version of
196+
/// this method that only requires `T: Relate<'tcx>`
179197
pub fn lub<T>(self, expected: T, actual: T) -> InferResult<'tcx, T>
180198
where
181199
T: ToTrace<'tcx>,
@@ -186,6 +204,9 @@ impl<'a, 'tcx> At<'a, 'tcx> {
186204
/// Computes the greatest-lower-bound, or mutual subtype, of two
187205
/// values. As with `lub` order doesn't matter, except for error
188206
/// cases.
207+
///
208+
/// See [`At::trace`] and [`Trace::glb`] for a version of
209+
/// this method that only requires `T: Relate<'tcx>`
189210
pub fn glb<T>(self, expected: T, actual: T) -> InferResult<'tcx, T>
190211
where
191212
T: ToTrace<'tcx>,

0 commit comments

Comments
 (0)