Skip to content

Commit 540afe2

Browse files
committedAug 10, 2023
Comment nits
1 parent 439d066 commit 540afe2

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed
 

‎compiler/rustc_hir_typeck/src/coercion.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,11 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
510510
success(adjustments, ty, obligations)
511511
}
512512

513-
// &[T; n] or &mut [T; n] -> &[T]
514-
// or &mut [T; n] -> &mut [T]
515-
// or &Concrete -> &Trait, etc.
513+
/// Performs [unsized coercion] by emulating a fulfillment loop on a
514+
/// `CoerceUnsized` goal until all `CoerceUnsized` and `Unsize` goals
515+
/// are successfully selected.
516+
///
517+
/// [unsized coercion](https://doc.rust-lang.org/reference/type-coercions.html#unsized-coercions)
516518
#[instrument(skip(self), level = "debug")]
517519
fn coerce_unsized(&self, mut source: Ty<'tcx>, mut target: Ty<'tcx>) -> CoerceResult<'tcx> {
518520
source = self.shallow_resolve(source);

‎compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

-4
Original file line numberDiff line numberDiff line change
@@ -618,8 +618,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
618618

619619
match *self_ty.kind() {
620620
ty::Infer(ty::TyVar(found_vid)) => {
621-
// FIXME: consider using `sub_root_var` here so we
622-
// can see through subtyping.
623621
let found_vid = self.root_var(found_vid);
624622
debug!("self_type_matches_expected_vid - found_vid={:?}", found_vid);
625623
expected_vid == found_vid
@@ -634,8 +632,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
634632
self_ty: ty::TyVid,
635633
) -> impl DoubleEndedIterator<Item = traits::PredicateObligation<'tcx>> + Captures<'tcx> + 'b
636634
{
637-
// FIXME: consider using `sub_root_var` here so we
638-
// can see through subtyping.
639635
let ty_var_root = self.root_var(self_ty);
640636
trace!("pending_obligations = {:#?}", self.fulfillment_cx.borrow().pending_obligations());
641637

‎compiler/rustc_trait_selection/src/traits/select/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2394,7 +2394,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
23942394
Ok(args) => args,
23952395
Err(()) => {
23962396
// FIXME: A rematch may fail when a candidate cache hit occurs
2397-
// on thefreshened form of the trait predicate, but the match
2397+
// on the freshened form of the trait predicate, but the match
23982398
// fails for some reason that is not captured in the freshened
23992399
// cache key. For example, equating an impl trait ref against
24002400
// the placeholder trait ref may fail due the Generalizer relation

‎compiler/rustc_type_ir/src/sty.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ pub enum TyKind<I: Interner> {
200200
/// A tuple type. For example, `(i32, bool)`.
201201
Tuple(I::ListTy),
202202

203-
/// A projection or opaque type. Both of these types
203+
/// A projection, opaque type, weak type alias, or inherent associated type.
204+
/// All of these types are represented as pairs of def-id and args, and can
205+
/// be normalized, so they are grouped conceptually.
204206
Alias(AliasKind, I::AliasTy),
205207

206208
/// A type parameter; for example, `T` in `fn f<T>(x: T) {}`.

0 commit comments

Comments
 (0)
Please sign in to comment.