Auto merge of #137231 - Urgau:rollup-heiq934, r=Urgau
Rollup of 9 pull requests Successful merges: - #136750 (Make ub_check message clear that it's not an assert) - #137151 (Install more signal stack trace handlers) - #137167 (tests: Also gate `f16::erfc()` doctest with `reliable_f16_math` cfg) - #137195 (cg_clif: use exclusively ABI alignment) - #137202 (Enforce T: Hash for Interned<...>) - #137205 (Remove `std::os::wasi::fs::FileExt::tell`) - #137211 (don't ICE for alias-relate goals with error term) - #137214 (add last std diagnostic items for clippy) - #137221 (Remove scrutinee_hir_id from ExprKind::Match) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
827a0d638d
20 changed files with 134 additions and 35 deletions
|
|
@ -65,7 +65,7 @@ pub(super) fn add_locals_header_comment(fx: &mut FunctionCx<'_, '_, '_>) {
|
||||||
if fx.clif_comments.enabled() {
|
if fx.clif_comments.enabled() {
|
||||||
fx.add_global_comment(String::new());
|
fx.add_global_comment(String::new());
|
||||||
fx.add_global_comment(
|
fx.add_global_comment(
|
||||||
"kind local ty size align (abi,pref)".to_string(),
|
"kind local ty size align (abi)".to_string(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -84,14 +84,13 @@ pub(super) fn add_local_place_comments<'tcx>(
|
||||||
let (kind, extra) = place.debug_comment();
|
let (kind, extra) = place.debug_comment();
|
||||||
|
|
||||||
fx.add_global_comment(format!(
|
fx.add_global_comment(format!(
|
||||||
"{:<5} {:5} {:30} {:4}b {}, {}{}{}",
|
"{:<5} {:5} {:30} {:4}b {}{}{}",
|
||||||
kind,
|
kind,
|
||||||
format!("{:?}", local),
|
format!("{:?}", local),
|
||||||
format!("{:?}", ty),
|
format!("{:?}", ty),
|
||||||
size.bytes(),
|
size.bytes(),
|
||||||
align.abi.bytes(),
|
align.abi.bytes(),
|
||||||
align.pref.bytes(),
|
if extra.is_empty() { "" } else { " " },
|
||||||
if extra.is_empty() { "" } else { " " },
|
|
||||||
extra,
|
extra,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,7 @@ fn data_id_for_static(
|
||||||
.layout_of(ty::TypingEnv::fully_monomorphized().as_query_input(ty))
|
.layout_of(ty::TypingEnv::fully_monomorphized().as_query_input(ty))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.align
|
.align
|
||||||
.pref
|
.abi
|
||||||
.bytes();
|
.bytes();
|
||||||
|
|
||||||
let linkage = if import_linkage == rustc_middle::mir::mono::Linkage::ExternalWeak
|
let linkage = if import_linkage == rustc_middle::mir::mono::Linkage::ExternalWeak
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,10 @@ impl<'a, T: Ord> Ord for Interned<'a, T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Hash for Interned<'a, T> {
|
impl<'a, T> Hash for Interned<'a, T>
|
||||||
|
where
|
||||||
|
T: Hash,
|
||||||
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn hash<H: Hasher>(&self, s: &mut H) {
|
fn hash<H: Hasher>(&self, s: &mut H) {
|
||||||
// Pointer hashing is sufficient, due to the uniqueness constraint.
|
// Pointer hashing is sufficient, due to the uniqueness constraint.
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,15 @@ use std::{fmt, mem, ptr, slice};
|
||||||
|
|
||||||
use rustc_interface::util::{DEFAULT_STACK_SIZE, STACK_SIZE};
|
use rustc_interface::util::{DEFAULT_STACK_SIZE, STACK_SIZE};
|
||||||
|
|
||||||
|
/// Signals that represent that we have a bug, and our prompt termination has
|
||||||
|
/// been ordered.
|
||||||
|
#[rustfmt::skip]
|
||||||
|
const KILL_SIGNALS: [(libc::c_int, &str); 3] = [
|
||||||
|
(libc::SIGILL, "SIGILL"),
|
||||||
|
(libc::SIGBUS, "SIGBUS"),
|
||||||
|
(libc::SIGSEGV, "SIGSEGV")
|
||||||
|
];
|
||||||
|
|
||||||
unsafe extern "C" {
|
unsafe extern "C" {
|
||||||
fn backtrace_symbols_fd(buffer: *const *mut libc::c_void, size: libc::c_int, fd: libc::c_int);
|
fn backtrace_symbols_fd(buffer: *const *mut libc::c_void, size: libc::c_int, fd: libc::c_int);
|
||||||
}
|
}
|
||||||
|
|
@ -39,8 +48,19 @@ macro raw_errln($tokens:tt) {
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// Caller must ensure that this function is not re-entered.
|
/// Caller must ensure that this function is not re-entered.
|
||||||
unsafe extern "C" fn print_stack_trace(_: libc::c_int) {
|
unsafe extern "C" fn print_stack_trace(signum: libc::c_int) {
|
||||||
const MAX_FRAMES: usize = 256;
|
const MAX_FRAMES: usize = 256;
|
||||||
|
|
||||||
|
let signame = {
|
||||||
|
let mut signame = "<unknown>";
|
||||||
|
for sig in KILL_SIGNALS {
|
||||||
|
if sig.0 == signum {
|
||||||
|
signame = sig.1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
signame
|
||||||
|
};
|
||||||
|
|
||||||
let stack = unsafe {
|
let stack = unsafe {
|
||||||
// Reserve data segment so we don't have to malloc in a signal handler, which might fail
|
// Reserve data segment so we don't have to malloc in a signal handler, which might fail
|
||||||
// in incredibly undesirable and unexpected ways due to e.g. the allocator deadlocking
|
// in incredibly undesirable and unexpected ways due to e.g. the allocator deadlocking
|
||||||
|
|
@ -54,7 +74,8 @@ unsafe extern "C" fn print_stack_trace(_: libc::c_int) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Just a stack trace is cryptic. Explain what we're doing.
|
// Just a stack trace is cryptic. Explain what we're doing.
|
||||||
raw_errln!("error: rustc interrupted by SIGSEGV, printing backtrace\n");
|
raw_errln!("error: rustc interrupted by {signame}, printing backtrace\n");
|
||||||
|
|
||||||
let mut written = 1;
|
let mut written = 1;
|
||||||
let mut consumed = 0;
|
let mut consumed = 0;
|
||||||
// Begin elaborating return addrs into symbols and writing them directly to stderr
|
// Begin elaborating return addrs into symbols and writing them directly to stderr
|
||||||
|
|
@ -94,7 +115,7 @@ unsafe extern "C" fn print_stack_trace(_: libc::c_int) {
|
||||||
written += rem.len() + 1;
|
written += rem.len() + 1;
|
||||||
|
|
||||||
let random_depth = || 8 * 16; // chosen by random diceroll (2d20)
|
let random_depth = || 8 * 16; // chosen by random diceroll (2d20)
|
||||||
if cyclic || stack.len() > random_depth() {
|
if (cyclic || stack.len() > random_depth()) && signum == libc::SIGSEGV {
|
||||||
// technically speculation, but assert it with confidence anyway.
|
// technically speculation, but assert it with confidence anyway.
|
||||||
// rustc only arrived in this signal handler because bad things happened
|
// rustc only arrived in this signal handler because bad things happened
|
||||||
// and this message is for explaining it's not the programmer's fault
|
// and this message is for explaining it's not the programmer's fault
|
||||||
|
|
@ -106,17 +127,22 @@ unsafe extern "C" fn print_stack_trace(_: libc::c_int) {
|
||||||
written += 1;
|
written += 1;
|
||||||
}
|
}
|
||||||
raw_errln!("note: we would appreciate a report at https://github.com/rust-lang/rust");
|
raw_errln!("note: we would appreciate a report at https://github.com/rust-lang/rust");
|
||||||
// get the current stack size WITHOUT blocking and double it
|
written += 1;
|
||||||
let new_size = STACK_SIZE.get().copied().unwrap_or(DEFAULT_STACK_SIZE) * 2;
|
if signum == libc::SIGSEGV {
|
||||||
raw_errln!("help: you can increase rustc's stack size by setting RUST_MIN_STACK={new_size}");
|
// get the current stack size WITHOUT blocking and double it
|
||||||
written += 2;
|
let new_size = STACK_SIZE.get().copied().unwrap_or(DEFAULT_STACK_SIZE) * 2;
|
||||||
|
raw_errln!(
|
||||||
|
"help: you can increase rustc's stack size by setting RUST_MIN_STACK={new_size}"
|
||||||
|
);
|
||||||
|
written += 1;
|
||||||
|
}
|
||||||
if written > 24 {
|
if written > 24 {
|
||||||
// We probably just scrolled the earlier "we got SIGSEGV" message off the terminal
|
// We probably just scrolled the earlier "interrupted by {signame}" message off the terminal
|
||||||
raw_errln!("note: backtrace dumped due to SIGSEGV! resuming signal");
|
raw_errln!("note: backtrace dumped due to {signame}! resuming signal");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// When SIGSEGV is delivered to the process, print a stack trace and then exit.
|
/// When one of the KILL signals is delivered to the process, print a stack trace and then exit.
|
||||||
pub(super) fn install() {
|
pub(super) fn install() {
|
||||||
unsafe {
|
unsafe {
|
||||||
let alt_stack_size: usize = min_sigstack_size() + 64 * 1024;
|
let alt_stack_size: usize = min_sigstack_size() + 64 * 1024;
|
||||||
|
|
@ -129,7 +155,9 @@ pub(super) fn install() {
|
||||||
sa.sa_sigaction = print_stack_trace as libc::sighandler_t;
|
sa.sa_sigaction = print_stack_trace as libc::sighandler_t;
|
||||||
sa.sa_flags = libc::SA_NODEFER | libc::SA_RESETHAND | libc::SA_ONSTACK;
|
sa.sa_flags = libc::SA_NODEFER | libc::SA_RESETHAND | libc::SA_ONSTACK;
|
||||||
libc::sigemptyset(&mut sa.sa_mask);
|
libc::sigemptyset(&mut sa.sa_mask);
|
||||||
libc::sigaction(libc::SIGSEGV, &sa, ptr::null_mut());
|
for (signum, _signame) in KILL_SIGNALS {
|
||||||
|
libc::sigaction(signum, &sa, ptr::null_mut());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,6 @@ pub enum ExprKind<'tcx> {
|
||||||
/// A `match` expression.
|
/// A `match` expression.
|
||||||
Match {
|
Match {
|
||||||
scrutinee: ExprId,
|
scrutinee: ExprId,
|
||||||
scrutinee_hir_id: HirId,
|
|
||||||
arms: Box<[ArmId]>,
|
arms: Box<[ArmId]>,
|
||||||
match_source: MatchSource,
|
match_source: MatchSource,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -828,7 +828,6 @@ impl<'tcx> ThirBuildCx<'tcx> {
|
||||||
},
|
},
|
||||||
hir::ExprKind::Match(discr, arms, match_source) => ExprKind::Match {
|
hir::ExprKind::Match(discr, arms, match_source) => ExprKind::Match {
|
||||||
scrutinee: self.mirror_expr(discr),
|
scrutinee: self.mirror_expr(discr),
|
||||||
scrutinee_hir_id: discr.hir_id,
|
|
||||||
arms: arms.iter().map(|a| self.convert_arm(a)).collect(),
|
arms: arms.iter().map(|a| self.convert_arm(a)).collect(),
|
||||||
match_source,
|
match_source,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ impl<'p, 'tcx> Visitor<'p, 'tcx> for MatchVisitor<'p, 'tcx> {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ExprKind::Match { scrutinee, scrutinee_hir_id: _, box ref arms, match_source } => {
|
ExprKind::Match { scrutinee, box ref arms, match_source } => {
|
||||||
self.check_match(scrutinee, arms, match_source, ex.span);
|
self.check_match(scrutinee, arms, match_source, ex.span);
|
||||||
}
|
}
|
||||||
ExprKind::Let { box ref pat, expr } => {
|
ExprKind::Let { box ref pat, expr } => {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,17 @@ where
|
||||||
) -> QueryResult<I> {
|
) -> QueryResult<I> {
|
||||||
let cx = self.cx();
|
let cx = self.cx();
|
||||||
let Goal { param_env, predicate: (lhs, rhs, direction) } = goal;
|
let Goal { param_env, predicate: (lhs, rhs, direction) } = goal;
|
||||||
debug_assert!(lhs.to_alias_term().is_some() || rhs.to_alias_term().is_some());
|
|
||||||
|
// Check that the alias-relate goal is reasonable. Writeback for
|
||||||
|
// `coroutine_stalled_predicates` can replace alias terms with
|
||||||
|
// `{type error}` if the alias still contains infer vars, so we also
|
||||||
|
// accept alias-relate goals where one of the terms is an error.
|
||||||
|
debug_assert!(
|
||||||
|
lhs.to_alias_term().is_some()
|
||||||
|
|| rhs.to_alias_term().is_some()
|
||||||
|
|| lhs.is_error()
|
||||||
|
|| rhs.is_error()
|
||||||
|
);
|
||||||
|
|
||||||
// Structurally normalize the lhs.
|
// Structurally normalize the lhs.
|
||||||
let lhs = if let Some(alias) = lhs.to_alias_term() {
|
let lhs = if let Some(alias) = lhs.to_alias_term() {
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,19 @@ pub(crate) struct ImportData<'ra> {
|
||||||
/// so we can use referential equality to compare them.
|
/// so we can use referential equality to compare them.
|
||||||
pub(crate) type Import<'ra> = Interned<'ra, ImportData<'ra>>;
|
pub(crate) type Import<'ra> = Interned<'ra, ImportData<'ra>>;
|
||||||
|
|
||||||
|
// Allows us to use Interned without actually enforcing (via Hash/PartialEq/...) uniqueness of the
|
||||||
|
// contained data.
|
||||||
|
// FIXME: We may wish to actually have at least debug-level assertions that Interned's guarantees
|
||||||
|
// are upheld.
|
||||||
|
impl std::hash::Hash for ImportData<'_> {
|
||||||
|
fn hash<H>(&self, _: &mut H)
|
||||||
|
where
|
||||||
|
H: std::hash::Hasher,
|
||||||
|
{
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'ra> ImportData<'ra> {
|
impl<'ra> ImportData<'ra> {
|
||||||
pub(crate) fn is_glob(&self) -> bool {
|
pub(crate) fn is_glob(&self) -> bool {
|
||||||
matches!(self.kind, ImportKind::Glob { .. })
|
matches!(self.kind, ImportKind::Glob { .. })
|
||||||
|
|
|
||||||
|
|
@ -589,6 +589,19 @@ struct ModuleData<'ra> {
|
||||||
#[rustc_pass_by_value]
|
#[rustc_pass_by_value]
|
||||||
struct Module<'ra>(Interned<'ra, ModuleData<'ra>>);
|
struct Module<'ra>(Interned<'ra, ModuleData<'ra>>);
|
||||||
|
|
||||||
|
// Allows us to use Interned without actually enforcing (via Hash/PartialEq/...) uniqueness of the
|
||||||
|
// contained data.
|
||||||
|
// FIXME: We may wish to actually have at least debug-level assertions that Interned's guarantees
|
||||||
|
// are upheld.
|
||||||
|
impl std::hash::Hash for ModuleData<'_> {
|
||||||
|
fn hash<H>(&self, _: &mut H)
|
||||||
|
where
|
||||||
|
H: std::hash::Hasher,
|
||||||
|
{
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'ra> ModuleData<'ra> {
|
impl<'ra> ModuleData<'ra> {
|
||||||
fn new(
|
fn new(
|
||||||
parent: Option<Module<'ra>>,
|
parent: Option<Module<'ra>>,
|
||||||
|
|
@ -739,6 +752,19 @@ struct NameBindingData<'ra> {
|
||||||
/// so we can use referential equality to compare them.
|
/// so we can use referential equality to compare them.
|
||||||
type NameBinding<'ra> = Interned<'ra, NameBindingData<'ra>>;
|
type NameBinding<'ra> = Interned<'ra, NameBindingData<'ra>>;
|
||||||
|
|
||||||
|
// Allows us to use Interned without actually enforcing (via Hash/PartialEq/...) uniqueness of the
|
||||||
|
// contained data.
|
||||||
|
// FIXME: We may wish to actually have at least debug-level assertions that Interned's guarantees
|
||||||
|
// are upheld.
|
||||||
|
impl std::hash::Hash for NameBindingData<'_> {
|
||||||
|
fn hash<H>(&self, _: &mut H)
|
||||||
|
where
|
||||||
|
H: std::hash::Hasher,
|
||||||
|
{
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
trait ToNameBinding<'ra> {
|
trait ToNameBinding<'ra> {
|
||||||
fn to_name_binding(self, arenas: &'ra ResolverArenas<'ra>) -> NameBinding<'ra>;
|
fn to_name_binding(self, arenas: &'ra ResolverArenas<'ra>) -> NameBinding<'ra>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,7 @@ symbols! {
|
||||||
Capture,
|
Capture,
|
||||||
Cell,
|
Cell,
|
||||||
Center,
|
Center,
|
||||||
|
Child,
|
||||||
Cleanup,
|
Cleanup,
|
||||||
Clone,
|
Clone,
|
||||||
CoercePointee,
|
CoercePointee,
|
||||||
|
|
@ -336,6 +337,7 @@ symbols! {
|
||||||
SliceIter,
|
SliceIter,
|
||||||
Some,
|
Some,
|
||||||
SpanCtxt,
|
SpanCtxt,
|
||||||
|
Stdin,
|
||||||
String,
|
String,
|
||||||
StructuralPartialEq,
|
StructuralPartialEq,
|
||||||
SubdiagMessage,
|
SubdiagMessage,
|
||||||
|
|
@ -599,6 +601,9 @@ symbols! {
|
||||||
cfi,
|
cfi,
|
||||||
cfi_encoding,
|
cfi_encoding,
|
||||||
char,
|
char,
|
||||||
|
char_is_ascii,
|
||||||
|
child_id,
|
||||||
|
child_kill,
|
||||||
client,
|
client,
|
||||||
clippy,
|
clippy,
|
||||||
clobber_abi,
|
clobber_abi,
|
||||||
|
|
@ -1468,6 +1473,7 @@ symbols! {
|
||||||
panic_2015,
|
panic_2015,
|
||||||
panic_2021,
|
panic_2021,
|
||||||
panic_abort,
|
panic_abort,
|
||||||
|
panic_any,
|
||||||
panic_bounds_check,
|
panic_bounds_check,
|
||||||
panic_cannot_unwind,
|
panic_cannot_unwind,
|
||||||
panic_const_add_overflow,
|
panic_const_add_overflow,
|
||||||
|
|
@ -1573,6 +1579,7 @@ symbols! {
|
||||||
proc_macro_mod,
|
proc_macro_mod,
|
||||||
proc_macro_non_items,
|
proc_macro_non_items,
|
||||||
proc_macro_path_invoc,
|
proc_macro_path_invoc,
|
||||||
|
process_abort,
|
||||||
process_exit,
|
process_exit,
|
||||||
profiler_builtins,
|
profiler_builtins,
|
||||||
profiler_runtime,
|
profiler_runtime,
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,10 @@ pub trait Ty<I: Interner<Ty = Self>>:
|
||||||
matches!(self.kind(), ty::Infer(ty::TyVar(_)))
|
matches!(self.kind(), ty::Infer(ty::TyVar(_)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_ty_error(self) -> bool {
|
||||||
|
matches!(self.kind(), ty::Error(_))
|
||||||
|
}
|
||||||
|
|
||||||
fn is_floating_point(self) -> bool {
|
fn is_floating_point(self) -> bool {
|
||||||
matches!(self.kind(), ty::Float(_) | ty::Infer(ty::FloatVar(_)))
|
matches!(self.kind(), ty::Float(_) | ty::Infer(ty::FloatVar(_)))
|
||||||
}
|
}
|
||||||
|
|
@ -284,6 +288,10 @@ pub trait Const<I: Interner<Const = Self>>:
|
||||||
fn is_ct_var(self) -> bool {
|
fn is_ct_var(self) -> bool {
|
||||||
matches!(self.kind(), ty::ConstKind::Infer(ty::InferConst::Var(_)))
|
matches!(self.kind(), ty::ConstKind::Infer(ty::InferConst::Var(_)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_ct_error(self) -> bool {
|
||||||
|
matches!(self.kind(), ty::ConstKind::Error(_))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ValueConst<I: Interner<ValueConst = Self>>: Copy + Debug + Hash + Eq {
|
pub trait ValueConst<I: Interner<ValueConst = Self>>: Copy + Debug + Hash + Eq {
|
||||||
|
|
@ -370,6 +378,13 @@ pub trait Term<I: Interner<Term = Self>>:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_error(self) -> bool {
|
||||||
|
match self.kind() {
|
||||||
|
ty::TermKind::Ty(ty) => ty.is_ty_error(),
|
||||||
|
ty::TermKind::Const(ct) => ct.is_ct_error(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn to_alias_term(self) -> Option<ty::AliasTerm<I>> {
|
fn to_alias_term(self) -> Option<ty::AliasTerm<I>> {
|
||||||
match self.kind() {
|
match self.kind() {
|
||||||
ty::TermKind::Ty(ty) => match ty.kind() {
|
ty::TermKind::Ty(ty) => match ty.kind() {
|
||||||
|
|
|
||||||
|
|
@ -1168,6 +1168,7 @@ impl char {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
|
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
|
||||||
#[rustc_const_stable(feature = "const_char_is_ascii", since = "1.32.0")]
|
#[rustc_const_stable(feature = "const_char_is_ascii", since = "1.32.0")]
|
||||||
|
#[cfg_attr(not(test), rustc_diagnostic_item = "char_is_ascii")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn is_ascii(&self) -> bool {
|
pub const fn is_ascii(&self) -> bool {
|
||||||
*self as u32 <= 0x7F
|
*self as u32 <= 0x7F
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,9 @@ macro_rules! assert_unsafe_precondition {
|
||||||
#[rustc_nounwind]
|
#[rustc_nounwind]
|
||||||
const fn precondition_check($($name:$ty),*) {
|
const fn precondition_check($($name:$ty),*) {
|
||||||
if !$e {
|
if !$e {
|
||||||
::core::panicking::panic_nounwind(
|
::core::panicking::panic_nounwind(concat!("unsafe precondition(s) violated: ", $message,
|
||||||
concat!("unsafe precondition(s) violated: ", $message)
|
"\n\nThis indicates a bug in the program. \
|
||||||
);
|
This Undefined Behavior check is optional, and cannot be relied on for safety."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1321,12 +1321,14 @@ impl f16 {
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(f16)]
|
/// #![feature(f16)]
|
||||||
/// #![feature(float_erf)]
|
/// #![feature(float_erf)]
|
||||||
|
/// # #[cfg(reliable_f16_math)] {
|
||||||
/// let x: f16 = 0.123;
|
/// let x: f16 = 0.123;
|
||||||
///
|
///
|
||||||
/// let one = x.erf() + x.erfc();
|
/// let one = x.erf() + x.erfc();
|
||||||
/// let abs_difference = (one - 1.0).abs();
|
/// let abs_difference = (one - 1.0).abs();
|
||||||
///
|
///
|
||||||
/// assert!(abs_difference <= f16::EPSILON);
|
/// assert!(abs_difference <= f16::EPSILON);
|
||||||
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
#[rustc_allow_incoherent_impl]
|
#[rustc_allow_incoherent_impl]
|
||||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||||
|
|
|
||||||
|
|
@ -239,6 +239,7 @@ fn handle_ebadf_lazy<T>(r: io::Result<T>, default: impl FnOnce() -> T) -> io::Re
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
#[cfg_attr(not(test), rustc_diagnostic_item = "Stdin")]
|
||||||
pub struct Stdin {
|
pub struct Stdin {
|
||||||
inner: &'static Mutex<BufReader<StdinRaw>>,
|
inner: &'static Mutex<BufReader<StdinRaw>>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -162,13 +162,6 @@ pub trait FileExt {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the current position within the file.
|
|
||||||
///
|
|
||||||
/// This corresponds to the `fd_tell` syscall and is similar to
|
|
||||||
/// `seek` where you offset 0 bytes from the current position.
|
|
||||||
#[doc(alias = "fd_tell")]
|
|
||||||
fn tell(&self) -> io::Result<u64>;
|
|
||||||
|
|
||||||
/// Adjusts the flags associated with this file.
|
/// Adjusts the flags associated with this file.
|
||||||
///
|
///
|
||||||
/// This corresponds to the `fd_fdstat_set_flags` syscall.
|
/// This corresponds to the `fd_fdstat_set_flags` syscall.
|
||||||
|
|
@ -240,10 +233,6 @@ impl FileExt for fs::File {
|
||||||
self.as_inner().as_inner().pwrite(bufs, offset)
|
self.as_inner().as_inner().pwrite(bufs, offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tell(&self) -> io::Result<u64> {
|
|
||||||
self.as_inner().as_inner().tell()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn fdstat_set_flags(&self, flags: u16) -> io::Result<()> {
|
fn fdstat_set_flags(&self, flags: u16) -> io::Result<()> {
|
||||||
self.as_inner().as_inner().set_flags(flags)
|
self.as_inner().as_inner().set_flags(flags)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -255,6 +255,7 @@ pub use crate::panicking::{set_hook, take_hook};
|
||||||
#[stable(feature = "panic_any", since = "1.51.0")]
|
#[stable(feature = "panic_any", since = "1.51.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
|
#[cfg_attr(not(test), rustc_diagnostic_item = "panic_any")]
|
||||||
pub fn panic_any<M: 'static + Any + Send>(msg: M) -> ! {
|
pub fn panic_any<M: 'static + Any + Send>(msg: M) -> ! {
|
||||||
crate::panicking::begin_panic(msg);
|
crate::panicking::begin_panic(msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,7 @@ use crate::{fmt, fs, str};
|
||||||
///
|
///
|
||||||
/// [`wait`]: Child::wait
|
/// [`wait`]: Child::wait
|
||||||
#[stable(feature = "process", since = "1.0.0")]
|
#[stable(feature = "process", since = "1.0.0")]
|
||||||
|
#[cfg_attr(not(test), rustc_diagnostic_item = "Child")]
|
||||||
pub struct Child {
|
pub struct Child {
|
||||||
pub(crate) handle: imp::Process,
|
pub(crate) handle: imp::Process,
|
||||||
|
|
||||||
|
|
@ -2115,6 +2116,7 @@ impl Child {
|
||||||
/// [`ErrorKind`]: io::ErrorKind
|
/// [`ErrorKind`]: io::ErrorKind
|
||||||
/// [`InvalidInput`]: io::ErrorKind::InvalidInput
|
/// [`InvalidInput`]: io::ErrorKind::InvalidInput
|
||||||
#[stable(feature = "process", since = "1.0.0")]
|
#[stable(feature = "process", since = "1.0.0")]
|
||||||
|
#[cfg_attr(not(test), rustc_diagnostic_item = "child_kill")]
|
||||||
pub fn kill(&mut self) -> io::Result<()> {
|
pub fn kill(&mut self) -> io::Result<()> {
|
||||||
self.handle.kill()
|
self.handle.kill()
|
||||||
}
|
}
|
||||||
|
|
@ -2135,6 +2137,7 @@ impl Child {
|
||||||
/// ```
|
/// ```
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable(feature = "process_id", since = "1.3.0")]
|
#[stable(feature = "process_id", since = "1.3.0")]
|
||||||
|
#[cfg_attr(not(test), rustc_diagnostic_item = "child_id")]
|
||||||
pub fn id(&self) -> u32 {
|
pub fn id(&self) -> u32 {
|
||||||
self.handle.id()
|
self.handle.id()
|
||||||
}
|
}
|
||||||
|
|
@ -2375,6 +2378,7 @@ pub fn exit(code: i32) -> ! {
|
||||||
/// [panic hook]: crate::panic::set_hook
|
/// [panic hook]: crate::panic::set_hook
|
||||||
#[stable(feature = "process_abort", since = "1.17.0")]
|
#[stable(feature = "process_abort", since = "1.17.0")]
|
||||||
#[cold]
|
#[cold]
|
||||||
|
#[cfg_attr(not(test), rustc_diagnostic_item = "process_abort")]
|
||||||
pub fn abort() -> ! {
|
pub fn abort() -> ! {
|
||||||
crate::sys::abort_internal();
|
crate::sys::abort_internal();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||||
unsafe precondition(s) violated: ptr::swap_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap
|
unsafe precondition(s) violated: ptr::swap_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap
|
||||||
|
|
||||||
|
This indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.
|
||||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||||
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
|
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
|
||||||
thread caused non-unwinding panic. aborting.
|
thread caused non-unwinding panic. aborting.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue