Skip to content

Commit

Permalink
Auto merge of #18364 - lnicola:sync-from-rust, r=lnicola
Browse files Browse the repository at this point in the history
minor: sync from downstream
  • Loading branch information
bors committed Oct 22, 2024
2 parents fa815a1 + efc2ba2 commit ca51c1e
Show file tree
Hide file tree
Showing 741 changed files with 11,340 additions and 7,363 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ jobs:
with:
fetch-depth: 2

# Free up disk space on Linux by removing preinstalled components that
# we do not need. We do this to enable some of the less resource
# intensive jobs to run on free runners, which however also have
# less disk space.
- name: free up disk space
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
if: contains(matrix.os, 'ubuntu')
with:
# Removing packages with APT saves ~5 GiB, but takes several
# minutes (and potentially removes important packages).
large-packages: false

# Rust Log Analyzer can't currently detect the PR number of a GitHub
# Actions build on its own, so a hint in the log message is needed to
# point it in the right direction.
Expand Down Expand Up @@ -194,6 +206,11 @@ jobs:
- name: create github artifacts
run: src/ci/scripts/create-doc-artifacts.sh

- name: print disk usage
run: |
echo "disk usage:"
df -h
- name: upload artifacts to github
uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ build/
/src/tools/x/target
# Created by default with `src/ci/docker/run.sh`
/obj/
# Created by nix dev shell / .envrc
src/tools/nix-dev-shell/flake.lock

## ICE reports
rustc-ice-*.txt
Expand Down
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com>
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub.bukaj@yahoo.com>
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub@jakub.cc>
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakubw@jakubw.net>
Jakub Beránek <berykubik@gmail.com> <jakub.beranek@vsb.cz>
James [Undefined] <tpzker@thepuzzlemaker.info>
James Deng <cnjamesdeng@gmail.com> <cnJamesDeng@gmail.com>
James Hinshelwood <jameshinshelwood1@gmail.com> <james.hinshelwood@bigpayme.com>
Expand Down
71 changes: 24 additions & 47 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ dependencies = [
"cargo_metadata",
"directories",
"rustc-build-sysroot",
"rustc_tools_util 0.4.0",
"rustc_tools_util",
"rustc_version",
"serde",
"serde_json",
Expand Down Expand Up @@ -537,7 +537,7 @@ checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"

[[package]]
name = "clippy"
version = "0.1.83"
version = "0.1.84"
dependencies = [
"anstream",
"cargo_metadata",
Expand All @@ -550,9 +550,11 @@ dependencies = [
"if_chain",
"itertools",
"parking_lot",
"pulldown-cmark 0.11.3",
"quote",
"regex",
"rustc_tools_util 0.3.0",
"rinja",
"rustc_tools_util",
"serde",
"serde_json",
"syn 2.0.79",
Expand All @@ -566,7 +568,7 @@ dependencies = [

[[package]]
name = "clippy_config"
version = "0.1.83"
version = "0.1.84"
dependencies = [
"itertools",
"serde",
Expand All @@ -582,20 +584,19 @@ dependencies = [
"clap",
"indoc",
"itertools",
"opener 0.6.1",
"opener",
"shell-escape",
"walkdir",
]

[[package]]
name = "clippy_lints"
version = "0.1.83"
version = "0.1.84"
dependencies = [
"arrayvec",
"cargo_metadata",
"clippy_config",
"clippy_utils",
"declare_clippy_lint",
"itertools",
"quine-mc_cluskey",
"regex",
Expand All @@ -613,7 +614,7 @@ dependencies = [

[[package]]
name = "clippy_utils"
version = "0.1.83"
version = "0.1.84"
dependencies = [
"arrayvec",
"clippy_config",
Expand Down Expand Up @@ -919,15 +920,6 @@ dependencies = [
"winapi",
]

[[package]]
name = "declare_clippy_lint"
version = "0.1.83"
dependencies = [
"itertools",
"quote",
"syn 2.0.79",
]

[[package]]
name = "deranged"
version = "0.3.11"
Expand Down Expand Up @@ -1915,7 +1907,7 @@ dependencies = [
"anyhow",
"clap",
"fs-err",
"rustc-hash 1.1.0",
"rustc-hash 2.0.0",
"rustdoc-json-types",
"serde",
"serde_json",
Expand Down Expand Up @@ -2163,7 +2155,7 @@ dependencies = [
"log",
"memchr",
"once_cell",
"opener 0.7.2",
"opener",
"pulldown-cmark 0.10.3",
"regex",
"serde",
Expand Down Expand Up @@ -2501,17 +2493,6 @@ dependencies = [
"stable_deref_trait",
]

[[package]]
name = "opener"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c62dcb6174f9cb326eac248f07e955d5d559c272730b6c03e396b443b562788"
dependencies = [
"bstr",
"normpath",
"winapi",
]

[[package]]
name = "opener"
version = "0.7.2"
Expand Down Expand Up @@ -2879,6 +2860,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "679341d22c78c6c649893cbd6c3278dcbe9fc4faa62fea3a9296ae2b50c14625"
dependencies = [
"bitflags 2.6.0",
"getopts",
"memchr",
"pulldown-cmark-escape 0.11.0",
"unicase",
Expand Down Expand Up @@ -3532,7 +3514,7 @@ dependencies = [
"memmap2",
"parking_lot",
"portable-atomic",
"rustc-hash 1.1.0",
"rustc-hash 2.0.0",
"rustc-rayon",
"rustc-stable-hash",
"rustc_arena",
Expand Down Expand Up @@ -4229,7 +4211,7 @@ dependencies = [
name = "rustc_pattern_analysis"
version = "0.0.0"
dependencies = [
"rustc-hash 1.1.0",
"rustc-hash 2.0.0",
"rustc_apfloat",
"rustc_arena",
"rustc_data_structures",
Expand Down Expand Up @@ -4460,12 +4442,6 @@ dependencies = [
"tracing",
]

[[package]]
name = "rustc_tools_util"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ba09476327c4b70ccefb6180f046ef588c26a24cf5d269a9feba316eb4f029f"

[[package]]
name = "rustc_tools_util"
version = "0.4.0"
Expand Down Expand Up @@ -4608,6 +4584,7 @@ dependencies = [
"rustdoc-json-types",
"serde",
"serde_json",
"sha2",
"smallvec",
"tempfile",
"threadpool",
Expand All @@ -4632,7 +4609,7 @@ name = "rustdoc-json-types"
version = "0.1.0"
dependencies = [
"bincode",
"rustc-hash 1.1.0",
"rustc-hash 2.0.0",
"serde",
"serde_json",
]
Expand Down Expand Up @@ -5262,7 +5239,7 @@ dependencies = [
"ignore",
"miropt-test-tools",
"regex",
"rustc-hash 1.1.0",
"rustc-hash 2.0.0",
"semver",
"similar",
"termcolor",
Expand Down Expand Up @@ -5593,13 +5570,6 @@ dependencies = [
"version_check",
]

[[package]]
name = "unicode-bdd"
version = "0.1.0"
dependencies = [
"ucd-parse",
]

[[package]]
name = "unicode-bidi"
version = "0.3.15"
Expand Down Expand Up @@ -5649,6 +5619,13 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"

[[package]]
name = "unicode-table-generator"
version = "0.1.0"
dependencies = [
"ucd-parse",
]

[[package]]
name = "unicode-width"
version = "0.1.14"
Expand Down
20 changes: 9 additions & 11 deletions compiler/rustc_abi/src/callconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@ mod abi {
pub(crate) use crate::Variants;
}

#[cfg(feature = "nightly")]
use rustc_macros::HashStable_Generic;

use crate::{Abi, Align, FieldsShape, HasDataLayout, Size, TyAbiInterface, TyAndLayout};
#[cfg(feature = "nightly")]
use crate::{Abi, FieldsShape, TyAbiInterface, TyAndLayout};
use crate::{Align, HasDataLayout, Size};

#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub enum RegKind {
Integer,
Float,
Vector,
}

#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct Reg {
pub kind: RegKind,
pub size: Size,
Expand Down Expand Up @@ -108,15 +113,8 @@ impl HomogeneousAggregate {
}
}

#[cfg(feature = "nightly")]
impl<'a, Ty> TyAndLayout<'a, Ty> {
/// Returns `true` if this is an aggregate type (including a ScalarPair!)
pub fn is_aggregate(&self) -> bool {
match self.abi {
Abi::Uninhabited | Abi::Scalar(_) | Abi::Vector { .. } => false,
Abi::ScalarPair(..) | Abi::Aggregate { .. } => true,
}
}

/// Returns `Homogeneous` if this layout is an aggregate containing fields of
/// only a single type (e.g., `(u32, u32)`). Such aggregates are often
/// special-cased in ABIs.
Expand Down
38 changes: 37 additions & 1 deletion compiler/rustc_abi/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ use crate::{
Variants, WrappingRange,
};

#[cfg(feature = "nightly")]
mod ty;

#[cfg(feature = "nightly")]
pub use ty::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx};

// A variant is absent if it's uninhabited and only has ZST fields.
Expand All @@ -39,7 +41,7 @@ enum NicheBias {
End,
}

#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum LayoutCalculatorError<F> {
/// An unsized type was found in a location where a sized type was expected.
///
Expand All @@ -54,6 +56,36 @@ pub enum LayoutCalculatorError<F> {

/// A union had no fields.
EmptyUnion,

/// The fields or variants have irreconcilable reprs
ReprConflict,
}

impl<F> LayoutCalculatorError<F> {
pub fn without_payload(&self) -> LayoutCalculatorError<()> {
match self {
LayoutCalculatorError::UnexpectedUnsized(_) => {
LayoutCalculatorError::UnexpectedUnsized(())
}
LayoutCalculatorError::SizeOverflow => LayoutCalculatorError::SizeOverflow,
LayoutCalculatorError::EmptyUnion => LayoutCalculatorError::EmptyUnion,
LayoutCalculatorError::ReprConflict => LayoutCalculatorError::ReprConflict,
}
}

/// Format an untranslated diagnostic for this type
///
/// Intended for use by rust-analyzer, as neither it nor `rustc_abi` depend on fluent infra.
pub fn fallback_fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
LayoutCalculatorError::UnexpectedUnsized(_) => {
"an unsized type was found where a sized type was expected"
}
LayoutCalculatorError::SizeOverflow => "size overflow",
LayoutCalculatorError::EmptyUnion => "type is a union with no fields",
LayoutCalculatorError::ReprConflict => "type has an invalid repr",
})
}
}

type LayoutCalculatorResult<FieldIdx, VariantIdx, F> =
Expand Down Expand Up @@ -489,6 +521,10 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
}

let dl = self.cx.data_layout();
// bail if the enum has an incoherent repr that cannot be computed
if repr.packed() {
return Err(LayoutCalculatorError::ReprConflict);
}

let calculate_niche_filling_layout = || -> Option<TmpLayout<FieldIdx, VariantIdx>> {
if dont_niche_optimize_enum {
Expand Down
Loading

0 comments on commit ca51c1e

Please sign in to comment.