diff options
| author | bors <bors@rust-lang.org> | 2024-07-29 19:25:46 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-07-29 19:25:46 +0000 |
| commit | 612a33f20b9b2c27380edbc4b26a01433ed114bc (patch) | |
| tree | 7610e78da2568c6ddcc19a3ae4827fded4dc1bf4 /compiler/rustc_hir_analysis/src/collect.rs | |
| parent | 66e5852c3bd022e2a589a089a0bc8392f8b291e1 (diff) | |
| parent | 83734f2802da74fbd1c95d6c79962944fdec31c9 (diff) | |
| download | rust-612a33f20b9b2c27380edbc4b26a01433ed114bc.tar.gz rust-612a33f20b9b2c27380edbc4b26a01433ed114bc.zip | |
Auto merge of #128350 - matthiaskrgr:rollup-bcuhts8, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #127882 (Don't elaborate associated types with Sized bounds in `trait_object_ty` in cfi) - #128174 (Don't record trait aliases as marker traits) - #128202 (Tell users not to file a bug when using internal library features) - #128239 (Don't ICE when encountering error regions when confirming object method candidate) - #128337 (skip assoc type during infer source visitor) - #128341 (Make `rustc_attr::parse_version` pub) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_hir_analysis/src/collect.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/collect.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 37aab83677a..47ff748547a 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -1207,25 +1207,29 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AdtDef<'_> { fn trait_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::TraitDef { let item = tcx.hir().expect_item(def_id); - let (is_auto, safety, items) = match item.kind { + let (is_alias, is_auto, safety, items) = match item.kind { hir::ItemKind::Trait(is_auto, safety, .., items) => { - (is_auto == hir::IsAuto::Yes, safety, items) + (false, is_auto == hir::IsAuto::Yes, safety, items) } - hir::ItemKind::TraitAlias(..) => (false, hir::Safety::Safe, &[][..]), + hir::ItemKind::TraitAlias(..) => (true, false, hir::Safety::Safe, &[][..]), _ => span_bug!(item.span, "trait_def_of_item invoked on non-trait"), }; - let constness = if tcx.has_attr(def_id, sym::const_trait) { + // Only regular traits can be const. + let constness = if !is_alias && tcx.has_attr(def_id, sym::const_trait) { hir::Constness::Const } else { hir::Constness::NotConst }; + let paren_sugar = tcx.has_attr(def_id, sym::rustc_paren_sugar); if paren_sugar && !tcx.features().unboxed_closures { tcx.dcx().emit_err(errors::ParenSugarAttribute { span: item.span }); } - let is_marker = tcx.has_attr(def_id, sym::marker); + // Only regular traits can be marker. + let is_marker = !is_alias && tcx.has_attr(def_id, sym::marker); + let rustc_coinductive = tcx.has_attr(def_id, sym::rustc_coinductive); let is_fundamental = tcx.has_attr(def_id, sym::fundamental); |
