Skip to content

Commit 932c173

Browse files
committed
Auto merge of #109884 - matthiaskrgr:rollup-5wapig9, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #109526 (LIBPATH is used as dylib's path environment variable on AIX) - #109642 (check for missing codegen backeng config) - #109722 (Implement read_buf for RustHermit) - #109856 (fix(middle): emit error rather than delay bug when reaching limit) - #109868 (Improve PR job names in Github Actions preview) - #109871 (Include invocation start times) - #109873 (Move some UI tests into subdirectories) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents d0eed58 + 22df710 commit 932c173

File tree

74 files changed

+119
-97
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+119
-97
lines changed

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
pr:
3535
permissions:
3636
actions: write
37-
name: PR
37+
name: "PR - ${{ matrix.name }}"
3838
env:
3939
CI_JOB_NAME: "${{ matrix.name }}"
4040
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
@@ -159,7 +159,7 @@ jobs:
159159
auto:
160160
permissions:
161161
actions: write
162-
name: auto
162+
name: "auto - ${{ matrix.name }}"
163163
env:
164164
CI_JOB_NAME: "${{ matrix.name }}"
165165
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
@@ -578,7 +578,7 @@ jobs:
578578
try:
579579
permissions:
580580
actions: write
581-
name: try
581+
name: "try - ${{ matrix.name }}"
582582
env:
583583
CI_JOB_NAME: "${{ matrix.name }}"
584584
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

compiler/rustc_middle/messages.ftl

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ middle_limit_invalid =
1616
`limit` must be a non-negative integer
1717
.label = {$error_str}
1818
19+
middle_recursion_limit_reached =
20+
reached the recursion limit finding the struct tail for `{$ty}`
21+
.help = consider increasing the recursion limit by adding a `#![recursion_limit = "{$suggested_limit}"]`
22+
1923
middle_const_eval_non_int =
2024
constant evaluation of enum discriminant resulted in non-integer
2125

compiler/rustc_middle/src/error.rs

+8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ pub struct LimitInvalid<'a> {
4949
pub error_str: &'a str,
5050
}
5151

52+
#[derive(Diagnostic)]
53+
#[diag(middle_recursion_limit_reached)]
54+
#[help]
55+
pub struct RecursionLimitReached<'tcx> {
56+
pub ty: Ty<'tcx>,
57+
pub suggested_limit: rustc_session::Limit,
58+
}
59+
5260
#[derive(Diagnostic)]
5361
#[diag(middle_const_eval_non_int)]
5462
pub struct ConstEvalNonIntError {

compiler/rustc_middle/src/ty/util.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ use rustc_hir::def_id::{DefId, LocalDefId};
1919
use rustc_index::bit_set::GrowableBitSet;
2020
use rustc_index::vec::{Idx, IndexVec};
2121
use rustc_macros::HashStable;
22-
use rustc_span::{sym, DUMMY_SP};
22+
use rustc_session::Limit;
23+
use rustc_span::sym;
2324
use rustc_target::abi::{Integer, IntegerType, Size, TargetDataLayout};
2425
use rustc_target::spec::abi::Abi;
2526
use smallvec::SmallVec;
@@ -225,10 +226,13 @@ impl<'tcx> TyCtxt<'tcx> {
225226
let recursion_limit = self.recursion_limit();
226227
for iteration in 0.. {
227228
if !recursion_limit.value_within_limit(iteration) {
228-
return self.ty_error_with_message(
229-
DUMMY_SP,
230-
&format!("reached the recursion limit finding the struct tail for {}", ty),
231-
);
229+
let suggested_limit = match recursion_limit {
230+
Limit(0) => Limit(2),
231+
limit => limit * 2,
232+
};
233+
let reported =
234+
self.sess.emit_err(crate::error::RecursionLimitReached { ty, suggested_limit });
235+
return self.ty_error(reported);
232236
}
233237
match *ty.kind() {
234238
ty::Adt(def, substs) => {

library/std/src/sys/hermit/net.rs

+24-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(dead_code)]
22

33
use crate::cmp;
4-
use crate::io::{self, IoSlice, IoSliceMut};
4+
use crate::io::{self, BorrowedBuf, BorrowedCursor, IoSlice, IoSliceMut};
55
use crate::mem;
66
use crate::net::{Shutdown, SocketAddr};
77
use crate::os::hermit::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, RawFd};
@@ -146,18 +146,35 @@ impl Socket {
146146
Ok(Socket(unsafe { FileDesc::from_raw_fd(fd) }))
147147
}
148148

149-
fn recv_with_flags(&self, buf: &mut [u8], flags: i32) -> io::Result<usize> {
150-
let ret =
151-
cvt(unsafe { netc::recv(self.0.as_raw_fd(), buf.as_mut_ptr(), buf.len(), flags) })?;
152-
Ok(ret as usize)
149+
fn recv_with_flags(&self, mut buf: BorrowedCursor<'_>, flags: i32) -> io::Result<()> {
150+
let ret = cvt(unsafe {
151+
netc::recv(
152+
self.0.as_raw_fd(),
153+
buf.as_mut().as_mut_ptr() as *mut u8,
154+
buf.capacity(),
155+
flags,
156+
)
157+
})?;
158+
unsafe {
159+
buf.advance(ret as usize);
160+
}
161+
Ok(())
153162
}
154163

155164
pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
156-
self.recv_with_flags(buf, 0)
165+
let mut buf = BorrowedBuf::from(buf);
166+
self.recv_with_flags(buf.unfilled(), 0)?;
167+
Ok(buf.len())
157168
}
158169

159170
pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
160-
self.recv_with_flags(buf, netc::MSG_PEEK)
171+
let mut buf = BorrowedBuf::from(buf);
172+
self.recv_with_flags(buf.unfilled(), netc::MSG_PEEK)?;
173+
Ok(buf.len())
174+
}
175+
176+
pub fn read_buf(&self, buf: BorrowedCursor<'_>) -> io::Result<()> {
177+
self.recv_with_flags(buf, 0)
161178
}
162179

163180
pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {

src/bootstrap/bootstrap.py

+3
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,9 @@ def build_bootstrap(self, color, verbose_count):
741741
env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
742742
(os.pathsep + env["LIBRARY_PATH"]) \
743743
if "LIBRARY_PATH" in env else ""
744+
env["LIBPATH"] = os.path.join(self.bin_root(), "lib") + \
745+
(os.pathsep + env["LIBPATH"]) \
746+
if "LIBPATH" in env else ""
744747

745748
# Export Stage0 snapshot compiler related env variables
746749
build_section = "target.{}".format(self.build)

src/bootstrap/compile.rs

+43-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use serde_derive::Deserialize;
2020

2121
use crate::builder::crate_description;
2222
use crate::builder::Cargo;
23-
use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
23+
use crate::builder::{Builder, Kind, PathSet, RunConfig, ShouldRun, Step, TaskPath};
2424
use crate::cache::{Interned, INTERNER};
2525
use crate::config::{LlvmLibunwind, RustcLto, TargetSelection};
2626
use crate::dist;
@@ -995,6 +995,44 @@ pub struct CodegenBackend {
995995
pub backend: Interned<String>,
996996
}
997997

998+
fn needs_codegen_config(run: &RunConfig<'_>) -> bool {
999+
let mut needs_codegen_cfg = false;
1000+
for path_set in &run.paths {
1001+
needs_codegen_cfg = match path_set {
1002+
PathSet::Set(set) => set.iter().any(|p| is_codegen_cfg_needed(p, run)),
1003+
PathSet::Suite(suite) => is_codegen_cfg_needed(&suite, run),
1004+
}
1005+
}
1006+
needs_codegen_cfg
1007+
}
1008+
1009+
const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_";
1010+
1011+
fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
1012+
if path.path.to_str().unwrap().contains(&CODEGEN_BACKEND_PREFIX) {
1013+
let mut needs_codegen_backend_config = true;
1014+
for &backend in &run.builder.config.rust_codegen_backends {
1015+
if path
1016+
.path
1017+
.to_str()
1018+
.unwrap()
1019+
.ends_with(&(CODEGEN_BACKEND_PREFIX.to_owned() + &backend))
1020+
{
1021+
needs_codegen_backend_config = false;
1022+
}
1023+
}
1024+
if needs_codegen_backend_config {
1025+
run.builder.info(
1026+
"Warning: no codegen-backends config matched the requested path to build a codegen backend. \
1027+
Help: add backend to codegen-backends in config.toml.",
1028+
);
1029+
return true;
1030+
}
1031+
}
1032+
1033+
return false;
1034+
}
1035+
9981036
impl Step for CodegenBackend {
9991037
type Output = ();
10001038
const ONLY_HOSTS: bool = true;
@@ -1006,6 +1044,10 @@ impl Step for CodegenBackend {
10061044
}
10071045

10081046
fn make_run(run: RunConfig<'_>) {
1047+
if needs_codegen_config(&run) {
1048+
return;
1049+
}
1050+
10091051
for &backend in &run.builder.config.rust_codegen_backends {
10101052
if backend == "llvm" {
10111053
continue; // Already built as part of rustc

src/bootstrap/dylib_util.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ pub fn dylib_path_var() -> &'static str {
1212
"DYLD_LIBRARY_PATH"
1313
} else if cfg!(target_os = "haiku") {
1414
"LIBRARY_PATH"
15+
} else if cfg!(target_os = "aix") {
16+
"LIBPATH"
1517
} else {
1618
"LD_LIBRARY_PATH"
1719
}

src/bootstrap/metrics.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use serde_derive::{Deserialize, Serialize};
1111
use std::cell::RefCell;
1212
use std::fs::File;
1313
use std::io::BufWriter;
14-
use std::time::{Duration, Instant};
14+
use std::time::{Duration, Instant, SystemTime};
1515
use sysinfo::{CpuExt, System, SystemExt};
1616

1717
pub(crate) struct BuildMetrics {
@@ -27,6 +27,7 @@ impl BuildMetrics {
2727
system_info: System::new(),
2828
timer_start: None,
2929
invocation_timer_start: Instant::now(),
30+
invocation_start: SystemTime::now(),
3031
});
3132

3233
BuildMetrics { state }
@@ -124,6 +125,11 @@ impl BuildMetrics {
124125
}
125126
};
126127
invocations.push(JsonInvocation {
128+
start_time: state
129+
.invocation_start
130+
.duration_since(SystemTime::UNIX_EPOCH)
131+
.unwrap()
132+
.as_secs(),
127133
duration_including_children_sec: state.invocation_timer_start.elapsed().as_secs_f64(),
128134
children: steps.into_iter().map(|step| self.prepare_json_step(step)).collect(),
129135
});
@@ -166,6 +172,7 @@ struct MetricsState {
166172
system_info: System,
167173
timer_start: Option<Instant>,
168174
invocation_timer_start: Instant,
175+
invocation_start: SystemTime,
169176
}
170177

171178
struct StepMetrics {
@@ -194,6 +201,10 @@ struct JsonRoot {
194201
#[derive(Serialize, Deserialize)]
195202
#[serde(rename_all = "snake_case")]
196203
struct JsonInvocation {
204+
// Unix timestamp in seconds
205+
//
206+
// This is necessary to easily correlate this invocation with logs or other data.
207+
start_time: u64,
197208
duration_including_children_sec: f64,
198209
children: Vec<JsonNode>,
199210
}

src/ci/github-actions/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ jobs:
284284
permissions:
285285
actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
286286
<<: *base-ci-job
287-
name: PR
287+
name: PR - ${{ matrix.name }}
288288
env:
289289
<<: [*shared-ci-variables, *public-variables]
290290
if: github.event_name == 'pull_request'
@@ -312,7 +312,7 @@ jobs:
312312
permissions:
313313
actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
314314
<<: *base-ci-job
315-
name: auto
315+
name: auto - ${{ matrix.name }}
316316
env:
317317
<<: [*shared-ci-variables, *prod-variables]
318318
if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
@@ -741,7 +741,7 @@ jobs:
741741
permissions:
742742
actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
743743
<<: *base-ci-job
744-
name: try
744+
name: try - ${{ matrix.name }}
745745
env:
746746
<<: [*shared-ci-variables, *prod-variables]
747747
if: github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'

src/tools/compiletest/src/util.rs

+2
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ pub fn dylib_env_var() -> &'static str {
156156
"DYLD_LIBRARY_PATH"
157157
} else if cfg!(target_os = "haiku") {
158158
"LIBRARY_PATH"
159+
} else if cfg!(target_os = "aix") {
160+
"LIBPATH"
159161
} else {
160162
"LD_LIBRARY_PATH"
161163
}

src/tools/tidy/src/ui_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::path::{Path, PathBuf};
99

1010
const ENTRY_LIMIT: usize = 1000;
1111
// FIXME: The following limits should be reduced eventually.
12-
const ROOT_ENTRY_LIMIT: usize = 940;
12+
const ROOT_ENTRY_LIMIT: usize = 881;
1313
const ISSUES_ENTRY_LIMIT: usize = 1978;
1414

1515
fn check_entries(tests_path: &Path, bad: &mut bool) {

tests/ui/autoref-autoderef/issue-38940.rs

-52
This file was deleted.

tests/ui/autoref-autoderef/issue-38940.stderr

-23
This file was deleted.

0 commit comments

Comments
 (0)