diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index a193d5db6916a..d6f51d7eee1af 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -1119,22 +1119,25 @@ fn extra_compiler_flags() -> Option<(Vec, bool)> { while let Some(arg) = args.next() { if let Some(a) = ICE_REPORT_COMPILER_FLAGS.iter().find(|a| arg.starts_with(*a)) { let content = if arg.len() == a.len() { + // A space-separated option, like `-C incremental=foo` or `--crate-type rlib` match args.next() { Some(arg) => arg.to_string(), None => continue, } } else if arg.get(a.len()..a.len() + 1) == Some("=") { + // An equals option, like `--crate-type=rlib` arg[a.len() + 1..].to_string() } else { + // A non-space option, like `-Cincremental=foo` arg[a.len()..].to_string() }; - if ICE_REPORT_COMPILER_FLAGS_EXCLUDE.iter().any(|exc| content.starts_with(exc)) { + let option = content.split_once('=').map(|s| s.0).unwrap_or(&content); + if ICE_REPORT_COMPILER_FLAGS_EXCLUDE.iter().any(|exc| option == *exc) { excluded_cargo_defaults = true; } else { result.push(a.to_string()); - match ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE.iter().find(|s| content.starts_with(*s)) - { - Some(s) => result.push(s.to_string()), + match ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE.iter().find(|s| option == **s) { + Some(s) => result.push(format!("{}=[REDACTED]", s)), None => result.push(content), } } diff --git a/compiler/rustc_target/src/spec/tests/tests_impl.rs b/compiler/rustc_target/src/spec/tests/tests_impl.rs index d03f959076de0..0af599916a999 100644 --- a/compiler/rustc_target/src/spec/tests/tests_impl.rs +++ b/compiler/rustc_target/src/spec/tests/tests_impl.rs @@ -146,7 +146,8 @@ impl Target { if self.position_independent_executables && !triple.ends_with("-linuxkernel") { assert_eq!(self.relocation_model, RelocModel::Pic); } - if self.relocation_model == RelocModel::Pic { + // The UEFI targets do not support dynamic linking but still require PIC (#101377). + if self.relocation_model == RelocModel::Pic && self.os != "uefi" { assert!(self.dynamic_linking || self.position_independent_executables); } if self.static_position_independent_executables { diff --git a/compiler/rustc_target/src/spec/uefi_msvc_base.rs b/compiler/rustc_target/src/spec/uefi_msvc_base.rs index 250da03cbd2b6..99af7d85e1d02 100644 --- a/compiler/rustc_target/src/spec/uefi_msvc_base.rs +++ b/compiler/rustc_target/src/spec/uefi_msvc_base.rs @@ -10,7 +10,7 @@ // code runs in the same environment, no process separation is supported. use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy}; -use crate::spec::{RelocModel, StackProbeType, TargetOptions}; +use crate::spec::{StackProbeType, TargetOptions}; pub fn opts() -> TargetOptions { let mut base = super::msvc_base::opts(); @@ -47,7 +47,6 @@ pub fn opts() -> TargetOptions { stack_probes: StackProbeType::Call, singlethread: true, linker: Some("rust-lld".into()), - relocation_model: RelocModel::Static, ..base } } diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 2077cf71b2ef7..f973fd0889ebc 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -510,7 +510,7 @@ impl Item { .get(&self.item_id) .map_or(&[][..], |v| v.as_slice()) .iter() - .filter_map(|ItemLink { link: s, link_text, did, ref fragment }| { + .filter_map(|ItemLink { link: s, link_text, page_id: did, ref fragment }| { debug!(?did); if let Ok((mut href, ..)) = href(*did, cx) { debug!(?href); @@ -1134,7 +1134,10 @@ pub(crate) struct ItemLink { /// This may not be the same as `link` if there was a disambiguator /// in an intra-doc link (e.g. \[`fn@f`\]) pub(crate) link_text: String, - pub(crate) did: DefId, + /// The `DefId` of the Item whose **HTML Page** contains the item being + /// linked to. This will be different to `item_id` on item's that don't + /// have their own page, such as struct fields and enum variants. + pub(crate) page_id: DefId, /// The url fragment to append to the link pub(crate) fragment: Option, } diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index ec9e3b1ecd17b..dae2ff4e22637 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -592,10 +592,6 @@ h2.location a { margin: 0; } -#search { - position: relative; -} - .search-loading { text-align: center; } @@ -973,7 +969,6 @@ so that we can apply CSS-filters to change the arrow color in themes */ .search-results > a { display: block; - width: 100%; /* A little margin ensures the browser's outlining of focused links has room to display. */ margin-left: 2px; margin-right: 2px; diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 1177d482ac06d..49a31f5f1da1f 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -19,6 +19,7 @@ use crate::clean::utils::print_const_expr; use crate::clean::{self, ItemId}; use crate::formats::item_type::ItemType; use crate::json::JsonRenderer; +use crate::passes::collect_intra_doc_links::UrlFragment; impl JsonRenderer<'_> { pub(super) fn convert_item(&self, item: clean::Item) -> Option { @@ -29,8 +30,14 @@ impl JsonRenderer<'_> { .get(&item.item_id) .into_iter() .flatten() - .map(|clean::ItemLink { link, did, .. }| { - (link.clone(), from_item_id((*did).into(), self.tcx)) + .map(|clean::ItemLink { link, page_id, fragment, .. }| { + let id = match fragment { + Some(UrlFragment::Item(frag_id)) => *frag_id, + // FIXME: Pass the `UserWritten` segment to JSON consumer. + Some(UrlFragment::UserWritten(_)) | None => *page_id, + }; + + (link.clone(), from_item_id(id.into(), self.tcx)) }) .collect(); let docs = item.attrs.collapsed_doc_value(); diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index cfd6ce402c28a..677c980f63cc4 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -223,6 +223,9 @@ enum MalformedGenerics { #[derive(Clone, Debug, Hash, PartialEq, Eq)] pub(crate) enum UrlFragment { Item(DefId), + /// A part of a page that isn't a rust item. + /// + /// Eg: `[Vector Examples](std::vec::Vec#examples)` UserWritten(String), } @@ -1127,7 +1130,7 @@ impl LinkCollector<'_, '_> { Some(ItemLink { link: ori_link.link.clone(), link_text: link_text.clone(), - did: res.def_id(self.cx.tcx), + page_id: res.def_id(self.cx.tcx), fragment, }) } @@ -1146,11 +1149,12 @@ impl LinkCollector<'_, '_> { item, &diag_info, )?; - let id = clean::register_res(self.cx, rustc_hir::def::Res::Def(kind, id)); + + let page_id = clean::register_res(self.cx, rustc_hir::def::Res::Def(kind, id)); Some(ItemLink { link: ori_link.link.clone(), link_text: link_text.clone(), - did: id, + page_id, fragment, }) } diff --git a/src/test/codegen/abi-efiapi.rs b/src/test/codegen/abi-efiapi.rs index 4dc9d183b0b20..b4fda5f8c8428 100644 --- a/src/test/codegen/abi-efiapi.rs +++ b/src/test/codegen/abi-efiapi.rs @@ -24,7 +24,7 @@ trait Freeze { } #[lang="copy"] trait Copy { } -//x86_64: define dso_local win64cc void @has_efiapi +//x86_64: define win64cc void @has_efiapi //i686: define void @has_efiapi //aarch64: define dso_local void @has_efiapi //arm: define dso_local void @has_efiapi diff --git a/src/test/rustdoc-gui/search-result-display.goml b/src/test/rustdoc-gui/search-result-display.goml index db4907924faf3..54482005fa601 100644 --- a/src/test/rustdoc-gui/search-result-display.goml +++ b/src/test/rustdoc-gui/search-result-display.goml @@ -7,11 +7,11 @@ press-key: 'Enter' wait-for: "#crate-search" // The width is returned by "getComputedStyle" which returns the exact number instead of the // CSS rule which is "50%"... -assert-css: (".search-results div.desc", {"width": "295px"}) +assert-css: (".search-results div.desc", {"width": "293px"}) size: (600, 100) // As counter-intuitive as it may seem, in this width, the width is "100%", which is why // when computed it's larger. -assert-css: (".search-results div.desc", {"width": "570px"}) +assert-css: (".search-results div.desc", {"width": "566px"}) // Check that the crate filter `