diff options
| author | bors <bors@rust-lang.org> | 2023-08-08 02:27:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-08 02:27:38 +0000 |
| commit | 8e7fd551311d424e4e63fa45906a2a928fce96a7 (patch) | |
| tree | d3afa2d901c697b08d0039dee07833fd15f48e47 /src | |
| parent | 443c3161dd04f4c1b656a626f9079921bee9c326 (diff) | |
| parent | 07b2c971a1f9a2db803bb93e6751f8a451fc664d (diff) | |
| download | rust-8e7fd551311d424e4e63fa45906a2a928fce96a7.tar.gz rust-8e7fd551311d424e4e63fa45906a2a928fce96a7.zip | |
Auto merge of #114604 - matthiaskrgr:rollup-o1jltfn, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #114376 (Avoid exporting __rust_alloc_error_handler_should_panic more than once.) - #114413 (Warn when #[macro_export] is applied on decl macros) - #114497 (Revert #98333 "Re-enable atomic loads and stores for all RISC-V targets") - #114500 (Remove arm crypto target feature) - #114566 (Store the laziness of type aliases in their `DefKind`) - #114594 (Structurally normalize weak and inherent in new solver) - #114596 (Rename method in `opt-dist`) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/inline.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/clean/utils.rs | 18 | ||||
| -rw-r--r-- | src/librustdoc/formats/item_type.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/passes/collect_intra_doc_links.rs | 9 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/init_numbered_fields.rs | 2 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_utils/src/lib.rs | 2 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_utils/src/ty/type_certainty/mod.rs | 2 | ||||
| -rw-r--r-- | src/tools/opt-dist/src/environment/linux.rs | 2 | ||||
| -rw-r--r-- | src/tools/opt-dist/src/environment/mod.rs | 4 | ||||
| -rw-r--r-- | src/tools/opt-dist/src/environment/windows.rs | 2 | ||||
| -rw-r--r-- | src/tools/opt-dist/src/training.rs | 2 |
12 files changed, 36 insertions, 17 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index c31d104f8cb..384010034e6 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -79,7 +79,7 @@ pub(crate) fn try_inline( build_impls(cx, did, attrs_without_docs, &mut ret); clean::UnionItem(build_union(cx, did)) } - Res::Def(DefKind::TyAlias, did) => { + Res::Def(DefKind::TyAlias { .. }, did) => { record_extern_fqn(cx, did, ItemType::Typedef); build_impls(cx, did, attrs_without_docs, &mut ret); clean::TypedefItem(build_type_alias(cx, did)) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index a5efcc989f6..b6ba4c853d4 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1706,7 +1706,7 @@ fn maybe_expand_private_type_alias<'tcx>( cx: &mut DocContext<'tcx>, path: &hir::Path<'tcx>, ) -> Option<Type> { - let Res::Def(DefKind::TyAlias, def_id) = path.res else { return None }; + let Res::Def(DefKind::TyAlias { .. }, def_id) = path.res else { return None }; // Substitute private type aliases let def_id = def_id.as_local()?; let alias = if !cx.cache.effective_visibilities.is_exported(cx.tcx, def_id.to_def_id()) @@ -1970,7 +1970,7 @@ impl<'tcx> ContainerTy<'tcx> { let (DefKind::Struct | DefKind::Union | DefKind::Enum - | DefKind::TyAlias + | DefKind::TyAlias { .. } | DefKind::Trait | DefKind::AssocTy | DefKind::Variant) = tcx.def_kind(container) @@ -2709,7 +2709,7 @@ fn clean_impl<'tcx>( let for_ = clean_ty(impl_.self_ty, cx); let type_alias = for_.def_id(&cx.cache).and_then(|alias_def_id: DefId| match tcx.def_kind(alias_def_id) { - DefKind::TyAlias => Some(clean_middle_ty( + DefKind::TyAlias { .. } => Some(clean_middle_ty( ty::Binder::dummy(tcx.type_of(def_id).instantiate_identity()), cx, Some(def_id.to_def_id()), diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 944d0145de2..3c79ce57782 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -504,8 +504,22 @@ pub(crate) fn register_res(cx: &mut DocContext<'_>, res: Res) -> DefId { let (kind, did) = match res { Res::Def( - kind @ (AssocTy | AssocFn | AssocConst | Variant | Fn | TyAlias | Enum | Trait | Struct - | Union | Mod | ForeignTy | Const | Static(_) | Macro(..) | TraitAlias), + kind @ (AssocTy + | AssocFn + | AssocConst + | Variant + | Fn + | TyAlias { .. } + | Enum + | Trait + | Struct + | Union + | Mod + | ForeignTy + | Const + | Static(_) + | Macro(..) + | TraitAlias), did, ) => (kind.into(), did), diff --git a/src/librustdoc/formats/item_type.rs b/src/librustdoc/formats/item_type.rs index a3017201cb1..a788935581f 100644 --- a/src/librustdoc/formats/item_type.rs +++ b/src/librustdoc/formats/item_type.rs @@ -115,7 +115,7 @@ impl From<DefKind> for ItemType { DefKind::Struct => Self::Struct, DefKind::Union => Self::Union, DefKind::Trait => Self::Trait, - DefKind::TyAlias => Self::Typedef, + DefKind::TyAlias { .. } => Self::Typedef, DefKind::TraitAlias => Self::TraitAlias, DefKind::Macro(kind) => match kind { MacroKind::Bang => ItemType::Macro, diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 4de30e4ed9d..1b8d999024c 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -592,7 +592,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { .unwrap_or(Vec::new()) } } - Res::Def(DefKind::TyAlias, did) => { + Res::Def(DefKind::TyAlias { .. }, did) => { // Resolve the link on the type the alias points to. // FIXME: if the associated item is defined directly on the type alias, // it will show up on its documentation page, we should link there instead. @@ -1865,7 +1865,12 @@ fn resolution_failure( } return; } - Trait | TyAlias | ForeignTy | OpaqueTy | TraitAlias | TyParam + Trait + | TyAlias { .. } + | ForeignTy + | OpaqueTy + | TraitAlias + | TyParam | Static(_) => "associated item", Impl { .. } | GlobalAsm => unreachable!("not a path"), } diff --git a/src/tools/clippy/clippy_lints/src/init_numbered_fields.rs b/src/tools/clippy/clippy_lints/src/init_numbered_fields.rs index f95d2c2edb1..b00fa104f98 100644 --- a/src/tools/clippy/clippy_lints/src/init_numbered_fields.rs +++ b/src/tools/clippy/clippy_lints/src/init_numbered_fields.rs @@ -50,7 +50,7 @@ impl<'tcx> LateLintPass<'tcx> for NumberedFields { && fields .iter() .all(|f| f.ident.as_str().as_bytes().iter().all(u8::is_ascii_digit)) - && !matches!(cx.qpath_res(path, e.hir_id), Res::Def(DefKind::TyAlias, ..)) + && !matches!(cx.qpath_res(path, e.hir_id), Res::Def(DefKind::TyAlias { .. }, ..)) { let expr_spans = fields .iter() diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 4cd8a8c3325..171b7faf219 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -286,7 +286,7 @@ pub fn is_wild(pat: &Pat<'_>) -> bool { /// Checks if the given `QPath` belongs to a type alias. pub fn is_ty_alias(qpath: &QPath<'_>) -> bool { match *qpath { - QPath::Resolved(_, path) => matches!(path.res, Res::Def(DefKind::TyAlias | DefKind::AssocTy, ..)), + QPath::Resolved(_, path) => matches!(path.res, Res::Def(DefKind::TyAlias { .. } | DefKind::AssocTy, ..)), QPath::TypeRelative(ty, _) if let TyKind::Path(qpath) = ty.kind => { is_ty_alias(&qpath) }, _ => false, } diff --git a/src/tools/clippy/clippy_utils/src/ty/type_certainty/mod.rs b/src/tools/clippy/clippy_utils/src/ty/type_certainty/mod.rs index 0669ea72eb3..06fd9529044 100644 --- a/src/tools/clippy/clippy_utils/src/ty/type_certainty/mod.rs +++ b/src/tools/clippy/clippy_utils/src/ty/type_certainty/mod.rs @@ -219,7 +219,7 @@ fn path_segment_certainty( // See the comment preceding `qpath_certainty`. `def_id` could refer to a type or a value. let certainty = lhs.join_clearing_def_ids(rhs); if resolves_to_type { - if cx.tcx.def_kind(def_id) == DefKind::TyAlias { + if let DefKind::TyAlias { .. } = cx.tcx.def_kind(def_id) { adt_def_id(cx.tcx.type_of(def_id).instantiate_identity()) .map_or(certainty, |def_id| certainty.with_def_id(def_id)) } else { diff --git a/src/tools/opt-dist/src/environment/linux.rs b/src/tools/opt-dist/src/environment/linux.rs index c2a328b1dbc..58b7e6d2306 100644 --- a/src/tools/opt-dist/src/environment/linux.rs +++ b/src/tools/opt-dist/src/environment/linux.rs @@ -14,7 +14,7 @@ impl Environment for LinuxEnvironment { Utf8PathBuf::from("/checkout") } - fn downloaded_llvm_dir(&self) -> Utf8PathBuf { + fn host_llvm_dir(&self) -> Utf8PathBuf { Utf8PathBuf::from("/rustroot") } diff --git a/src/tools/opt-dist/src/environment/mod.rs b/src/tools/opt-dist/src/environment/mod.rs index d28983d289c..a8650fad011 100644 --- a/src/tools/opt-dist/src/environment/mod.rs +++ b/src/tools/opt-dist/src/environment/mod.rs @@ -15,8 +15,8 @@ pub trait Environment { /// The rustc checkout, where the compiler source is located. fn checkout_path(&self) -> Utf8PathBuf; - /// Path to the downloaded host LLVM. - fn downloaded_llvm_dir(&self) -> Utf8PathBuf; + /// Path to the host LLVM used to compile LLVM in `src/llvm-project`. + fn host_llvm_dir(&self) -> Utf8PathBuf; /// Directory where the optimization artifacts (PGO/BOLT profiles, etc.) /// will be stored. diff --git a/src/tools/opt-dist/src/environment/windows.rs b/src/tools/opt-dist/src/environment/windows.rs index 12a63cbb03c..8a9733d6496 100644 --- a/src/tools/opt-dist/src/environment/windows.rs +++ b/src/tools/opt-dist/src/environment/windows.rs @@ -24,7 +24,7 @@ impl Environment for WindowsEnvironment { self.checkout_dir.clone() } - fn downloaded_llvm_dir(&self) -> Utf8PathBuf { + fn host_llvm_dir(&self) -> Utf8PathBuf { self.checkout_path().join("citools").join("clang-rust") } diff --git a/src/tools/opt-dist/src/training.rs b/src/tools/opt-dist/src/training.rs index e374af68a7f..59c73fbd695 100644 --- a/src/tools/opt-dist/src/training.rs +++ b/src/tools/opt-dist/src/training.rs @@ -81,7 +81,7 @@ fn merge_llvm_profiles( profdata: LlvmProfdata, ) -> anyhow::Result<()> { let llvm_profdata = match profdata { - LlvmProfdata::Host => env.downloaded_llvm_dir().join("bin/llvm-profdata"), + LlvmProfdata::Host => env.host_llvm_dir().join("bin/llvm-profdata"), LlvmProfdata::Target => env .build_artifacts() .join("llvm") |
