Skip to content

Commit a9ca113

Browse files
committed
Update query normalizer docs
1 parent 60493b8 commit a9ca113

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

compiler/rustc_trait_selection/src/traits/query/normalize.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,19 @@ impl<'a, 'tcx> At<'a, 'tcx> {
3131
/// normalized. If you don't care about regions, you should prefer
3232
/// `normalize_erasing_regions`, which is more efficient.
3333
///
34-
/// If the normalization succeeds and is unambiguous, returns back
35-
/// the normalized value along with various outlives relations (in
36-
/// the form of obligations that must be discharged).
34+
/// If the normalization succeeds, returns back the normalized
35+
/// value along with various outlives relations (in the form of
36+
/// obligations that must be discharged).
3737
///
38-
/// N.B., this will *eventually* be the main means of
39-
/// normalizing, but for now should be used only when we actually
40-
/// know that normalization will succeed, since error reporting
41-
/// and other details are still "under development".
42-
///
43-
/// This normalization should *only* be used when the projection does not
44-
/// have possible ambiguity or may not be well-formed.
38+
/// This normalization should *only* be used when the projection is well-formed and
39+
/// does not have possible ambiguity (contains inference variables).
4540
///
4641
/// After codegen, when lifetimes do not matter, it is preferable to instead
4742
/// use [`TyCtxt::normalize_erasing_regions`], which wraps this procedure.
43+
///
44+
/// N.B. Once the new solver is stabilized this method of normalization will
45+
/// likely be removed as trait solver operations are already cached by the query
46+
/// system making this redundant.
4847
fn query_normalize<T>(self, value: T) -> Result<Normalized<'tcx, T>, NoSolution>
4948
where
5049
T: TypeFoldable<TyCtxt<'tcx>>,
@@ -210,8 +209,6 @@ impl<'a, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'a, 'tcx> {
210209

211210
// See note in `rustc_trait_selection::traits::project` about why we
212211
// wait to fold the args.
213-
214-
// Wrap this in a closure so we don't accidentally return from the outer function
215212
let res = match kind {
216213
ty::Opaque => {
217214
// Only normalize `impl Trait` outside of type inference, usually in codegen.

0 commit comments

Comments
 (0)