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
Show file tree
Hide file tree
Changes from 3 commits
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
22 changes: 12 additions & 10 deletions src/librustdoc/clean/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,19 @@ fn synthesize_auto_trait_impl<'tcx>(

Some(clean::Item {
name: None,
attrs: Default::default(),
inner: Box::new(clean::ItemInner {
attrs: Default::default(),
kind: clean::ImplItem(Box::new(clean::Impl {
safety: hir::Safety::Safe,
generics,
trait_: Some(clean_trait_ref_with_constraints(cx, trait_ref, ThinVec::new())),
for_: clean_middle_ty(ty::Binder::dummy(ty), cx, None, None),
items: Vec::new(),
polarity,
kind: clean::ImplKind::Auto,
})),
}),
item_id: clean::ItemId::Auto { trait_: trait_def_id, for_: item_def_id },
kind: Box::new(clean::ImplItem(Box::new(clean::Impl {
safety: hir::Safety::Safe,
generics,
trait_: Some(clean_trait_ref_with_constraints(cx, trait_ref, ThinVec::new())),
for_: clean_middle_ty(ty::Binder::dummy(ty), cx, None, None),
items: Vec::new(),
polarity,
kind: clean::ImplKind::Auto,
}))),
cfg: None,
inline_stmt_id: None,
})
Expand Down
72 changes: 37 additions & 35 deletions src/librustdoc/clean/blanket_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,42 +84,44 @@ pub(crate) fn synthesize_blanket_impls(

blanket_impls.push(clean::Item {
name: None,
attrs: Default::default(),
item_id: clean::ItemId::Blanket { impl_id: impl_def_id, for_: item_def_id },
kind: Box::new(clean::ImplItem(Box::new(clean::Impl {
safety: hir::Safety::Safe,
generics: clean_ty_generics(
cx,
tcx.generics_of(impl_def_id),
tcx.explicit_predicates_of(impl_def_id),
),
// FIXME(eddyb) compute both `trait_` and `for_` from
// the post-inference `trait_ref`, as it's more accurate.
trait_: Some(clean_trait_ref_with_constraints(
cx,
ty::Binder::dummy(trait_ref.instantiate_identity()),
ThinVec::new(),
)),
for_: clean_middle_ty(
ty::Binder::dummy(ty.instantiate_identity()),
cx,
None,
None,
),
items: tcx
.associated_items(impl_def_id)
.in_definition_order()
.filter(|item| !item.is_impl_trait_in_trait())
.map(|item| clean_middle_assoc_item(item, cx))
.collect(),
polarity: ty::ImplPolarity::Positive,
kind: clean::ImplKind::Blanket(Box::new(clean_middle_ty(
ty::Binder::dummy(trait_ref.instantiate_identity().self_ty()),
cx,
None,
None,
))),
}))),
inner: Box::new(clean::ItemInner {
attrs: Default::default(),
kind: clean::ImplItem(Box::new(clean::Impl {
safety: hir::Safety::Safe,
generics: clean_ty_generics(
cx,
tcx.generics_of(impl_def_id),
tcx.explicit_predicates_of(impl_def_id),
),
// FIXME(eddyb) compute both `trait_` and `for_` from
// the post-inference `trait_ref`, as it's more accurate.
trait_: Some(clean_trait_ref_with_constraints(
cx,
ty::Binder::dummy(trait_ref.instantiate_identity()),
ThinVec::new(),
)),
for_: clean_middle_ty(
ty::Binder::dummy(ty.instantiate_identity()),
cx,
None,
None,
),
items: tcx
.associated_items(impl_def_id)
.in_definition_order()
.filter(|item| !item.is_impl_trait_in_trait())
.map(|item| clean_middle_assoc_item(item, cx))
.collect(),
polarity: ty::ImplPolarity::Positive,
kind: clean::ImplKind::Blanket(Box::new(clean_middle_ty(
ty::Binder::dummy(trait_ref.instantiate_identity().self_ty()),
cx,
None,
None,
))),
})),
}),
cfg: None,
inline_stmt_id: None,
});
Expand Down
69 changes: 33 additions & 36 deletions src/librustdoc/clean/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -43,7 +43,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()?;
Expand Down Expand Up @@ -152,14 +152,8 @@ pub(crate) fn try_inline(
};

cx.inlined.insert(did.into());
let mut item = crate::clean::generate_item_with_correct_attrs(
cx,
kind,
did,
name,
import_def_id.and_then(|def_id| def_id.as_local()),
None,
);
let mut item =
crate::clean::generate_item_with_correct_attrs(cx, kind, did, name, import_def_id, None);
// The visibility needs to reflect the one from the reexport and not from the "source" DefId.
item.inline_stmt_id = import_def_id;
ret.push(item);
Expand Down Expand Up @@ -198,7 +192,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 {
Expand Down Expand Up @@ -372,7 +366,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");
Expand Down Expand Up @@ -405,7 +399,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
Expand All @@ -416,7 +410,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)
},
Expand All @@ -431,7 +425,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()) {
Expand Down Expand Up @@ -623,7 +617,7 @@ pub(crate) fn build_impl(
ImplKind::Normal
},
})),
Box::new(merged_attrs),
merged_attrs,
cfg,
));
}
Expand All @@ -641,7 +635,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();

Expand Down Expand Up @@ -673,27 +667,29 @@ fn build_module_items(
let prim_ty = clean::PrimitiveType::from(p);
items.push(clean::Item {
name: None,
attrs: Box::default(),
// We can use the item's `DefId` directly since the only information ever used
// from it is `DefId.krate`.
item_id: ItemId::DefId(did),
kind: Box::new(clean::ImportItem(clean::Import::new_simple(
item.ident.name,
clean::ImportSource {
path: clean::Path {
res,
segments: thin_vec![clean::PathSegment {
name: prim_ty.as_sym(),
args: clean::GenericArgs::AngleBracketed {
args: Default::default(),
constraints: ThinVec::new(),
},
}],
inner: Box::new(clean::ItemInner {
attrs: Default::default(),
kind: clean::ImportItem(clean::Import::new_simple(
item.ident.name,
clean::ImportSource {
path: clean::Path {
res,
segments: thin_vec![clean::PathSegment {
name: prim_ty.as_sym(),
args: clean::GenericArgs::AngleBracketed {
args: Default::default(),
constraints: ThinVec::new(),
},
}],
},
did: None,
},
did: None,
},
true,
))),
true,
)),
}),
cfg: None,
inline_stmt_id: None,
});
Expand Down Expand Up @@ -745,15 +741,16 @@ 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,
Expand Down
14 changes: 7 additions & 7 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ fn generate_item_with_correct_attrs(
let attrs = Attributes::from_ast_iter(attrs.iter().map(|(attr, did)| (&**attr, *did)), false);

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());
let mut item = Item::from_def_id_and_attrs_and_parts(def_id, name, kind, attrs, cfg);
item.inline_stmt_id = import_id;
item
}

Expand Down Expand Up @@ -2927,7 +2927,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,
Expand All @@ -2941,7 +2941,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,
Expand Down Expand Up @@ -2988,7 +2988,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
Expand Down Expand Up @@ -3071,7 +3071,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,
Expand All @@ -3081,7 +3081,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>(
Expand Down
Loading
Loading