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 7 pull requests #123010

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 36 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,12 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"

[[package]]
name = "glob-match"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9985c9503b412198aa4197559e9a318524ebc4519c229bfa05a535828c950b9d"

[[package]]
name = "globset"
version = "0.4.13"
Expand Down Expand Up @@ -5057,6 +5063,19 @@ dependencies = [
"serde",
]

[[package]]
name = "serde_yaml"
version = "0.9.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adf8a49373e98a4c5f0ceb5d05aa7c648d75f63774981ed95b7c7443bbd50c6e"
dependencies = [
"indexmap",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
]

[[package]]
name = "sha1"
version = "0.10.6"
Expand Down Expand Up @@ -5419,6 +5438,17 @@ dependencies = [
"xattr",
]

[[package]]
name = "target-docs"
version = "0.1.0"
dependencies = [
"eyre",
"glob-match",
"serde",
"serde_json",
"serde_yaml",
]

[[package]]
name = "tempfile"
version = "3.10.1"
Expand Down Expand Up @@ -6065,6 +6095,12 @@ dependencies = [
"diff",
]

[[package]]
name = "unsafe-libyaml"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b"

[[package]]
name = "unstable-book-gen"
version = "0.1.0"
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ members = [
"src/tools/rustdoc-gui-test",
"src/tools/opt-dist",
"src/tools/coverage-dump",
"src/tools/target-docs",
]

exclude = [
Expand Down
11 changes: 5 additions & 6 deletions compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::constraints::ConstraintSccIndex;
use crate::RegionInferenceContext;
use itertools::Itertools;
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
use rustc_data_structures::graph::vec_graph::VecGraph;
use rustc_data_structures::graph::WithSuccessors;
Expand Down Expand Up @@ -48,16 +47,16 @@ impl RegionInferenceContext<'_> {
.universal_regions
.universal_regions()
.map(|region| (self.constraint_sccs.scc(region), region))
.collect_vec();
.collect::<Vec<_>>();
paired_scc_regions.sort();
let universal_regions = paired_scc_regions.iter().map(|&(_, region)| region).collect();

let mut scc_regions = FxIndexMap::default();
let mut start = 0;
for (scc, group) in &paired_scc_regions.into_iter().group_by(|(scc, _)| *scc) {
let group_size = group.count();
scc_regions.insert(scc, start..start + group_size);
start += group_size;
for chunk in paired_scc_regions.chunk_by(|&(scc1, _), &(scc2, _)| scc1 == scc2) {
let (scc, _) = chunk[0];
scc_regions.insert(scc, start..start + chunk.len());
start += chunk.len();
}

self.rev_scc_graph = Some(ReverseSccGraph { graph, scc_regions, universal_regions });
Expand Down
18 changes: 13 additions & 5 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
}
ty::Str => p!("str"),
ty::Coroutine(did, args) => {
p!(write("{{"));
p!("{{");
let coroutine_kind = self.tcx().coroutine_kind(did).unwrap();
let should_print_movability = self.should_print_verbose()
|| matches!(coroutine_kind, hir::CoroutineKind::Coroutine(_));
Expand All @@ -818,17 +818,25 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {

if !self.should_print_verbose() {
p!(write("{}", coroutine_kind));
// FIXME(eddyb) should use `def_span`.
if let Some(did) = did.as_local() {
let span = self.tcx().def_span(did);
if coroutine_kind.is_fn_like() {
// If we are printing an `async fn` coroutine type, then give the path
// of the fn, instead of its span, because that will in most cases be
// more helpful for the reader than just a source location.
//
// This will look like:
// {async fn body of some_fn()}
let did_of_the_fn_item = self.tcx().parent(did);
p!(" of ", print_def_path(did_of_the_fn_item, args), "()");
} else if let Some(local_did) = did.as_local() {
let span = self.tcx().def_span(local_did);
p!(write(
"@{}",
// This may end up in stderr diagnostics but it may also be emitted
// into MIR. Hence we use the remapped path if available
self.tcx().sess.source_map().span_to_embeddable_string(span)
));
} else {
p!(write("@"), print_def_path(did, args));
p!("@", print_def_path(did, args));
}
} else {
p!(print_def_path(did, args));
Expand Down
27 changes: 14 additions & 13 deletions compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,8 @@ fn transform_predicates<'tcx>(
tcx: TyCtxt<'tcx>,
predicates: &List<ty::PolyExistentialPredicate<'tcx>>,
) -> &'tcx List<ty::PolyExistentialPredicate<'tcx>> {
let predicates: Vec<ty::PolyExistentialPredicate<'tcx>> = predicates
.iter()
.filter_map(|predicate| match predicate.skip_binder() {
tcx.mk_poly_existential_predicates_from_iter(predicates.iter().filter_map(|predicate| {
match predicate.skip_binder() {
ty::ExistentialPredicate::Trait(trait_ref) => {
let trait_ref = ty::TraitRef::identity(tcx, trait_ref.def_id);
Some(ty::Binder::dummy(ty::ExistentialPredicate::Trait(
Expand All @@ -758,9 +757,8 @@ fn transform_predicates<'tcx>(
}
ty::ExistentialPredicate::Projection(..) => None,
ty::ExistentialPredicate::AutoTrait(..) => Some(predicate),
})
.collect();
tcx.mk_poly_existential_predicates(&predicates)
}
}))
}

/// Transforms args for being encoded and used in the substitution dictionary.
Expand Down Expand Up @@ -1171,14 +1169,17 @@ fn strip_receiver_auto<'tcx>(
let ty::Dynamic(preds, lifetime, kind) = ty.kind() else {
bug!("Tried to strip auto traits from non-dynamic type {ty}");
};
let filtered_preds =
if preds.principal().is_some() {
let new_rcvr = if preds.principal().is_some() {
let filtered_preds =
tcx.mk_poly_existential_predicates_from_iter(preds.into_iter().filter(|pred| {
!matches!(pred.skip_binder(), ty::ExistentialPredicate::AutoTrait(..))
}))
} else {
ty::List::empty()
};
let new_rcvr = Ty::new_dynamic(tcx, filtered_preds, *lifetime, *kind);
}));
Ty::new_dynamic(tcx, filtered_preds, *lifetime, *kind)
} else {
// If there's no principal type, re-encode it as a unit, since we don't know anything
// about it. This technically discards the knowledge that it was a type that was made
// into a trait object at some point, but that's not a lot.
tcx.types.unit
};
tcx.mk_args_trait(new_rcvr, args.into_iter().skip(1))
}
6 changes: 3 additions & 3 deletions compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ pub fn target() -> Target {
Target {
llvm_target: tvos_llvm_target(arch).into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
host_tools: None,
description: Some("ARM64 tvOS".into()),
tier: Some(2),
host_tools: Some(false),
std: None,
},
pointer_width: 64,
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ pub fn target() -> Target {
Target {
llvm_target: "i686-pc-windows-gnu".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
host_tools: None,
std: None,
description: Some("32-bit MinGW (Windows 7+)".into()),
tier: Some(1),
host_tools: Some(true),
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ pub fn target() -> Target {
Target {
llvm_target: "loongarch64-unknown-linux-gnu".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
host_tools: None,
std: None,
description: Some("LoongArch64 Linux, LP64D ABI (kernel 5.19, glibc 2.36)".into()),
tier: Some(2),
host_tools: Some(true),
std: Some(true),
},
pointer_width: 64,
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ pub fn target() -> Target {
Target {
llvm_target: "powerpc64-ibm-aix".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
host_tools: None,
std: None,
description: Some("64-bit AIX (7.2 and newer)".into()),
tier: Some(3),
host_tools: Some(true),
std: Some(true),
},
pointer_width: 64,
data_layout: "E-m:a-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
Expand Down
1 change: 1 addition & 0 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
#![feature(arm_target_feature)]
#![feature(avx512_target_feature)]
#![feature(hexagon_target_feature)]
#![feature(loongarch_target_feature)]
#![feature(mips_target_feature)]
#![feature(powerpc_target_feature)]
#![feature(riscv_target_feature)]
Expand Down
2 changes: 1 addition & 1 deletion library/stdarch
Submodule stdarch updated 68 files
+1 −1 .cirrus.yml
+2 −2 .github/workflows/main.yml
+5 −3 .gitignore
+2 −1 Cargo.toml
+0 −16 ci/docker/wasm32-wasi/Dockerfile
+13 −0 ci/docker/wasm32-wasip1/Dockerfile
+350 −350 crates/core_arch/src/aarch64/neon/generated.rs
+28 −7 crates/core_arch/src/aarch64/neon/mod.rs
+29 −7 crates/core_arch/src/arm_shared/barrier/mod.rs
+34 −10 crates/core_arch/src/arm_shared/crc.rs
+56 −14 crates/core_arch/src/arm_shared/crypto.rs
+31 −5 crates/core_arch/src/arm_shared/hints.rs
+30 −5 crates/core_arch/src/arm_shared/mod.rs
+2,053 −2,039 crates/core_arch/src/arm_shared/neon/generated.rs
+1 −1 crates/core_arch/src/arm_shared/neon/load_tests.rs
+1,612 −427 crates/core_arch/src/arm_shared/neon/mod.rs
+1 −1 crates/core_arch/src/arm_shared/neon/shift_and_insert_tests.rs
+1 −1 crates/core_arch/src/arm_shared/neon/store_tests.rs
+49 −49 crates/core_arch/src/arm_shared/neon/table_lookup_tests.rs
+1 −1 crates/core_arch/src/arm_shared/test_support.rs
+1 −0 crates/core_arch/src/lib.rs
+7,027 −0 crates/core_arch/src/loongarch64/lasx/generated.rs
+21 −0 crates/core_arch/src/loongarch64/lasx/mod.rs
+14,690 −0 crates/core_arch/src/loongarch64/lasx/tests.rs
+57 −0 crates/core_arch/src/loongarch64/lasx/types.rs
+6,843 −0 crates/core_arch/src/loongarch64/lsx/generated.rs
+21 −0 crates/core_arch/src/loongarch64/lsx/mod.rs
+7,132 −0 crates/core_arch/src/loongarch64/lsx/tests.rs
+41 −0 crates/core_arch/src/loongarch64/lsx/types.rs
+9 −0 crates/core_arch/src/loongarch64/mod.rs
+24 −5 crates/core_arch/src/mod.rs
+3 −180 crates/core_arch/src/powerpc/altivec.rs
+185 −0 crates/core_arch/src/powerpc/macros.rs
+1 −2 crates/core_arch/src/powerpc/mod.rs
+5 −0 crates/core_arch/src/powerpc64/mod.rs
+156 −0 crates/core_arch/src/powerpc64/vsx.rs
+22 −0 crates/core_arch/src/wasm32/mod.rs
+28 −27 crates/core_arch/src/x86/avx.rs
+3 −3 crates/core_arch/src/x86/avx512f.rs
+9 −9 crates/core_arch/src/x86/sse.rs
+12 −11 crates/core_arch/src/x86/sse2.rs
+12 −12 crates/core_arch/src/x86/sse41.rs
+2 −1 crates/core_arch/src/x86_64/sse2.rs
+6 −6 crates/intrinsic-test/src/main.rs
+2 −1 crates/simd-test-macro/src/lib.rs
+1 −1 crates/std_detect/src/detect/arch/aarch64.rs
+15 −27 crates/std_detect/src/detect/arch/loongarch.rs
+1 −1 crates/std_detect/src/detect/arch/mod.rs
+3 −0 crates/std_detect/src/detect/arch/x86.rs
+2 −1 crates/std_detect/src/detect/mod.rs
+30 −9 crates/std_detect/src/detect/os/linux/loongarch.rs
+15 −7 crates/std_detect/src/detect/os/x86.rs
+6 −1 crates/std_detect/tests/cpu-detection.rs
+2 −0 crates/std_detect/tests/macro_trailing_commas.rs
+1 −0 crates/std_detect/tests/x86-specific.rs
+1 −1 crates/stdarch-gen-arm/Cargo.toml
+1 −1 crates/stdarch-gen-arm/README.md
+0 −0 crates/stdarch-gen-arm/neon.spec
+18 −12 crates/stdarch-gen-arm/src/main.rs
+10 −0 crates/stdarch-gen-loongarch/Cargo.toml
+33 −0 crates/stdarch-gen-loongarch/README.md
+3,685 −0 crates/stdarch-gen-loongarch/lasx.spec
+5,342 −0 crates/stdarch-gen-loongarch/lasxintrin.h
+3,585 −0 crates/stdarch-gen-loongarch/lsx.spec
+5,185 −0 crates/stdarch-gen-loongarch/lsxintrin.h
+1,525 −0 crates/stdarch-gen-loongarch/src/main.rs
+1 −1 crates/stdarch-test/src/disassembly.rs
+1 −1 crates/stdarch-test/src/lib.rs
1 change: 1 addition & 0 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@ impl Step for PlainSourceTarball {
// Vendor all Cargo dependencies
let mut cmd = Command::new(&builder.initial_cargo);
cmd.arg("vendor")
.arg("--versioned-dirs")
.arg("--sync")
.arg(builder.src.join("./src/tools/cargo/Cargo.toml"))
.arg("--sync")
Expand Down
31 changes: 27 additions & 4 deletions src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1147,14 +1147,17 @@ impl Step for RustcBook {

/// Builds the rustc book.
///
/// The lints are auto-generated by a tool, and then merged into the book
/// The lints and target docs are auto-generated by a tool, and then merged into the book
/// in the "md-doc" directory in the build output directory. Then
/// "rustbook" is used to convert it to HTML.
fn run(self, builder: &Builder<'_>) {
let out_base = builder.md_doc_out(self.target).join("rustc");
t!(fs::create_dir_all(&out_base));
let out_listing = out_base.join("src/lints");
builder.cp_link_r(&builder.src.join("src/doc/rustc"), &out_base);
let out_lints_listing = out_base.join("src/lints");
let out_src_listing = out_base.join("src");

// target-docs will be modifying the files in-place, so we need an actual copy.
builder.cp_r(&builder.src.join("src/doc/rustc"), &out_base);
builder.info(&format!("Generating lint docs ({})", self.target));

let rustc = builder.rustc(self.compiler);
Expand All @@ -1165,7 +1168,7 @@ impl Step for RustcBook {
cmd.arg("--src");
cmd.arg(builder.src.join("compiler"));
cmd.arg("--out");
cmd.arg(&out_listing);
cmd.arg(&out_lints_listing);
cmd.arg("--rustc");
cmd.arg(&rustc);
cmd.arg("--rustc-target").arg(self.target.rustc_target_arg());
Expand Down Expand Up @@ -1194,6 +1197,26 @@ impl Step for RustcBook {
builder.run(&mut cmd);
drop(doc_generator_guard);

// Run target-docs generator
let mut cmd = builder.tool_cmd(Tool::TargetDocs);
cmd.arg(builder.src.join("src/doc/rustc/target_infos"));
cmd.arg(&out_src_listing);
cmd.env("RUSTC", &rustc);
// For now, we just check that the files are correct but do not generate output.
// Let the user override it to TARGET_CHECK_ONLY=0 for testing, but use 1 by default.
// See https://github.com/rust-lang/rust/issues/120745 for more info.
cmd.env("TARGET_CHECK_ONLY", std::env::var("TARGET_CHECK_ONLY").unwrap_or("1".to_owned()));

let doc_generator_guard = builder.msg(
Kind::Run,
self.compiler.stage,
"target-docs",
self.compiler.host,
self.target,
);
builder.run(&mut cmd);
drop(doc_generator_guard);

// Run rustbook/mdbook to generate the HTML pages.
builder.ensure(RustbookSrc {
target: self.target,
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ bootstrap_tool!(
RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes";
ExpandYamlAnchors, "src/tools/expand-yaml-anchors", "expand-yaml-anchors";
LintDocs, "src/tools/lint-docs", "lint-docs";
TargetDocs, "src/tools/target-docs", "target-docs";
JsonDocCk, "src/tools/jsondocck", "jsondocck";
JsonDocLint, "src/tools/jsondoclint", "jsondoclint";
HtmlChecker, "src/tools/html-checker", "html-checker";
Expand Down
Loading
Loading