mirror of
https://github.com/allankoechke/rust.git
synced 2026-11-30 11:05:36 +00:00
Auto merge of #163404 - JonathanBrouwer:rollup-y9SIdjJ, r=JonathanBrouwer
Rollup of 3 pull requests Successful merges: - rust-lang/rust#162714 (compiletest: stream output of executor process when --no-capture is set) - rust-lang/rust#163394 (Use StaticAllocator in more places) - rust-lang/rust#162672 (Remove some code duplication in coerce_shared.rs)
This commit is contained in:
@@ -399,29 +399,20 @@ fn validate_reborrow_field_access(
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
let module = tcx.parent_module_from_def_id(impl_did);
|
||||
let variant = def.non_enum_variant();
|
||||
if variant.field_list_has_applicable_non_exhaustive() {
|
||||
return Err(tcx.dcx().emit_err(diagnostics::CoerceSharedInaccessibleField {
|
||||
|
||||
if variant.field_list_has_applicable_non_exhaustive()
|
||||
|| variant.fields.iter().any(|f| !f.vis.is_accessible_from(module, tcx))
|
||||
{
|
||||
Err(tcx.dcx().emit_err(diagnostics::CoerceSharedInaccessibleField {
|
||||
span: diagnostic_context.impl_span,
|
||||
type_span: role.type_span(diagnostic_context),
|
||||
trait_name,
|
||||
role: role.as_str(),
|
||||
type_name: tcx.item_name(def.did()),
|
||||
}));
|
||||
}))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
for field in &variant.fields {
|
||||
if !field.vis.is_accessible_from(module, tcx) {
|
||||
return Err(tcx.dcx().emit_err(diagnostics::CoerceSharedInaccessibleField {
|
||||
span: diagnostic_context.impl_span,
|
||||
type_span: role.type_span(diagnostic_context),
|
||||
trait_name,
|
||||
role: role.as_str(),
|
||||
type_name: tcx.item_name(def.did()),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_coerce_shared_fields<'tcx>(
|
||||
|
||||
@@ -2455,7 +2455,7 @@ impl<G: ?Sized + Coroutine<R> + Unpin, R, A: Allocator> Coroutine<R> for Box<G,
|
||||
#[unstable(feature = "coroutine_trait", issue = "43122")]
|
||||
impl<G: ?Sized + Coroutine<R>, R, A: Allocator> Coroutine<R> for Pin<Box<G, A>>
|
||||
where
|
||||
A: 'static,
|
||||
A: StaticAllocator,
|
||||
{
|
||||
type Yield = G::Yield;
|
||||
type Return = G::Return;
|
||||
|
||||
@@ -266,7 +266,7 @@ use core::ptr::{self, NonNull, drop_in_place};
|
||||
use core::slice::from_raw_parts_mut;
|
||||
use core::{borrow, fmt, hint};
|
||||
|
||||
use crate::alloc::{AllocError, Allocator, AllocatorClone, Global, Layout};
|
||||
use crate::alloc::{AllocError, Allocator, AllocatorClone, Global, Layout, StaticAllocator};
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
use crate::alloc::{AllocatorNightly, handle_alloc_error};
|
||||
use crate::borrow::{Cow, ToOwned};
|
||||
@@ -953,7 +953,7 @@ impl<T, A: Allocator> Rc<T, A> {
|
||||
#[inline]
|
||||
pub fn pin_in(value: T, alloc: A) -> Pin<Self>
|
||||
where
|
||||
A: 'static,
|
||||
A: StaticAllocator,
|
||||
{
|
||||
// SAFETY: We own and create the pinned pointer.
|
||||
unsafe { Pin::new_unchecked(Rc::new_in(value, alloc)) }
|
||||
@@ -2549,11 +2549,11 @@ impl<T: ?Sized, A: Allocator> Deref for Rc<T, A> {
|
||||
// accordingly. Since this type is not fundamental, downstream crates cannot
|
||||
// provide malicious implementations of any of the traits relevant for `Pin`.
|
||||
#[unstable(feature = "pin_coerce_unsized_trait", issue = "150112")]
|
||||
unsafe impl<T: ?Sized, A: Allocator + 'static> PinSafePointer for Rc<T, A> {}
|
||||
unsafe impl<T: ?Sized, A: StaticAllocator> PinSafePointer for Rc<T, A> {}
|
||||
|
||||
//#[unstable(feature = "unique_rc_arc", issue = "112566")]
|
||||
#[unstable(feature = "pin_coerce_unsized_trait", issue = "150112")]
|
||||
unsafe impl<T: ?Sized, A: Allocator + 'static> PinSafePointer for UniqueRc<T, A> {}
|
||||
unsafe impl<T: ?Sized, A: StaticAllocator> PinSafePointer for UniqueRc<T, A> {}
|
||||
|
||||
#[unstable(feature = "deref_pure_trait", issue = "87121")]
|
||||
unsafe impl<T: ?Sized, A: Allocator> DerefPure for Rc<T, A> {}
|
||||
|
||||
@@ -33,7 +33,7 @@ use core::sync::atomic::Ordering::{Acquire, Relaxed, Release};
|
||||
use core::sync::atomic::{self, Atomic};
|
||||
use core::{borrow, fmt, hint};
|
||||
|
||||
use crate::alloc::{AllocError, Allocator, AllocatorClone, Global, Layout};
|
||||
use crate::alloc::{AllocError, Allocator, AllocatorClone, Global, Layout, StaticAllocator};
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
use crate::alloc::{AllocatorNightly, handle_alloc_error};
|
||||
use crate::borrow::{Cow, ToOwned};
|
||||
@@ -893,7 +893,7 @@ impl<T, A: Allocator> Arc<T, A> {
|
||||
#[inline]
|
||||
pub fn pin_in(data: T, alloc: A) -> Pin<Arc<T, A>>
|
||||
where
|
||||
A: 'static,
|
||||
A: StaticAllocator,
|
||||
{
|
||||
// SAFETY: We own and create the pinned pointer.
|
||||
unsafe { Pin::new_unchecked(Arc::new_in(data, alloc)) }
|
||||
@@ -905,7 +905,7 @@ impl<T, A: Allocator> Arc<T, A> {
|
||||
#[unstable(feature = "allocator_ext", issue = "163177", implied_by = "allocator_api")]
|
||||
pub fn try_pin_in(data: T, alloc: A) -> Result<Pin<Arc<T, A>>, AllocError>
|
||||
where
|
||||
A: 'static,
|
||||
A: StaticAllocator,
|
||||
{
|
||||
// SAFETY: We own and create the pinned pointer.
|
||||
unsafe { Ok(Pin::new_unchecked(Arc::try_new_in(data, alloc)?)) }
|
||||
@@ -2580,7 +2580,7 @@ impl<T: ?Sized, A: Allocator> Deref for Arc<T, A> {
|
||||
// crates cannot provide malicious implementations of any of the traits relevant
|
||||
// for `Pin`.
|
||||
#[unstable(feature = "pin_coerce_unsized_trait", issue = "150112")]
|
||||
unsafe impl<T: ?Sized, A: Allocator + 'static> PinSafePointer for Arc<T, A> {}
|
||||
unsafe impl<T: ?Sized, A: StaticAllocator> PinSafePointer for Arc<T, A> {}
|
||||
|
||||
#[unstable(feature = "deref_pure_trait", issue = "87121")]
|
||||
unsafe impl<T: ?Sized, A: Allocator> DerefPure for Arc<T, A> {}
|
||||
@@ -5127,7 +5127,7 @@ impl<T: ?Sized, A: Allocator> Deref for UniqueArc<T, A> {
|
||||
|
||||
// #[unstable(feature = "unique_rc_arc", issue = "112566")]
|
||||
#[unstable(feature = "pin_coerce_unsized_trait", issue = "150112")]
|
||||
unsafe impl<T: ?Sized, A: Allocator + 'static> PinSafePointer for UniqueArc<T, A> {}
|
||||
unsafe impl<T: ?Sized, A: StaticAllocator> PinSafePointer for UniqueArc<T, A> {}
|
||||
|
||||
#[unstable(feature = "unique_rc_arc", issue = "112566")]
|
||||
impl<T: ?Sized, A: Allocator> DerefMut for UniqueArc<T, A> {
|
||||
|
||||
@@ -7,6 +7,7 @@ use camino::{Utf8Path, Utf8PathBuf};
|
||||
|
||||
use super::{ProcRes, TestCx, disable_error_reporting};
|
||||
use crate::common::TestSuite;
|
||||
use crate::read2::Truncated;
|
||||
use crate::util::{ArgFileCommand, copy_dir_all, dylib_env_var};
|
||||
|
||||
impl TestCx<'_> {
|
||||
@@ -175,8 +176,6 @@ impl TestCx<'_> {
|
||||
|
||||
let mut cmd = Command::new(&recipe_bin);
|
||||
cmd.current_dir(&rmake_out_dir)
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
// Provide the target-specific env var that is used to record dylib search paths. For
|
||||
// example, this could be `LD_LIBRARY_PATH` on some linux distros but `PATH` on Windows.
|
||||
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
|
||||
@@ -342,16 +341,39 @@ impl TestCx<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
let proc = disable_error_reporting(|| cmd.spawn().expect("failed to spawn `rmake`"));
|
||||
let (Output { stdout, stderr, status }, truncated) = self.read2_abbreviated(proc);
|
||||
let stdout = String::from_utf8_lossy(&stdout).into_owned();
|
||||
let stderr = String::from_utf8_lossy(&stderr).into_owned();
|
||||
// This conditions on `status.success()` so we don't print output twice on error.
|
||||
// NOTE: this code is called from an executor thread, so it's hidden by default unless --no-capture is passed.
|
||||
self.dump_output(status.success(), &cmd.get_program().to_string_lossy(), &stdout, &stderr);
|
||||
if !status.success() {
|
||||
let res = ProcRes { status, stdout, stderr, truncated, cmdline: format!("{:?}", cmd) };
|
||||
self.fatal_proc_rec("rmake recipe failed to complete", &res);
|
||||
if self.config.capture {
|
||||
cmd.stdout(Stdio::piped()).stderr(Stdio::piped());
|
||||
let proc = disable_error_reporting(|| cmd.spawn().expect("failed to spawn `rmake`"));
|
||||
let (Output { stdout, stderr, status }, truncated) = self.read2_abbreviated(proc);
|
||||
let stdout = String::from_utf8_lossy(&stdout).into_owned();
|
||||
let stderr = String::from_utf8_lossy(&stderr).into_owned();
|
||||
// This conditions on `status.success()` so we don't print output twice on error.
|
||||
self.dump_output(
|
||||
status.success(),
|
||||
&cmd.get_program().to_string_lossy(),
|
||||
&stdout,
|
||||
&stderr,
|
||||
);
|
||||
if !status.success() {
|
||||
let res =
|
||||
ProcRes { status, stdout, stderr, truncated, cmdline: format!("{:?}", cmd) };
|
||||
self.fatal_proc_rec("rmake recipe failed to complete", &res);
|
||||
}
|
||||
} else {
|
||||
// When --no-capture is passed, we don't need to capture the output and just wait for the process to finish
|
||||
let mut proc =
|
||||
disable_error_reporting(|| cmd.spawn().expect("failed to spawn `rmake`"));
|
||||
let status = proc.wait().expect("failed to wait for `rmake`");
|
||||
if !status.success() {
|
||||
let res = ProcRes {
|
||||
status,
|
||||
stdout: String::new(),
|
||||
stderr: String::new(),
|
||||
truncated: Truncated::No,
|
||||
cmdline: format!("{:?}", cmd),
|
||||
};
|
||||
self.fatal_proc_rec("rmake recipe failed to complete", &res);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user