Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #129900

Closed
wants to merge 32 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
102997a
Update Tests
veera-sivarajan Jul 13, 2024
764675e
Add Tests
veera-sivarajan Aug 6, 2024
f003e92
Don't Suggest Labeling `const` and `unsafe` Blocks
veera-sivarajan Aug 6, 2024
9a29081
call `Cargo::configure_linker` only for specific commands
onur-ozkan Aug 9, 2024
94fbe14
don't try to find target tools on certain commands
onur-ozkan Aug 9, 2024
12de141
Suggest `impl Trait` for References to Bare Trait in Function Header
veera-sivarajan Jul 13, 2024
28dc116
Don't ICE when dumping MIR of a synthetic coroutine body
compiler-errors Aug 28, 2024
8d3945d
Rename dump of coroutine by-move-body to be more consistent, adjust test
compiler-errors Aug 28, 2024
98106cf
Re-parent the by-move body
compiler-errors Aug 28, 2024
9ad8e26
rustdoc: use `LocalDefId` for inline stmt
notriddle Aug 30, 2024
a3127ca
rustdoc: use a single box to store Attributes and ItemKind
notriddle Aug 30, 2024
121e9f4
Add rust.randomize-layout config to build artifacts with -Zrandomize-…
the8472 Sep 2, 2022
f3bc08a
ignore/fix layout-sensitive tests
the8472 Sep 2, 2022
5bf8eeb
disable size asserts in the compiler when randomizing layouts
the8472 Sep 2, 2022
e3169f7
when -Zrandomize-layout is enabled disable alloc test testing interna…
the8472 Sep 2, 2022
1e377c5
enable layout randomization in x86_64-gnu-llvm-17 CI job
the8472 Sep 2, 2022
df20808
inhibit layout randomization for Box
the8472 Aug 31, 2024
c218c75
exclude tools with deps that have size asserts
the8472 Aug 31, 2024
a763f96
Pin memchr to 2.5.0 in the library rather than rustc_ast
tgross35 Aug 26, 2024
dcbe15c
Run `cargo update` in the root, library, and rustbook
tgross35 Aug 26, 2024
a57c399
Adjust allowed dependencies from the latest `cargo update`
tgross35 Aug 26, 2024
f8739f0
Port std library to RTEMS
thesummer Aug 21, 2023
55f3b01
rtems: Add spec file for arm_rtems6_eabihf
thesummer Jan 23, 2024
01b57cb
Add documentation for target armv7-rtems-eabihf
thesummer Jun 26, 2024
17f5098
Rollup merge of #101339 - the8472:ci-randomize-debug, r=Mark-Simulacrum
matthiaskrgr Sep 2, 2024
44a2b5e
Rollup merge of #127021 - thesummer:1-add-target-support-for-rtems-ar…
matthiaskrgr Sep 2, 2024
b409db4
Rollup merge of #127692 - veera-sivarajan:bugfix-125139, r=estebank
matthiaskrgr Sep 2, 2024
31e63ea
Rollup merge of #128701 - veera-sivarajan:fix-128604, r=estebank
matthiaskrgr Sep 2, 2024
5416804
Rollup merge of #128871 - onur-ozkan:128180, r=Kobzol
matthiaskrgr Sep 2, 2024
4841c83
Rollup merge of #129624 - tgross35:cargo-update, r=Mark-Simulacrum
matthiaskrgr Sep 2, 2024
9cf4d3c
Rollup merge of #129706 - compiler-errors:scratch, r=estebank
matthiaskrgr Sep 2, 2024
9b2775a
Rollup merge of #129789 - notriddle:notriddle/inline-stmt-local, r=Gu…
matthiaskrgr Sep 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rustdoc: use LocalDefId for inline stmt
It's never a cross-crate DefId, so save space by not storing it.
  • Loading branch information
notriddle committed Aug 30, 2024
commit 9ad8e263fa5d784a7e71330cae25573ea300da6f
22 changes: 11 additions & 11 deletions src/librustdoc/clean/inline.rs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ use std::sync::Arc;

use rustc_data_structures::fx::FxHashSet;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{DefId, DefIdSet, LocalModDefId};
use rustc_hir::def_id::{DefId, DefIdSet, LocalDefId, LocalModDefId};
use rustc_hir::Mutability;
use rustc_metadata::creader::{CStore, LoadedMacro};
use rustc_middle::ty::fast_reject::SimplifiedType;
@@ -42,7 +42,7 @@ pub(crate) fn try_inline(
cx: &mut DocContext<'_>,
res: Res,
name: Symbol,
attrs: Option<(&[ast::Attribute], Option<DefId>)>,
attrs: Option<(&[ast::Attribute], Option<LocalDefId>)>,
visited: &mut DefIdSet,
) -> Option<Vec<clean::Item>> {
let did = res.opt_def_id()?;
@@ -156,7 +156,7 @@ pub(crate) fn try_inline(
kind,
did,
name,
import_def_id.and_then(|def_id| def_id.as_local()),
import_def_id,
None,
);
// The visibility needs to reflect the one from the reexport and not from the "source" DefId.
@@ -197,7 +197,7 @@ pub(crate) fn try_inline_glob(
visited,
inlined_names,
Some(&reexports),
Some((attrs, Some(import.owner_id.def_id.to_def_id()))),
Some((attrs, Some(import.owner_id.def_id))),
);
items.retain(|item| {
if let Some(name) = item.name {
@@ -371,7 +371,7 @@ fn build_type_alias(
pub(crate) fn build_impls(
cx: &mut DocContext<'_>,
did: DefId,
attrs: Option<(&[ast::Attribute], Option<DefId>)>,
attrs: Option<(&[ast::Attribute], Option<LocalDefId>)>,
ret: &mut Vec<clean::Item>,
) {
let _prof_timer = cx.tcx.sess.prof.generic_activity("build_inherent_impls");
@@ -404,7 +404,7 @@ pub(crate) fn build_impls(
pub(crate) fn merge_attrs(
cx: &mut DocContext<'_>,
old_attrs: &[ast::Attribute],
new_attrs: Option<(&[ast::Attribute], Option<DefId>)>,
new_attrs: Option<(&[ast::Attribute], Option<LocalDefId>)>,
) -> (clean::Attributes, Option<Arc<clean::cfg::Cfg>>) {
// NOTE: If we have additional attributes (from a re-export),
// always insert them first. This ensure that re-export
@@ -415,7 +415,7 @@ pub(crate) fn merge_attrs(
both.extend_from_slice(old_attrs);
(
if let Some(item_id) = item_id {
Attributes::from_ast_with_additional(old_attrs, (inner, item_id))
Attributes::from_ast_with_additional(old_attrs, (inner, item_id.to_def_id()))
} else {
Attributes::from_ast(&both)
},
@@ -430,7 +430,7 @@ pub(crate) fn merge_attrs(
pub(crate) fn build_impl(
cx: &mut DocContext<'_>,
did: DefId,
attrs: Option<(&[ast::Attribute], Option<DefId>)>,
attrs: Option<(&[ast::Attribute], Option<LocalDefId>)>,
ret: &mut Vec<clean::Item>,
) {
if !cx.inlined.insert(did.into()) {
@@ -640,7 +640,7 @@ fn build_module_items(
visited: &mut DefIdSet,
inlined_names: &mut FxHashSet<(ItemType, Symbol)>,
allowed_def_ids: Option<&DefIdSet>,
attrs: Option<(&[ast::Attribute], Option<DefId>)>,
attrs: Option<(&[ast::Attribute], Option<LocalDefId>)>,
) -> Vec<clean::Item> {
let mut items = Vec::new();

@@ -744,15 +744,15 @@ fn build_macro(
cx: &mut DocContext<'_>,
def_id: DefId,
name: Symbol,
import_def_id: Option<DefId>,
import_def_id: Option<LocalDefId>,
macro_kind: MacroKind,
is_doc_hidden: bool,
) -> clean::ItemKind {
match CStore::from_tcx(cx.tcx).load_macro_untracked(def_id, cx.tcx) {
LoadedMacro::MacroDef(item_def, _) => match macro_kind {
MacroKind::Bang => {
if let ast::ItemKind::MacroDef(ref def) = item_def.kind {
let vis = cx.tcx.visibility(import_def_id.unwrap_or(def_id));
let vis = cx.tcx.visibility(import_def_id.map(|d| d.to_def_id()).unwrap_or(def_id));
clean::MacroItem(clean::Macro {
source: utils::display_macro_source(
cx,
12 changes: 6 additions & 6 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
@@ -203,7 +203,7 @@ fn generate_item_with_correct_attrs(

let name = renamed.or(Some(name));
let mut item = Item::from_def_id_and_attrs_and_parts(def_id, name, kind, Box::new(attrs), cfg);
item.inline_stmt_id = import_id.map(|local| local.to_def_id());
item.inline_stmt_id = import_id;
item
}

@@ -2926,7 +2926,7 @@ fn clean_extern_crate<'tcx>(
})
&& !cx.output_format.is_json();

let krate_owner_def_id = krate.owner_id.to_def_id();
let krate_owner_def_id = krate.owner_id.def_id;
if please_inline {
if let Some(items) = inline::try_inline(
cx,
@@ -2940,7 +2940,7 @@ fn clean_extern_crate<'tcx>(
}

vec![Item::from_def_id_and_parts(
krate_owner_def_id,
krate_owner_def_id.to_def_id(),
Some(name),
ExternCrateItem { src: orig_name },
cx,
@@ -2987,7 +2987,7 @@ fn clean_use_statement_inner<'tcx>(
let inline_attr = attrs.lists(sym::doc).get_word_attr(sym::inline);
let pub_underscore = visibility.is_public() && name == kw::Underscore;
let current_mod = cx.tcx.parent_module_from_def_id(import.owner_id.def_id);
let import_def_id = import.owner_id.def_id.to_def_id();
let import_def_id = import.owner_id.def_id;

// The parent of the module in which this import resides. This
// is the same as `current_mod` if that's already the top
@@ -3070,7 +3070,7 @@ fn clean_use_statement_inner<'tcx>(
)
{
items.push(Item::from_def_id_and_parts(
import_def_id,
import_def_id.to_def_id(),
None,
ImportItem(Import::new_simple(name, resolve_use_source(cx, path), false)),
cx,
@@ -3080,7 +3080,7 @@ fn clean_use_statement_inner<'tcx>(
Import::new_simple(name, resolve_use_source(cx, path), true)
};

vec![Item::from_def_id_and_parts(import_def_id, None, ImportItem(inner), cx)]
vec![Item::from_def_id_and_parts(import_def_id.to_def_id(), None, ImportItem(inner), cx)]
}

fn clean_maybe_renamed_foreign_item<'tcx>(
8 changes: 5 additions & 3 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
@@ -324,8 +324,10 @@ pub(crate) struct Item {
/// E.g., struct vs enum vs function.
pub(crate) kind: Box<ItemKind>,
pub(crate) item_id: ItemId,
/// This is the `DefId` of the `use` statement if the item was inlined.
pub(crate) inline_stmt_id: Option<DefId>,
/// This is the `LocalDefId` of the `use` statement if the item was inlined.
/// The crate metadata doesn't hold this information, so the `use` statement
/// always belongs to the current crate.
pub(crate) inline_stmt_id: Option<LocalDefId>,
pub(crate) cfg: Option<Arc<Cfg>>,
}

@@ -707,7 +709,7 @@ impl Item {
_ => {}
}
let def_id = match self.inline_stmt_id {
Some(inlined) => inlined,
Some(inlined) => inlined.to_def_id(),
None => def_id,
};
Some(tcx.visibility(def_id))