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
This commit is contained in:
bors 2023-04-03 07:27:58 +00:00
commit 932c173ca1
74 changed files with 119 additions and 97 deletions

View File

@ -34,7 +34,7 @@ jobs:
pr:
permissions:
actions: write
name: PR
name: "PR - ${{ matrix.name }}"
env:
CI_JOB_NAME: "${{ matrix.name }}"
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
@ -159,7 +159,7 @@ jobs:
auto:
permissions:
actions: write
name: auto
name: "auto - ${{ matrix.name }}"
env:
CI_JOB_NAME: "${{ matrix.name }}"
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
@ -578,7 +578,7 @@ jobs:
try:
permissions:
actions: write
name: try
name: "try - ${{ matrix.name }}"
env:
CI_JOB_NAME: "${{ matrix.name }}"
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

View File

@ -16,6 +16,10 @@ middle_limit_invalid =
`limit` must be a non-negative integer
.label = {$error_str}
middle_recursion_limit_reached =
reached the recursion limit finding the struct tail for `{$ty}`
.help = consider increasing the recursion limit by adding a `#![recursion_limit = "{$suggested_limit}"]`
middle_const_eval_non_int =
constant evaluation of enum discriminant resulted in non-integer

View File

@ -49,6 +49,14 @@ pub struct LimitInvalid<'a> {
pub error_str: &'a str,
}
#[derive(Diagnostic)]
#[diag(middle_recursion_limit_reached)]
#[help]
pub struct RecursionLimitReached<'tcx> {
pub ty: Ty<'tcx>,
pub suggested_limit: rustc_session::Limit,
}
#[derive(Diagnostic)]
#[diag(middle_const_eval_non_int)]
pub struct ConstEvalNonIntError {

View File

@ -19,7 +19,8 @@ use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_index::bit_set::GrowableBitSet;
use rustc_index::vec::{Idx, IndexVec};
use rustc_macros::HashStable;
use rustc_span::{sym, DUMMY_SP};
use rustc_session::Limit;
use rustc_span::sym;
use rustc_target::abi::{Integer, IntegerType, Size, TargetDataLayout};
use rustc_target::spec::abi::Abi;
use smallvec::SmallVec;
@ -225,10 +226,13 @@ impl<'tcx> TyCtxt<'tcx> {
let recursion_limit = self.recursion_limit();
for iteration in 0.. {
if !recursion_limit.value_within_limit(iteration) {
return self.ty_error_with_message(
DUMMY_SP,
&format!("reached the recursion limit finding the struct tail for {}", ty),
);
let suggested_limit = match recursion_limit {
Limit(0) => Limit(2),
limit => limit * 2,
};
let reported =
self.sess.emit_err(crate::error::RecursionLimitReached { ty, suggested_limit });
return self.ty_error(reported);
}
match *ty.kind() {
ty::Adt(def, substs) => {

View File

@ -1,7 +1,7 @@
#![allow(dead_code)]
use crate::cmp;
use crate::io::{self, IoSlice, IoSliceMut};
use crate::io::{self, BorrowedBuf, BorrowedCursor, IoSlice, IoSliceMut};
use crate::mem;
use crate::net::{Shutdown, SocketAddr};
use crate::os::hermit::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, RawFd};
@ -146,18 +146,35 @@ impl Socket {
Ok(Socket(unsafe { FileDesc::from_raw_fd(fd) }))
}
fn recv_with_flags(&self, buf: &mut [u8], flags: i32) -> io::Result<usize> {
let ret =
cvt(unsafe { netc::recv(self.0.as_raw_fd(), buf.as_mut_ptr(), buf.len(), flags) })?;
Ok(ret as usize)
fn recv_with_flags(&self, mut buf: BorrowedCursor<'_>, flags: i32) -> io::Result<()> {
let ret = cvt(unsafe {
netc::recv(
self.0.as_raw_fd(),
buf.as_mut().as_mut_ptr() as *mut u8,
buf.capacity(),
flags,
)
})?;
unsafe {
buf.advance(ret as usize);
}
Ok(())
}
pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
self.recv_with_flags(buf, 0)
let mut buf = BorrowedBuf::from(buf);
self.recv_with_flags(buf.unfilled(), 0)?;
Ok(buf.len())
}
pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
self.recv_with_flags(buf, netc::MSG_PEEK)
let mut buf = BorrowedBuf::from(buf);
self.recv_with_flags(buf.unfilled(), netc::MSG_PEEK)?;
Ok(buf.len())
}
pub fn read_buf(&self, buf: BorrowedCursor<'_>) -> io::Result<()> {
self.recv_with_flags(buf, 0)
}
pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {

View File

@ -741,6 +741,9 @@ class RustBuild(object):
env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
(os.pathsep + env["LIBRARY_PATH"]) \
if "LIBRARY_PATH" in env else ""
env["LIBPATH"] = os.path.join(self.bin_root(), "lib") + \
(os.pathsep + env["LIBPATH"]) \
if "LIBPATH" in env else ""
# Export Stage0 snapshot compiler related env variables
build_section = "target.{}".format(self.build)

View File

@ -20,7 +20,7 @@ use serde_derive::Deserialize;
use crate::builder::crate_description;
use crate::builder::Cargo;
use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
use crate::builder::{Builder, Kind, PathSet, RunConfig, ShouldRun, Step, TaskPath};
use crate::cache::{Interned, INTERNER};
use crate::config::{LlvmLibunwind, RustcLto, TargetSelection};
use crate::dist;
@ -995,6 +995,44 @@ pub struct CodegenBackend {
pub backend: Interned<String>,
}
fn needs_codegen_config(run: &RunConfig<'_>) -> bool {
let mut needs_codegen_cfg = false;
for path_set in &run.paths {
needs_codegen_cfg = match path_set {
PathSet::Set(set) => set.iter().any(|p| is_codegen_cfg_needed(p, run)),
PathSet::Suite(suite) => is_codegen_cfg_needed(&suite, run),
}
}
needs_codegen_cfg
}
const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_";
fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
if path.path.to_str().unwrap().contains(&CODEGEN_BACKEND_PREFIX) {
let mut needs_codegen_backend_config = true;
for &backend in &run.builder.config.rust_codegen_backends {
if path
.path
.to_str()
.unwrap()
.ends_with(&(CODEGEN_BACKEND_PREFIX.to_owned() + &backend))
{
needs_codegen_backend_config = false;
}
}
if needs_codegen_backend_config {
run.builder.info(
"Warning: no codegen-backends config matched the requested path to build a codegen backend. \
Help: add backend to codegen-backends in config.toml.",
);
return true;
}
}
return false;
}
impl Step for CodegenBackend {
type Output = ();
const ONLY_HOSTS: bool = true;
@ -1006,6 +1044,10 @@ impl Step for CodegenBackend {
}
fn make_run(run: RunConfig<'_>) {
if needs_codegen_config(&run) {
return;
}
for &backend in &run.builder.config.rust_codegen_backends {
if backend == "llvm" {
continue; // Already built as part of rustc

View File

@ -12,6 +12,8 @@ pub fn dylib_path_var() -> &'static str {
"DYLD_LIBRARY_PATH"
} else if cfg!(target_os = "haiku") {
"LIBRARY_PATH"
} else if cfg!(target_os = "aix") {
"LIBPATH"
} else {
"LD_LIBRARY_PATH"
}

View File

@ -11,7 +11,7 @@ use serde_derive::{Deserialize, Serialize};
use std::cell::RefCell;
use std::fs::File;
use std::io::BufWriter;
use std::time::{Duration, Instant};
use std::time::{Duration, Instant, SystemTime};
use sysinfo::{CpuExt, System, SystemExt};
pub(crate) struct BuildMetrics {
@ -27,6 +27,7 @@ impl BuildMetrics {
system_info: System::new(),
timer_start: None,
invocation_timer_start: Instant::now(),
invocation_start: SystemTime::now(),
});
BuildMetrics { state }
@ -124,6 +125,11 @@ impl BuildMetrics {
}
};
invocations.push(JsonInvocation {
start_time: state
.invocation_start
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap()
.as_secs(),
duration_including_children_sec: state.invocation_timer_start.elapsed().as_secs_f64(),
children: steps.into_iter().map(|step| self.prepare_json_step(step)).collect(),
});
@ -166,6 +172,7 @@ struct MetricsState {
system_info: System,
timer_start: Option<Instant>,
invocation_timer_start: Instant,
invocation_start: SystemTime,
}
struct StepMetrics {
@ -194,6 +201,10 @@ struct JsonRoot {
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
struct JsonInvocation {
// Unix timestamp in seconds
//
// This is necessary to easily correlate this invocation with logs or other data.
start_time: u64,
duration_including_children_sec: f64,
children: Vec<JsonNode>,
}

View File

@ -284,7 +284,7 @@ jobs:
permissions:
actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
<<: *base-ci-job
name: PR
name: PR - ${{ matrix.name }}
env:
<<: [*shared-ci-variables, *public-variables]
if: github.event_name == 'pull_request'
@ -312,7 +312,7 @@ jobs:
permissions:
actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
<<: *base-ci-job
name: auto
name: auto - ${{ matrix.name }}
env:
<<: [*shared-ci-variables, *prod-variables]
if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
@ -741,7 +741,7 @@ jobs:
permissions:
actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
<<: *base-ci-job
name: try
name: try - ${{ matrix.name }}
env:
<<: [*shared-ci-variables, *prod-variables]
if: github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'

View File

@ -156,6 +156,8 @@ pub fn dylib_env_var() -> &'static str {
"DYLD_LIBRARY_PATH"
} else if cfg!(target_os = "haiku") {
"LIBRARY_PATH"
} else if cfg!(target_os = "aix") {
"LIBPATH"
} else {
"LD_LIBRARY_PATH"
}

View File

@ -9,7 +9,7 @@ use std::path::{Path, PathBuf};
const ENTRY_LIMIT: usize = 1000;
// FIXME: The following limits should be reduced eventually.
const ROOT_ENTRY_LIMIT: usize = 940;
const ROOT_ENTRY_LIMIT: usize = 881;
const ISSUES_ENTRY_LIMIT: usize = 1978;
fn check_entries(tests_path: &Path, bad: &mut bool) {

View File

@ -1,52 +0,0 @@
// issue-38940: error printed twice for deref recursion limit exceeded
// Test that the recursion limit can be changed. In this case, we have
// deeply nested types that will fail the `Send` check by overflow
// when the recursion limit is set very low.
// compile-flags: -Zdeduplicate-diagnostics=yes
#![allow(dead_code)]
#![recursion_limit = "10"]
macro_rules! link {
($outer:ident, $inner:ident) => {
struct $outer($inner);
impl $outer {
fn new() -> $outer {
$outer($inner::new())
}
}
impl std::ops::Deref for $outer {
type Target = $inner;
fn deref(&self) -> &$inner {
&self.0
}
}
};
}
struct Bottom;
impl Bottom {
fn new() -> Bottom {
Bottom
}
}
link!(Top, A);
link!(A, B);
link!(B, C);
link!(C, D);
link!(D, E);
link!(E, F);
link!(F, G);
link!(G, H);
link!(H, I);
link!(I, J);
link!(J, K);
link!(K, Bottom);
fn main() {
let t = Top::new();
let x: &Bottom = &t;
//~^ ERROR mismatched types
//~| ERROR reached the recursion limit while auto-dereferencing `J`
}

View File

@ -1,23 +0,0 @@
error[E0055]: reached the recursion limit while auto-dereferencing `J`
--> $DIR/issue-38940.rs:49:22
|
LL | let x: &Bottom = &t;
| ^^ deref recursion limit reached
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`issue_38940`)
error[E0308]: mismatched types
--> $DIR/issue-38940.rs:49:22
|
LL | let x: &Bottom = &t;
| ------- ^^ expected `&Bottom`, found `&Top`
| |
| expected due to this
|
= note: expected reference `&Bottom`
found reference `&Top`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0055, E0308.
For more information about an error, try `rustc --explain E0055`.

View File

@ -1,3 +1,7 @@
error: reached the recursion limit finding the struct tail for `Bottom`
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]`
error[E0055]: reached the recursion limit while auto-dereferencing `J`
--> $DIR/recursion_limit_deref.rs:51:22
|
@ -17,7 +21,7 @@ LL | let x: &Bottom = &t;
= note: expected reference `&Bottom`
found reference `&Top`
error: aborting due to 2 previous errors
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0055, E0308.
For more information about an error, try `rustc --explain E0055`.