Skip to content

Commit c71b196

Browse files
committed
review
1 parent 1ac3713 commit c71b196

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/librustc_trait_selection/traits/coherence.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,15 @@ fn orphan_check_trait_ref<'tcx>(
438438
///
439439
/// This is just `ty` itself unless `ty` is `#[fundamental]`,
440440
/// in which case we recursively look into this type.
441+
///
442+
/// If `ty` is local itself, this method returns an empty `Vec`.
443+
///
444+
/// # Examples
445+
///
446+
/// - `u32` is not local, so this returns `[u32]`.
447+
/// - for `Foo<u32>`, where `Foo` is a local type, this returns `[]`.
448+
/// - `&mut u32` returns `[u32]`, as `&mut` is a fundamental type, similar to `Box`.
449+
/// - `Box<Foo<u32>>` returns `[]`, as `Box` is a fundamental type and `Foo` is local.
441450
fn contained_non_local_types(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec<Ty<'tcx>> {
442451
if ty_is_local_constructor(ty, in_crate) {
443452
Vec::new()
@@ -493,7 +502,7 @@ fn def_id_is_local(def_id: DefId, in_crate: InCrate) -> bool {
493502
}
494503

495504
fn ty_is_local_constructor(ty: Ty<'_>, in_crate: InCrate) -> bool {
496-
debug!("ty_is_non_local_constructor({:?})", ty);
505+
debug!("ty_is_local_constructor({:?})", ty);
497506

498507
match ty.kind {
499508
ty::Bool

0 commit comments

Comments
 (0)