diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2023-12-27 15:29:52 +0100 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2023-12-28 02:03:43 +0100 |
| commit | 90d6fe2cba2b621b4fc331a1f6dd67c63a7c1033 (patch) | |
| tree | 6cf24a9c58141f0f733970e4ddb0f454d98ab6a5 /compiler/rustc_hir_analysis/src/outlives/mod.rs | |
| parent | 2fe50cd72c476ebacdedb14893e9632b4de961c2 (diff) | |
| download | rust-90d6fe2cba2b621b4fc331a1f6dd67c63a7c1033.tar.gz rust-90d6fe2cba2b621b4fc331a1f6dd67c63a7c1033.zip | |
Imply outlives-bounds on lazy type aliases
Diffstat (limited to 'compiler/rustc_hir_analysis/src/outlives/mod.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/outlives/mod.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_hir_analysis/src/outlives/mod.rs b/compiler/rustc_hir_analysis/src/outlives/mod.rs index 72511bfa01f..a87112dcc12 100644 --- a/compiler/rustc_hir_analysis/src/outlives/mod.rs +++ b/compiler/rustc_hir_analysis/src/outlives/mod.rs @@ -21,6 +21,10 @@ fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[(ty::Clau let crate_map = tcx.inferred_outlives_crate(()); crate_map.predicates.get(&item_def_id.to_def_id()).copied().unwrap_or(&[]) } + DefKind::TyAlias if tcx.type_alias_is_lazy(item_def_id) => { + let crate_map = tcx.inferred_outlives_crate(()); + crate_map.predicates.get(&item_def_id.to_def_id()).copied().unwrap_or(&[]) + } DefKind::AnonConst if tcx.features().generic_const_exprs => { let id = tcx.local_def_id_to_hir_id(item_def_id); if tcx.hir().opt_const_param_default_param_def_id(id).is_some() { @@ -47,8 +51,8 @@ fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[(ty::Clau } fn inferred_outlives_crate(tcx: TyCtxt<'_>, (): ()) -> CratePredicatesMap<'_> { - // Compute a map from each struct/enum/union S to the **explicit** - // outlives predicates (`T: 'a`, `'a: 'b`) that the user wrote. + // Compute a map from each ADT (struct/enum/union) and lazy type alias to + // the **explicit** outlives predicates (`T: 'a`, `'a: 'b`) that the user wrote. // Typically there won't be many of these, except in older code where // they were mandatory. Nonetheless, we have to ensure that every such // predicate is satisfied, so they form a kind of base set of requirements |
