Skip to content

Commit

Permalink
Auto merge of #122925 - matthiaskrgr:rollup-2afe4wp, r=matthiaskrgr
Browse files Browse the repository at this point in the history
Rollup of 9 pull requests

Successful merges:

 - #116016 (Soft-destabilize `RustcEncodable` & `RustcDecodable`, remove from prelude in next edition)
 - #122460 (Rework rmake support library API)
 - #122658 (ci: Build gccjit from a git archive)
 - #122698 (Cancel `cargo update` job if there's no updates)
 - #122878 (Use `arch::wasm::unreachable` instead of `arch::wasm32::unreachable`)
 - #122915 (Delay a bug if no RPITITs were found)
 - #122916 (docs(sync): normalize dot in fn summaries)
 - #122921 (Enable more mir-opt tests in debug builds)
 - #122922 (-Zprint-type-sizes: print the types of awaitees and unnamed coroutine locals.)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Mar 23, 2024
2 parents c3b05c6 + 9ac1c80 commit 2594896
Show file tree
Hide file tree
Showing 44 changed files with 527 additions and 262 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
# Exit with error if open and S-waiting-on-bors
if [[ "$STATE" == "OPEN" && "$WAITING_ON_BORS" == "true" ]]; then
exit 1
gh run cancel ${{ github.run_id }}
fi
update:
Expand All @@ -65,7 +65,10 @@ jobs:
- name: cargo update
# Remove first line that always just says "Updating crates.io index"
run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
# If there are no changes, cancel the job here
run: |
cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
git status --porcelain | grep -q Cargo.lock || gh run cancel ${{ github.run_id }}
- name: upload Cargo.lock artifact for use in PR
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -131,7 +134,7 @@ jobs:
# Exit with error if PR is closed
STATE=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json state --jq '.state')
if [[ "$STATE" != "OPEN" ]]; then
exit 1
gh run cancel ${{ github.run_id }}
fi
gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY
Expand Down
7 changes: 3 additions & 4 deletions compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,10 +639,9 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
}
}

if !unnormalized_trait_sig.output().references_error() {
debug_assert!(
!collector.types.is_empty(),
"expect >0 RPITITs in call to `collect_return_position_impl_trait_in_trait_tys`"
if !unnormalized_trait_sig.output().references_error() && collector.types.is_empty() {
tcx.dcx().delayed_bug(
"expect >0 RPITITs in call to `collect_return_position_impl_trait_in_trait_tys`",
);
}

Expand Down
18 changes: 14 additions & 4 deletions compiler/rustc_session/src/code_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ pub struct FieldInfo {
pub offset: u64,
pub size: u64,
pub align: u64,
/// Name of the type of this field.
/// Present only if the creator thought that this would be important for identifying the field,
/// typically because the field name is uninformative.
pub type_name: Option<Symbol>,
}

#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
Expand Down Expand Up @@ -192,7 +196,7 @@ impl CodeStats {
fields.sort_by_key(|f| (f.offset, f.size));

for field in fields {
let FieldInfo { kind, ref name, offset, size, align } = field;
let FieldInfo { kind, ref name, offset, size, align, type_name } = field;

if offset > min_offset {
let pad = offset - min_offset;
Expand All @@ -201,21 +205,27 @@ impl CodeStats {

if offset < min_offset {
// If this happens it's probably a union.
println!(
print!(
"print-type-size {indent}{kind} `.{name}`: {size} bytes, \
offset: {offset} bytes, \
alignment: {align} bytes"
);
} else if info.packed || offset == min_offset {
println!("print-type-size {indent}{kind} `.{name}`: {size} bytes");
print!("print-type-size {indent}{kind} `.{name}`: {size} bytes");
} else {
// Include field alignment in output only if it caused padding injection
println!(
print!(
"print-type-size {indent}{kind} `.{name}`: {size} bytes, \
alignment: {align} bytes"
);
}

if let Some(type_name) = type_name {
println!(", type: {type_name}");
} else {
println!();
}

min_offset = offset + size;
}
}
Expand Down
10 changes: 9 additions & 1 deletion compiler/rustc_ty_utils/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use rustc_middle::ty::layout::{
use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::{self, AdtDef, EarlyBinder, GenericArgsRef, Ty, TyCtxt, TypeVisitableExt};
use rustc_session::{DataTypeKind, FieldInfo, FieldKind, SizeKind, VariantInfo};
use rustc_span::sym;
use rustc_span::symbol::Symbol;
use rustc_target::abi::*;

Expand Down Expand Up @@ -1007,6 +1008,7 @@ fn variant_info_for_adt<'tcx>(
offset: offset.bytes(),
size: field_layout.size.bytes(),
align: field_layout.align.abi.bytes(),
type_name: None,
}
})
.collect();
Expand Down Expand Up @@ -1090,6 +1092,7 @@ fn variant_info_for_coroutine<'tcx>(
offset: offset.bytes(),
size: field_layout.size.bytes(),
align: field_layout.align.abi.bytes(),
type_name: None,
}
})
.collect();
Expand All @@ -1104,19 +1107,24 @@ fn variant_info_for_coroutine<'tcx>(
.iter()
.enumerate()
.map(|(field_idx, local)| {
let field_name = coroutine.field_names[*local];
let field_layout = variant_layout.field(cx, field_idx);
let offset = variant_layout.fields.offset(field_idx);
// The struct is as large as the last field's end
variant_size = variant_size.max(offset + field_layout.size);
FieldInfo {
kind: FieldKind::CoroutineLocal,
name: coroutine.field_names[*local].unwrap_or(Symbol::intern(&format!(
name: field_name.unwrap_or(Symbol::intern(&format!(
".coroutine_field{}",
local.as_usize()
))),
offset: offset.bytes(),
size: field_layout.size.bytes(),
align: field_layout.align.abi.bytes(),
// Include the type name if there is no field name, or if the name is the
// __awaitee placeholder symbol which means a child future being `.await`ed.
type_name: (field_name.is_none() || field_name == Some(sym::__awaitee))
.then(|| Symbol::intern(&field_layout.ty.to_string())),
}
})
.chain(upvar_fields.iter().copied())
Expand Down
20 changes: 14 additions & 6 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1726,20 +1726,28 @@ pub(crate) mod builtin {
builtin # deref($pat)
}

/// Unstable implementation detail of the `rustc` compiler, do not use.
/// Derive macro for `rustc-serialize`. Should not be used in new code.
#[rustc_builtin_macro]
#[stable(feature = "rust1", since = "1.0.0")]
#[allow_internal_unstable(core_intrinsics, libstd_sys_internals, rt)]
#[unstable(
feature = "rustc_encodable_decodable",
issue = "none",
soft,
reason = "derive macro for `rustc-serialize`; should not be used in new code"
)]
#[deprecated(since = "1.52.0", note = "rustc-serialize is deprecated and no longer supported")]
#[doc(hidden)] // While technically stable, using it is unstable, and deprecated. Hide it.
pub macro RustcDecodable($item:item) {
/* compiler built-in */
}

/// Unstable implementation detail of the `rustc` compiler, do not use.
/// Derive macro for `rustc-serialize`. Should not be used in new code.
#[rustc_builtin_macro]
#[stable(feature = "rust1", since = "1.0.0")]
#[allow_internal_unstable(core_intrinsics, rt)]
#[unstable(
feature = "rustc_encodable_decodable",
issue = "none",
soft,
reason = "derive macro for `rustc-serialize`; should not be used in new code"
)]
#[deprecated(since = "1.52.0", note = "rustc-serialize is deprecated and no longer supported")]
#[doc(hidden)] // While technically stable, using it is unstable, and deprecated. Hide it.
pub macro RustcEncodable($item:item) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//! The first version of the core prelude.
//! Items common to the prelude of all editions.
//!
//! See the [module-level documentation](super) for more.
#![stable(feature = "core_prelude", since = "1.4.0")]

// Re-exported core operators
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)]
Expand Down Expand Up @@ -68,11 +66,6 @@ pub use crate::{
#[doc(no_inline)]
pub use crate::concat_bytes;

// Do not `doc(inline)` these `doc(hidden)` items.
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow(deprecated)]
pub use crate::macros::builtin::{RustcDecodable, RustcEncodable};

// Do not `doc(no_inline)` so that they become doc items on their own
// (no public module for them to be re-exported from).
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
Expand Down
34 changes: 30 additions & 4 deletions library/core/src/prelude/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,26 @@
#![stable(feature = "core_prelude", since = "1.4.0")]

pub mod v1;
mod common;

/// The first version of the prelude of The Rust Standard Library.
///
/// See the [module-level documentation](self) for more.
#[stable(feature = "rust1", since = "1.0.0")]
pub mod v1 {
#[stable(feature = "rust1", since = "1.0.0")]
pub use super::common::*;

// Do not `doc(inline)` these `doc(hidden)` items.
#[unstable(
feature = "rustc_encodable_decodable",
issue = "none",
soft,
reason = "derive macro for `rustc-serialize`; should not be used in new code"
)]
#[allow(deprecated)]
pub use crate::macros::builtin::{RustcDecodable, RustcEncodable};
}

/// The 2015 version of the core prelude.
///
Expand Down Expand Up @@ -46,14 +65,21 @@ pub mod rust_2021 {
pub use crate::convert::{TryFrom, TryInto};
}

/// The 2024 edition of the core prelude.
/// The 2024 version of the core prelude.
///
/// See the [module-level documentation](self) for more.
#[unstable(feature = "prelude_2024", issue = "121042")]
pub mod rust_2024 {
#[unstable(feature = "prelude_2024", issue = "121042")]
#[stable(feature = "rust1", since = "1.0.0")]
pub use super::common::*;

#[stable(feature = "prelude_2021", since = "1.55.0")]
#[doc(no_inline)]
pub use crate::iter::FromIterator;

#[stable(feature = "prelude_2021", since = "1.55.0")]
#[doc(no_inline)]
pub use super::rust_2021::*;
pub use crate::convert::{TryFrom, TryInto};

#[unstable(feature = "prelude_2024", issue = "121042")]
#[doc(no_inline)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//! The first version of the prelude of The Rust Standard Library.
//! Items common to the prelude of all editions.
//!
//! See the [module-level documentation](super) for more.
#![stable(feature = "rust1", since = "1.0.0")]

// Re-exported core operators
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
Expand Down Expand Up @@ -52,11 +50,6 @@ pub use core::prelude::v1::{
#[doc(no_inline)]
pub use core::prelude::v1::concat_bytes;

// Do not `doc(inline)` these `doc(hidden)` items.
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow(deprecated)]
pub use core::prelude::v1::{RustcDecodable, RustcEncodable};

// Do not `doc(no_inline)` so that they become doc items on their own
// (no public module for them to be re-exported from).
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
Expand Down
26 changes: 22 additions & 4 deletions library/std/src/prelude/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,26 @@
#![stable(feature = "rust1", since = "1.0.0")]

pub mod v1;
mod common;

/// The first version of the prelude of The Rust Standard Library.
///
/// See the [module-level documentation](self) for more.
#[stable(feature = "rust1", since = "1.0.0")]
pub mod v1 {
#[stable(feature = "rust1", since = "1.0.0")]
pub use super::common::*;

// Do not `doc(inline)` these `doc(hidden)` items.
#[unstable(
feature = "rustc_encodable_decodable",
issue = "none",
soft,
reason = "derive macro for `rustc-serialize`; should not be used in new code"
)]
#[allow(deprecated)]
pub use core::prelude::v1::{RustcDecodable, RustcEncodable};
}

/// The 2015 version of the prelude of The Rust Standard Library.
///
Expand Down Expand Up @@ -134,9 +153,8 @@ pub mod rust_2021 {
/// See the [module-level documentation](self) for more.
#[unstable(feature = "prelude_2024", issue = "121042")]
pub mod rust_2024 {
#[unstable(feature = "prelude_2024", issue = "121042")]
#[doc(no_inline)]
pub use super::v1::*;
#[stable(feature = "rust1", since = "1.0.0")]
pub use super::common::*;

#[unstable(feature = "prelude_2024", issue = "121042")]
#[doc(no_inline)]
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sync/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl<T: ?Sized> Mutex<T> {
self.poison.get()
}

/// Clear the poisoned state from a mutex
/// Clear the poisoned state from a mutex.
///
/// If the mutex is poisoned, it will remain poisoned until this function is called. This
/// allows recovering from a poisoned state and marking that it has recovered. For example, if
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sync/rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ impl<T: ?Sized> RwLock<T> {
self.poison.get()
}

/// Clear the poisoned state from a lock
/// Clear the poisoned state from a lock.
///
/// If the lock is poisoned, it will remain poisoned until this function is called. This allows
/// recovering from a poisoned state and marking that it has recovered. For example, if the
Expand Down
2 changes: 1 addition & 1 deletion library/unwind/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub unsafe fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwi
wasm_throw(0, exception.cast())
} else {
let _ = exception;
core::arch::wasm32::unreachable()
core::arch::wasm::unreachable()
}
}
}
18 changes: 11 additions & 7 deletions src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
#!/usr/bin/env bash

GIT_REPO="https://github.com/rust-lang/gcc"

# This commit hash needs to be updated to use a more recent gcc fork version.
GIT_COMMIT="78dc50f0e50e6cd1433149520bd512a4e0eaa1bc"

set -ex

cd $1

source shared.sh

# Setting up folders for GCC
git clone https://github.com/antoyo/gcc gcc-src
cd gcc-src
# This commit hash needs to be updated to use a more recent gcc fork version.
git checkout 78dc50f0e50e6cd1433149520bd512a4e0eaa1bc
curl -L "$GIT_REPO/archive/$GIT_COMMIT.tar.gz" |
tar -xz --transform "s/gcc-$GIT_COMMIT/gcc-src/"

mkdir ../gcc-build ../gcc-install
cd ../gcc-build
mkdir gcc-build gcc-install
pushd gcc-build

# Building GCC.
hide_output \
Expand All @@ -28,6 +31,7 @@ hide_output \
hide_output make -j$(nproc)
hide_output make install

rm -rf ../gcc-src
popd
rm -rf gcc-src gcc-build
ln -s /scripts/gcc-install/lib/libgccjit.so /usr/lib/x86_64-linux-gnu/libgccjit.so
ln -s /scripts/gcc-install/lib/libgccjit.so /usr/lib/x86_64-linux-gnu/libgccjit.so.0
Loading

0 comments on commit 2594896

Please sign in to comment.