diff options
| author | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-07-20 22:34:26 +0200 |
|---|---|---|
| committer | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-07-20 22:34:26 +0200 |
| commit | c71b196f66d110291a67c3bbc0f8fdb11a261f1f (patch) | |
| tree | 2fe9e66ca45308b9b77d6f31bc4867553dccc9c9 | |
| parent | 1ac3713f256dd379d8fe24b09bc8ba6643ea41b4 (diff) | |
| download | rust-c71b196f66d110291a67c3bbc0f8fdb11a261f1f.tar.gz rust-c71b196f66d110291a67c3bbc0f8fdb11a261f1f.zip | |
review
| -rw-r--r-- | src/librustc_trait_selection/traits/coherence.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/librustc_trait_selection/traits/coherence.rs b/src/librustc_trait_selection/traits/coherence.rs index b3218f97e42..047552b6aeb 100644 --- a/src/librustc_trait_selection/traits/coherence.rs +++ b/src/librustc_trait_selection/traits/coherence.rs @@ -438,6 +438,15 @@ fn orphan_check_trait_ref<'tcx>( /// /// This is just `ty` itself unless `ty` is `#[fundamental]`, /// in which case we recursively look into this type. +/// +/// If `ty` is local itself, this method returns an empty `Vec`. +/// +/// # Examples +/// +/// - `u32` is not local, so this returns `[u32]`. +/// - for `Foo<u32>`, where `Foo` is a local type, this returns `[]`. +/// - `&mut u32` returns `[u32]`, as `&mut` is a fundamental type, similar to `Box`. +/// - `Box<Foo<u32>>` returns `[]`, as `Box` is a fundamental type and `Foo` is local. fn contained_non_local_types(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec<Ty<'tcx>> { if ty_is_local_constructor(ty, in_crate) { Vec::new() @@ -493,7 +502,7 @@ fn def_id_is_local(def_id: DefId, in_crate: InCrate) -> bool { } fn ty_is_local_constructor(ty: Ty<'_>, in_crate: InCrate) -> bool { - debug!("ty_is_non_local_constructor({:?})", ty); + debug!("ty_is_local_constructor({:?})", ty); match ty.kind { ty::Bool |
