Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4dac61d

Browse files
committedJan 22, 2025
Auto merge of #135861 - jieyouxu:rollup-d4naa6s, r=jieyouxu
Rollup of 8 pull requests Successful merges: - #135779 (CI: free disk on linux arm runner) - #135794 (Detect missing fields with default values and suggest `..`) - #135814 (ci: use ghcr buildkit image) - #135818 (tests: Port `translation` to rmake.rs) - #135823 (make UI tests that use `--test` work on panic=abort targets) - #135837 (Remove test panic from File::open) - #135852 (Add `AsyncFn*` to `core` prelude) - #135856 (Library: Finalize dyn compatibility renaming) r? `@ghost` `@rustbot` modify labels: rollup
2 parents b2728d5 + 8614a92 commit 4dac61d

File tree

16 files changed

+407
-92
lines changed

16 files changed

+407
-92
lines changed
 

‎compiler/rustc_hir_typeck/src/expr.rs

+30
Original file line numberDiff line numberDiff line change
@@ -2349,6 +2349,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
23492349
self.report_missing_fields(
23502350
adt_ty,
23512351
path_span,
2352+
expr.span,
23522353
remaining_fields,
23532354
variant,
23542355
hir_fields,
@@ -2386,6 +2387,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
23862387
&self,
23872388
adt_ty: Ty<'tcx>,
23882389
span: Span,
2390+
full_span: Span,
23892391
remaining_fields: UnordMap<Ident, (FieldIdx, &ty::FieldDef)>,
23902392
variant: &'tcx ty::VariantDef,
23912393
hir_fields: &'tcx [hir::ExprField<'tcx>],
@@ -2425,6 +2427,34 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
24252427
);
24262428
err.span_label(span, format!("missing {remaining_fields_names}{truncated_fields_error}"));
24272429

2430+
if remaining_fields.items().all(|(_, (_, field))| field.value.is_some())
2431+
&& self.tcx.sess.is_nightly_build()
2432+
{
2433+
let msg = format!(
2434+
"all remaining fields have default values, {you_can} use those values with `..`",
2435+
you_can = if self.tcx.features().default_field_values() {
2436+
"you can"
2437+
} else {
2438+
"if you added `#![feature(default_field_values)]` to your crate you could"
2439+
},
2440+
);
2441+
if let Some(hir_field) = hir_fields.last() {
2442+
err.span_suggestion_verbose(
2443+
hir_field.span.shrink_to_hi(),
2444+
msg,
2445+
", ..".to_string(),
2446+
Applicability::MachineApplicable,
2447+
);
2448+
} else if hir_fields.is_empty() {
2449+
err.span_suggestion_verbose(
2450+
span.shrink_to_hi().with_hi(full_span.hi()),
2451+
msg,
2452+
" { .. }".to_string(),
2453+
Applicability::MachineApplicable,
2454+
);
2455+
}
2456+
}
2457+
24282458
if let Some(hir_field) = hir_fields.last() {
24292459
self.suggest_fru_from_range_and_emit(hir_field, variant, args, err);
24302460
} else {

‎library/core/src/prelude/common.rs

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ pub use crate::marker::{Copy, Send, Sized, Sync, Unpin};
1212
#[stable(feature = "core_prelude", since = "1.4.0")]
1313
#[doc(no_inline)]
1414
pub use crate::ops::{Drop, Fn, FnMut, FnOnce};
15+
#[stable(feature = "async_closure", since = "1.85.0")]
16+
#[doc(no_inline)]
17+
pub use crate::ops::{AsyncFn, AsyncFnMut, AsyncFnOnce};
1518

1619
// Re-exported functions
1720
#[stable(feature = "core_prelude", since = "1.4.0")]

‎library/std/src/keyword_docs.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -2387,13 +2387,12 @@ mod async_keyword {}
23872387
/// [`async`]: ../std/keyword.async.html
23882388
mod await_keyword {}
23892389

2390-
// FIXME(dyn_compat_renaming): Update URL and link text.
23912390
#[doc(keyword = "dyn")]
23922391
//
23932392
/// `dyn` is a prefix of a [trait object]'s type.
23942393
///
23952394
/// The `dyn` keyword is used to highlight that calls to methods on the associated `Trait`
2396-
/// are [dynamically dispatched]. To use the trait this way, it must be 'dyn-compatible'[^1].
2395+
/// are [dynamically dispatched]. To use the trait this way, it must be *dyn compatible*[^1].
23972396
///
23982397
/// Unlike generic parameters or `impl Trait`, the compiler does not know the concrete type that
23992398
/// is being passed. That is, the type has been [erased].
@@ -2406,7 +2405,7 @@ mod await_keyword {}
24062405
/// the function pointer and then that function pointer is called.
24072406
///
24082407
/// See the Reference for more information on [trait objects][ref-trait-obj]
2409-
/// and [object safety][ref-obj-safety].
2408+
/// and [dyn compatibility][ref-dyn-compat].
24102409
///
24112410
/// ## Trade-offs
24122411
///
@@ -2419,9 +2418,9 @@ mod await_keyword {}
24192418
/// [trait object]: ../book/ch17-02-trait-objects.html
24202419
/// [dynamically dispatched]: https://en.wikipedia.org/wiki/Dynamic_dispatch
24212420
/// [ref-trait-obj]: ../reference/types/trait-object.html
2422-
/// [ref-obj-safety]: ../reference/items/traits.html#object-safety
2421+
/// [ref-dyn-compat]: ../reference/items/traits.html#dyn-compatibility
24232422
/// [erased]: https://en.wikipedia.org/wiki/Type_erasure
2424-
/// [^1]: Formerly known as 'object safe'.
2423+
/// [^1]: Formerly known as *object safe*.
24252424
mod dyn_keyword {}
24262425

24272426
#[doc(keyword = "union")]

‎library/std/src/sys/pal/windows/fs.rs

-3
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,6 @@ impl File {
328328
mem::size_of::<c::FILE_ALLOCATION_INFO>() as u32,
329329
);
330330
if result == 0 {
331-
if api::get_last_error().code != 0 {
332-
panic!("FILE_ALLOCATION_INFO failed!!!");
333-
}
334331
let eof = c::FILE_END_OF_FILE_INFO { EndOfFile: 0 };
335332
let result = c::SetFileInformationByHandle(
336333
handle.as_raw_handle(),

‎src/ci/docker/run.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
123123
build_args+=("--build-arg" "SCRIPT_ARG=${DOCKER_SCRIPT}")
124124
fi
125125

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

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

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

161166
# Build the image using registry caching backend
162167
retry docker \

‎src/ci/github-actions/jobs.yml

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ runners:
4848
<<: *base-job
4949

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

5355
envs:

‎src/tools/run-make-support/src/external_deps/rustc.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::ffi::{OsStr, OsString};
2-
use std::path::Path;
2+
use std::path::{Path, PathBuf};
3+
use std::str::FromStr as _;
34

45
use crate::command::Command;
56
use crate::env::env_var;
@@ -390,3 +391,10 @@ impl Rustc {
390391
self
391392
}
392393
}
394+
395+
/// Query the sysroot path corresponding `rustc --print=sysroot`.
396+
#[track_caller]
397+
pub fn sysroot() -> PathBuf {
398+
let path = rustc().print("sysroot").run().stdout_utf8();
399+
PathBuf::from_str(path.trim()).unwrap()
400+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
run-make/jobserver-error/Makefile
22
run-make/split-debuginfo/Makefile
33
run-make/symbol-mangling-hashed/Makefile
4-
run-make/translation/Makefile

‎tests/run-make/translation/Makefile

-78
This file was deleted.
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.