Skip to content

Commit

Permalink
Auto merge of rust-lang#135861 - jieyouxu:rollup-d4naa6s, r=jieyouxu
Browse files Browse the repository at this point in the history
Rollup of 8 pull requests

Successful merges:

 - rust-lang#135779 (CI: free disk on linux arm runner)
 - rust-lang#135794 (Detect missing fields with default values and suggest `..`)
 - rust-lang#135814 (ci: use ghcr buildkit image)
 - rust-lang#135818 (tests: Port `translation` to rmake.rs)
 - rust-lang#135823 (make UI tests that use `--test` work on panic=abort targets)
 - rust-lang#135837 (Remove test panic from File::open)
 - rust-lang#135852 (Add `AsyncFn*` to `core` prelude)
 - rust-lang#135856 (Library: Finalize dyn compatibility renaming)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Jan 22, 2025
2 parents b2728d5 + 8614a92 commit 4dac61d
Show file tree
Hide file tree
Showing 16 changed files with 407 additions and 92 deletions.
30 changes: 30 additions & 0 deletions compiler/rustc_hir_typeck/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2349,6 +2349,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.report_missing_fields(
adt_ty,
path_span,
expr.span,
remaining_fields,
variant,
hir_fields,
Expand Down Expand Up @@ -2386,6 +2387,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
&self,
adt_ty: Ty<'tcx>,
span: Span,
full_span: Span,
remaining_fields: UnordMap<Ident, (FieldIdx, &ty::FieldDef)>,
variant: &'tcx ty::VariantDef,
hir_fields: &'tcx [hir::ExprField<'tcx>],
Expand Down Expand Up @@ -2425,6 +2427,34 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
);
err.span_label(span, format!("missing {remaining_fields_names}{truncated_fields_error}"));

if remaining_fields.items().all(|(_, (_, field))| field.value.is_some())
&& self.tcx.sess.is_nightly_build()
{
let msg = format!(
"all remaining fields have default values, {you_can} use those values with `..`",
you_can = if self.tcx.features().default_field_values() {
"you can"
} else {
"if you added `#![feature(default_field_values)]` to your crate you could"
},
);
if let Some(hir_field) = hir_fields.last() {
err.span_suggestion_verbose(
hir_field.span.shrink_to_hi(),
msg,
", ..".to_string(),
Applicability::MachineApplicable,
);
} else if hir_fields.is_empty() {
err.span_suggestion_verbose(
span.shrink_to_hi().with_hi(full_span.hi()),
msg,
" { .. }".to_string(),
Applicability::MachineApplicable,
);
}
}

if let Some(hir_field) = hir_fields.last() {
self.suggest_fru_from_range_and_emit(hir_field, variant, args, err);
} else {
Expand Down
3 changes: 3 additions & 0 deletions library/core/src/prelude/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ pub use crate::marker::{Copy, Send, Sized, Sync, Unpin};
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)]
pub use crate::ops::{Drop, Fn, FnMut, FnOnce};
#[stable(feature = "async_closure", since = "1.85.0")]
#[doc(no_inline)]
pub use crate::ops::{AsyncFn, AsyncFnMut, AsyncFnOnce};

// Re-exported functions
#[stable(feature = "core_prelude", since = "1.4.0")]
Expand Down
9 changes: 4 additions & 5 deletions library/std/src/keyword_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2387,13 +2387,12 @@ mod async_keyword {}
/// [`async`]: ../std/keyword.async.html
mod await_keyword {}

// FIXME(dyn_compat_renaming): Update URL and link text.
#[doc(keyword = "dyn")]
//
/// `dyn` is a prefix of a [trait object]'s type.
///
/// The `dyn` keyword is used to highlight that calls to methods on the associated `Trait`
/// are [dynamically dispatched]. To use the trait this way, it must be 'dyn-compatible'[^1].
/// are [dynamically dispatched]. To use the trait this way, it must be *dyn compatible*[^1].
///
/// Unlike generic parameters or `impl Trait`, the compiler does not know the concrete type that
/// is being passed. That is, the type has been [erased].
Expand All @@ -2406,7 +2405,7 @@ mod await_keyword {}
/// the function pointer and then that function pointer is called.
///
/// See the Reference for more information on [trait objects][ref-trait-obj]
/// and [object safety][ref-obj-safety].
/// and [dyn compatibility][ref-dyn-compat].
///
/// ## Trade-offs
///
Expand All @@ -2419,9 +2418,9 @@ mod await_keyword {}
/// [trait object]: ../book/ch17-02-trait-objects.html
/// [dynamically dispatched]: https://en.wikipedia.org/wiki/Dynamic_dispatch
/// [ref-trait-obj]: ../reference/types/trait-object.html
/// [ref-obj-safety]: ../reference/items/traits.html#object-safety
/// [ref-dyn-compat]: ../reference/items/traits.html#dyn-compatibility
/// [erased]: https://en.wikipedia.org/wiki/Type_erasure
/// [^1]: Formerly known as 'object safe'.
/// [^1]: Formerly known as *object safe*.
mod dyn_keyword {}

#[doc(keyword = "union")]
Expand Down
3 changes: 0 additions & 3 deletions library/std/src/sys/pal/windows/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,6 @@ impl File {
mem::size_of::<c::FILE_ALLOCATION_INFO>() as u32,
);
if result == 0 {
if api::get_last_error().code != 0 {
panic!("FILE_ALLOCATION_INFO failed!!!");
}
let eof = c::FILE_END_OF_FILE_INFO { EndOfFile: 0 };
let result = c::SetFileInformationByHandle(
handle.as_raw_handle(),
Expand Down
9 changes: 7 additions & 2 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
build_args+=("--build-arg" "SCRIPT_ARG=${DOCKER_SCRIPT}")
fi

GHCR_BUILDKIT_IMAGE="ghcr.io/rust-lang/buildkit:buildx-stable-1"
# On non-CI jobs, we try to download a pre-built image from the rust-lang-ci
# ghcr.io registry. If it is not possible, we fall back to building the image
# locally.
Expand All @@ -140,7 +141,9 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
elif [[ "$PR_CI_JOB" == "1" ]];
then
# Enable a new Docker driver so that --cache-from works with a registry backend
docker buildx create --use --driver docker-container
# Use a custom image to avoid DockerHub rate limits
docker buildx create --use --driver docker-container \
--driver-opt image=${GHCR_BUILDKIT_IMAGE}

# Build the image using registry caching backend
retry docker \
Expand All @@ -156,7 +159,9 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
--password-stdin

# Enable a new Docker driver so that --cache-from/to works with a registry backend
docker buildx create --use --driver docker-container
# Use a custom image to avoid DockerHub rate limits
docker buildx create --use --driver docker-container \
--driver-opt image=${GHCR_BUILDKIT_IMAGE}

# Build the image using registry caching backend
retry docker \
Expand Down
2 changes: 2 additions & 0 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ runners:
<<: *base-job

- &job-aarch64-linux
# Free some disk space to avoid running out of space during the build.
free_disk: true
os: ubuntu-22.04-arm

envs:
Expand Down
10 changes: 9 additions & 1 deletion src/tools/run-make-support/src/external_deps/rustc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::ffi::{OsStr, OsString};
use std::path::Path;
use std::path::{Path, PathBuf};
use std::str::FromStr as _;

use crate::command::Command;
use crate::env::env_var;
Expand Down Expand Up @@ -390,3 +391,10 @@ impl Rustc {
self
}
}

/// Query the sysroot path corresponding `rustc --print=sysroot`.
#[track_caller]
pub fn sysroot() -> PathBuf {
let path = rustc().print("sysroot").run().stdout_utf8();
PathBuf::from_str(path.trim()).unwrap()
}
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
run-make/jobserver-error/Makefile
run-make/split-debuginfo/Makefile
run-make/symbol-mangling-hashed/Makefile
run-make/translation/Makefile
78 changes: 0 additions & 78 deletions tests/run-make/translation/Makefile

This file was deleted.

Loading

0 comments on commit 4dac61d

Please sign in to comment.