提交 afaf33dc 编写于 作者: B bors

Auto merge of #83573 - JohnTitor:rollup-28jnzsr, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #79399 (Use detailed and shorter fs error explaination)
 - #83348 (format macro argument parsing fix)
 - #83462 (ExitStatus: print "exit status: {}" rather than "exit code: {}" on unix)
 - #83526 (lazily calls some fns)
 - #83558 (Use DebugStruct::finish_non_exhaustive() in std.)
 - #83559 (Fix Debug implementation for RwLock{Read,Write}Guard.)
 - #83560 (Derive Debug for io::Chain instead of manually implementing it.)
 - #83561 (Improve Debug implementations of Mutex and RwLock.)
 - #83567 (Update rustup cross-compilation docs link)
 - #83569 (Add regression tests for #56445)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
...@@ -493,7 +493,7 @@ fn line_from_source_file( ...@@ -493,7 +493,7 @@ fn line_from_source_file(
h_end: usize, h_end: usize,
) -> DiagnosticSpanLine { ) -> DiagnosticSpanLine {
DiagnosticSpanLine { DiagnosticSpanLine {
text: sf.get_line(index).map_or(String::new(), |l| l.into_owned()), text: sf.get_line(index).map_or_else(String::new, |l| l.into_owned()),
highlight_start: h_start, highlight_start: h_start,
highlight_end: h_end, highlight_end: h_end,
} }
......
...@@ -216,9 +216,10 @@ pub fn generates_cgu_internal_copy(&self, tcx: TyCtxt<'tcx>) -> bool { ...@@ -216,9 +216,10 @@ pub fn generates_cgu_internal_copy(&self, tcx: TyCtxt<'tcx>) -> bool {
// drops of `Option::None` before LTO. We also respect the intent of // drops of `Option::None` before LTO. We also respect the intent of
// `#[inline]` on `Drop::drop` implementations. // `#[inline]` on `Drop::drop` implementations.
return ty.ty_adt_def().map_or(true, |adt_def| { return ty.ty_adt_def().map_or(true, |adt_def| {
adt_def.destructor(tcx).map_or(adt_def.is_enum(), |dtor| { adt_def.destructor(tcx).map_or_else(
tcx.codegen_fn_attrs(dtor.did).requests_inline() || adt_def.is_enum(),
}) |dtor| tcx.codegen_fn_attrs(dtor.did).requests_inline(),
)
}); });
} }
tcx.codegen_fn_attrs(self.def_id()).requests_inline() tcx.codegen_fn_attrs(self.def_id()).requests_inline()
......
...@@ -525,7 +525,7 @@ pub fn store_diagnostics_for_anon_node( ...@@ -525,7 +525,7 @@ pub fn store_diagnostics_for_anon_node(
) { ) {
let mut current_diagnostics = self.current_diagnostics.borrow_mut(); let mut current_diagnostics = self.current_diagnostics.borrow_mut();
let x = current_diagnostics.entry(dep_node_index).or_insert(Vec::new()); let x = current_diagnostics.entry(dep_node_index).or_default();
x.extend(Into::<Vec<_>>::into(diagnostics)); x.extend(Into::<Vec<_>>::into(diagnostics));
} }
......
...@@ -157,7 +157,7 @@ fn compile_all_suggestions( ...@@ -157,7 +157,7 @@ fn compile_all_suggestions(
debug!("Collected {:?}: {:?}", fr, outlived_fr); debug!("Collected {:?}: {:?}", fr, outlived_fr);
// Add to set of constraints for final help note. // Add to set of constraints for final help note.
self.constraints_to_add.entry(fr).or_insert(Vec::new()).push(outlived_fr); self.constraints_to_add.entry(fr).or_default().push(outlived_fr);
} }
/// Emit an intermediate note on the given `Diagnostic` if the involved regions are /// Emit an intermediate note on the given `Diagnostic` if the involved regions are
......
...@@ -213,11 +213,13 @@ fn next(&mut self) -> Option<Piece<'a>> { ...@@ -213,11 +213,13 @@ fn next(&mut self) -> Option<Piece<'a>> {
Some(String(self.string(pos + 1))) Some(String(self.string(pos + 1)))
} else { } else {
let arg = self.argument(); let arg = self.argument();
if let Some(end) = self.must_consume('}') { if let Some(rbrace_byte_idx) = self.must_consume('}') {
let start = self.to_span_index(pos); let lbrace_inner_offset = self.to_span_index(pos);
let end = self.to_span_index(end + 1); let rbrace_inner_offset = self.to_span_index(rbrace_byte_idx);
if self.is_literal { if self.is_literal {
self.arg_places.push(start.to(end)); self.arg_places.push(
lbrace_inner_offset.to(InnerOffset(rbrace_inner_offset.0 + 1)),
);
} }
} }
Some(NextArgument(arg)) Some(NextArgument(arg))
......
...@@ -2327,7 +2327,7 @@ fn resolve_expr(&mut self, expr: &'ast Expr, parent: Option<&'ast Expr>) { ...@@ -2327,7 +2327,7 @@ fn resolve_expr(&mut self, expr: &'ast Expr, parent: Option<&'ast Expr>) {
ExprKind::Call(ref callee, ref arguments) => { ExprKind::Call(ref callee, ref arguments) => {
self.resolve_expr(callee, Some(expr)); self.resolve_expr(callee, Some(expr));
let const_args = self.r.legacy_const_generic_args(callee).unwrap_or(Vec::new()); let const_args = self.r.legacy_const_generic_args(callee).unwrap_or_default();
for (idx, argument) in arguments.iter().enumerate() { for (idx, argument) in arguments.iter().enumerate() {
// Constant arguments need to be treated as AnonConst since // Constant arguments need to be treated as AnonConst since
// that is how they will be later lowered to HIR. // that is how they will be later lowered to HIR.
......
...@@ -184,7 +184,7 @@ pub(crate) fn smart_resolve_report_errors( ...@@ -184,7 +184,7 @@ pub(crate) fn smart_resolve_report_errors(
PathResult::Module(ModuleOrUniformRoot::Module(module)) => module.res(), PathResult::Module(ModuleOrUniformRoot::Module(module)) => module.res(),
_ => None, _ => None,
} }
.map_or(String::new(), |res| format!("{} ", res.descr())); .map_or_else(String::new, |res| format!("{} ", res.descr()));
(mod_prefix, format!("`{}`", Segment::names_to_string(mod_path))) (mod_prefix, format!("`{}`", Segment::names_to_string(mod_path)))
}; };
( (
...@@ -1042,10 +1042,10 @@ fn smart_resolve_context_dependent_help( ...@@ -1042,10 +1042,10 @@ fn smart_resolve_context_dependent_help(
if let Some(span) = self.def_span(def_id) { if let Some(span) = self.def_span(def_id) {
err.span_label(span, &format!("`{}` defined here", path_str)); err.span_label(span, &format!("`{}` defined here", path_str));
} }
let fields = let fields = self.r.field_names.get(&def_id).map_or_else(
self.r.field_names.get(&def_id).map_or("/* fields */".to_string(), |fields| { || "/* fields */".to_string(),
vec!["_"; fields.len()].join(", ") |fields| vec!["_"; fields.len()].join(", "),
}); );
err.span_suggestion( err.span_suggestion(
span, span,
"use the tuple variant pattern syntax instead", "use the tuple variant pattern syntax instead",
......
...@@ -1793,7 +1793,7 @@ pub fn insert_hashed_nocheck(self, hash: u64, key: K, value: V) -> (&'a mut K, & ...@@ -1793,7 +1793,7 @@ pub fn insert_hashed_nocheck(self, hash: u64, key: K, value: V) -> (&'a mut K, &
#[unstable(feature = "hash_raw_entry", issue = "56167")] #[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawEntryBuilderMut<'_, K, V, S> { impl<K, V, S> Debug for RawEntryBuilderMut<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawEntryBuilder").finish() f.debug_struct("RawEntryBuilder").finish_non_exhaustive()
} }
} }
...@@ -1813,21 +1813,21 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -1813,21 +1813,21 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawOccupiedEntryMut") f.debug_struct("RawOccupiedEntryMut")
.field("key", self.key()) .field("key", self.key())
.field("value", self.get()) .field("value", self.get())
.finish() .finish_non_exhaustive()
} }
} }
#[unstable(feature = "hash_raw_entry", issue = "56167")] #[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawVacantEntryMut<'_, K, V, S> { impl<K, V, S> Debug for RawVacantEntryMut<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawVacantEntryMut").finish() f.debug_struct("RawVacantEntryMut").finish_non_exhaustive()
} }
} }
#[unstable(feature = "hash_raw_entry", issue = "56167")] #[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawEntryBuilder<'_, K, V, S> { impl<K, V, S> Debug for RawEntryBuilder<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawEntryBuilder").finish() f.debug_struct("RawEntryBuilder").finish_non_exhaustive()
} }
} }
...@@ -1867,7 +1867,10 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> { ...@@ -1867,7 +1867,10 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
#[stable(feature = "debug_hash_map", since = "1.12.0")] #[stable(feature = "debug_hash_map", since = "1.12.0")]
impl<K: Debug, V: Debug> Debug for OccupiedEntry<'_, K, V> { impl<K: Debug, V: Debug> Debug for OccupiedEntry<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("OccupiedEntry").field("key", self.key()).field("value", self.get()).finish() f.debug_struct("OccupiedEntry")
.field("key", self.key())
.field("value", self.get())
.finish_non_exhaustive()
} }
} }
...@@ -1903,7 +1906,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -1903,7 +1906,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
.field("key", self.entry.key()) .field("key", self.entry.key())
.field("old_value", self.entry.get()) .field("old_value", self.entry.get())
.field("new_value", &self.value) .field("new_value", &self.value)
.finish() .finish_non_exhaustive()
} }
} }
......
...@@ -1154,7 +1154,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -1154,7 +1154,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
.field("modified", &self.modified()) .field("modified", &self.modified())
.field("accessed", &self.accessed()) .field("accessed", &self.accessed())
.field("created", &self.created()) .field("created", &self.created())
.finish() .finish_non_exhaustive()
} }
} }
...@@ -1677,9 +1677,9 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> ...@@ -1677,9 +1677,9 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()>
/// This function will return an error in the following situations, but is not /// This function will return an error in the following situations, but is not
/// limited to just these cases: /// limited to just these cases:
/// ///
/// * The `from` path is not a file. /// * `from` is neither a regular file nor a symlink to a regular file.
/// * The `from` file does not exist. /// * `from` does not exist.
/// * The current process does not have the permission rights to access /// * The current process does not have the permission rights to read
/// `from` or write `to`. /// `from` or write `to`.
/// ///
/// # Examples /// # Examples
......
...@@ -227,6 +227,6 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -227,6 +227,6 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
"buffer", "buffer",
&format_args!("{}/{}", self.inner.buffer().len(), self.inner.capacity()), &format_args!("{}/{}", self.inner.buffer().len(), self.inner.capacity()),
) )
.finish() .finish_non_exhaustive()
} }
} }
...@@ -2114,6 +2114,7 @@ fn lines(self) -> Lines<Self> ...@@ -2114,6 +2114,7 @@ fn lines(self) -> Lines<Self>
/// ///
/// [`chain`]: Read::chain /// [`chain`]: Read::chain
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug)]
pub struct Chain<T, U> { pub struct Chain<T, U> {
first: T, first: T,
second: U, second: U,
...@@ -2195,13 +2196,6 @@ pub fn get_mut(&mut self) -> (&mut T, &mut U) { ...@@ -2195,13 +2196,6 @@ pub fn get_mut(&mut self) -> (&mut T, &mut U) {
} }
} }
#[stable(feature = "std_debug", since = "1.16.0")]
impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Chain").field("t", &self.first).field("u", &self.second).finish()
}
}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: Read, U: Read> Read for Chain<T, U> { impl<T: Read, U: Read> Read for Chain<T, U> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
......
...@@ -515,7 +515,7 @@ pub struct SyncLazy<T, F = fn() -> T> { ...@@ -515,7 +515,7 @@ pub struct SyncLazy<T, F = fn() -> T> {
#[unstable(feature = "once_cell", issue = "74465")] #[unstable(feature = "once_cell", issue = "74465")]
impl<T: fmt::Debug, F> fmt::Debug for SyncLazy<T, F> { impl<T: fmt::Debug, F> fmt::Debug for SyncLazy<T, F> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Lazy").field("cell", &self.cell).field("init", &"..").finish() f.debug_struct("Lazy").field("cell", &self.cell).finish_non_exhaustive()
} }
} }
......
...@@ -234,7 +234,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -234,7 +234,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
.field("stdin", &self.stdin) .field("stdin", &self.stdin)
.field("stdout", &self.stdout) .field("stdout", &self.stdout)
.field("stderr", &self.stderr) .field("stderr", &self.stderr)
.finish() .finish_non_exhaustive()
} }
} }
......
...@@ -864,7 +864,7 @@ fn drop(&mut self) { ...@@ -864,7 +864,7 @@ fn drop(&mut self) {
#[stable(feature = "mpsc_debug", since = "1.8.0")] #[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for Sender<T> { impl<T> fmt::Debug for Sender<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Sender").finish() f.debug_struct("Sender").finish_non_exhaustive()
} }
} }
...@@ -991,7 +991,7 @@ fn drop(&mut self) { ...@@ -991,7 +991,7 @@ fn drop(&mut self) {
#[stable(feature = "mpsc_debug", since = "1.8.0")] #[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for SyncSender<T> { impl<T> fmt::Debug for SyncSender<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SyncSender").finish() f.debug_struct("SyncSender").finish_non_exhaustive()
} }
} }
...@@ -1470,7 +1470,7 @@ fn drop(&mut self) { ...@@ -1470,7 +1470,7 @@ fn drop(&mut self) {
#[stable(feature = "mpsc_debug", since = "1.8.0")] #[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for Receiver<T> { impl<T> fmt::Debug for Receiver<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Receiver").finish() f.debug_struct("Receiver").finish_non_exhaustive()
} }
} }
......
...@@ -441,10 +441,13 @@ fn default() -> Mutex<T> { ...@@ -441,10 +441,13 @@ fn default() -> Mutex<T> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + fmt::Debug> fmt::Debug for Mutex<T> { impl<T: ?Sized + fmt::Debug> fmt::Debug for Mutex<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut d = f.debug_struct("Mutex");
match self.try_lock() { match self.try_lock() {
Ok(guard) => f.debug_struct("Mutex").field("data", &&*guard).finish(), Ok(guard) => {
d.field("data", &&*guard);
}
Err(TryLockError::Poisoned(err)) => { Err(TryLockError::Poisoned(err)) => {
f.debug_struct("Mutex").field("data", &&**err.get_ref()).finish() d.field("data", &&**err.get_ref());
} }
Err(TryLockError::WouldBlock) => { Err(TryLockError::WouldBlock) => {
struct LockedPlaceholder; struct LockedPlaceholder;
...@@ -453,10 +456,11 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -453,10 +456,11 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("<locked>") f.write_str("<locked>")
} }
} }
d.field("data", &LockedPlaceholder);
f.debug_struct("Mutex").field("data", &LockedPlaceholder).finish()
} }
} }
d.field("poisoned", &self.poison.get());
d.finish_non_exhaustive()
} }
} }
......
...@@ -422,10 +422,13 @@ fn drop(&mut self) { ...@@ -422,10 +422,13 @@ fn drop(&mut self) {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + fmt::Debug> fmt::Debug for RwLock<T> { impl<T: ?Sized + fmt::Debug> fmt::Debug for RwLock<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut d = f.debug_struct("RwLock");
match self.try_read() { match self.try_read() {
Ok(guard) => f.debug_struct("RwLock").field("data", &&*guard).finish(), Ok(guard) => {
d.field("data", &&*guard);
}
Err(TryLockError::Poisoned(err)) => { Err(TryLockError::Poisoned(err)) => {
f.debug_struct("RwLock").field("data", &&**err.get_ref()).finish() d.field("data", &&**err.get_ref());
} }
Err(TryLockError::WouldBlock) => { Err(TryLockError::WouldBlock) => {
struct LockedPlaceholder; struct LockedPlaceholder;
...@@ -434,10 +437,11 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -434,10 +437,11 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("<locked>") f.write_str("<locked>")
} }
} }
d.field("data", &LockedPlaceholder);
f.debug_struct("RwLock").field("data", &LockedPlaceholder).finish()
} }
} }
d.field("poisoned", &self.poison.get());
d.finish_non_exhaustive()
} }
} }
...@@ -473,7 +477,7 @@ unsafe fn new(lock: &'rwlock RwLock<T>) -> LockResult<RwLockWriteGuard<'rwlock, ...@@ -473,7 +477,7 @@ unsafe fn new(lock: &'rwlock RwLock<T>) -> LockResult<RwLockWriteGuard<'rwlock,
#[stable(feature = "std_debug", since = "1.16.0")] #[stable(feature = "std_debug", since = "1.16.0")]
impl<T: fmt::Debug> fmt::Debug for RwLockReadGuard<'_, T> { impl<T: fmt::Debug> fmt::Debug for RwLockReadGuard<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RwLockReadGuard").field("lock", &self.lock).finish() (**self).fmt(f)
} }
} }
...@@ -487,7 +491,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -487,7 +491,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[stable(feature = "std_debug", since = "1.16.0")] #[stable(feature = "std_debug", since = "1.16.0")]
impl<T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'_, T> { impl<T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RwLockWriteGuard").field("lock", &self.lock).finish() (**self).fmt(f)
} }
} }
......
...@@ -535,7 +535,7 @@ fn from(a: c_int) -> ExitStatus { ...@@ -535,7 +535,7 @@ fn from(a: c_int) -> ExitStatus {
impl fmt::Display for ExitStatus { impl fmt::Display for ExitStatus {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(code) = self.code() { if let Some(code) = self.code() {
write!(f, "exit code: {}", code) write!(f, "exit status: {}", code)
} else if let Some(signal) = self.signal() { } else if let Some(signal) = self.signal() {
if self.core_dumped() { if self.core_dumped() {
write!(f, "signal: {} (core dumped)", signal) write!(f, "signal: {} (core dumped)", signal)
......
...@@ -9,8 +9,8 @@ fn exitstatus_display_tests() { ...@@ -9,8 +9,8 @@ fn exitstatus_display_tests() {
t(0x0000f, "signal: 15"); t(0x0000f, "signal: 15");
t(0x0008b, "signal: 11 (core dumped)"); t(0x0008b, "signal: 11 (core dumped)");
t(0x00000, "exit code: 0"); t(0x00000, "exit status: 0");
t(0x0ff00, "exit code: 255"); t(0x0ff00, "exit status: 255");
// On MacOS, 0x0137f is WIFCONTINUED, not WIFSTOPPED. Probably *BSD is similar. // On MacOS, 0x0137f is WIFCONTINUED, not WIFSTOPPED. Probably *BSD is similar.
// https://github.com/rust-lang/rust/pull/82749#issuecomment-790525956 // https://github.com/rust-lang/rust/pull/82749#issuecomment-790525956
......
...@@ -130,7 +130,7 @@ pub fn bits(&self) -> wasi::Filetype { ...@@ -130,7 +130,7 @@ pub fn bits(&self) -> wasi::Filetype {
impl fmt::Debug for ReadDir { impl fmt::Debug for ReadDir {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ReadDir").finish() f.debug_struct("ReadDir").finish_non_exhaustive()
} }
} }
......
...@@ -1176,7 +1176,10 @@ fn cname(&self) -> Option<&CStr> { ...@@ -1176,7 +1176,10 @@ fn cname(&self) -> Option<&CStr> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for Thread { impl fmt::Debug for Thread {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Thread").field("id", &self.id()).field("name", &self.name()).finish() f.debug_struct("Thread")
.field("id", &self.id())
.field("name", &self.name())
.finish_non_exhaustive()
} }
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#[cfg(not(unix))] #[cfg(not(unix))]
pub fn get_exit_code(status: ExitStatus) -> Result<i32, String> { pub fn get_exit_code(status: ExitStatus) -> Result<i32, String> {
status.code().ok_or("received no exit code from child process".into()) status.code().ok_or_else(|| "received no exit code from child process".into())
} }
#[cfg(unix)] #[cfg(unix)]
......
...@@ -12,4 +12,4 @@ library built by the official Rust distributions. Most targets will need a ...@@ -12,4 +12,4 @@ library built by the official Rust distributions. Most targets will need a
system linker, and possibly other things. system linker, and possibly other things.
[rustup]: https://github.com/rust-lang/rustup [rustup]: https://github.com/rust-lang/rustup
[rustup-cross]: https://github.com/rust-lang/rustup#cross-compilation [rustup-cross]: https://rust-lang.github.io/rustup/cross-compilation.html
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-56445.rs:3:27 --> $DIR/issue-56445-1.rs:3:27
| |
LL | #![cfg_attr(full, feature(const_generics))] LL | #![cfg_attr(full, feature(const_generics))]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
...@@ -8,7 +8,7 @@ LL | #![cfg_attr(full, feature(const_generics))] ...@@ -8,7 +8,7 @@ LL | #![cfg_attr(full, feature(const_generics))]
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error[E0771]: use of non-static lifetime `'a` in const generic error[E0771]: use of non-static lifetime `'a` in const generic
--> $DIR/issue-56445.rs:8:26 --> $DIR/issue-56445-1.rs:8:26
| |
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
| ^^ | ^^
......
error[E0771]: use of non-static lifetime `'a` in const generic error[E0771]: use of non-static lifetime `'a` in const generic
--> $DIR/issue-56445.rs:8:26 --> $DIR/issue-56445-1.rs:8:26
| |
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
| ^^ | ^^
......
// Regression test for https://github.com/rust-lang/rust/issues/56445#issuecomment-502095133
struct OnDiskDirEntry<'a> { _s: &'a usize }
impl<'a> OnDiskDirEntry<'a> {
const LFN_FRAGMENT_LEN: usize = 2;
fn lfn_contents(&self) -> [char; Self::LFN_FRAGMENT_LEN] { loop { } }
//~^ ERROR: generic `Self` types are currently not permitted in anonymous constants
}
fn main() {}
error: generic `Self` types are currently not permitted in anonymous constants
--> $DIR/issue-56445-2.rs:7:38
|
LL | fn lfn_contents(&self) -> [char; Self::LFN_FRAGMENT_LEN] { loop { } }
| ^^^^
|
note: not a concrete type
--> $DIR/issue-56445-2.rs:4:10
|
LL | impl<'a> OnDiskDirEntry<'a> {
| ^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
// Regression test for https://github.com/rust-lang/rust/issues/56445#issuecomment-524494170
pub struct Memory<'rom> {
rom: &'rom [u8],
ram: [u8; Self::SIZE],
//~^ ERROR: generic `Self` types are currently not permitted in anonymous constants
}
impl<'rom> Memory<'rom> {
pub const SIZE: usize = 0x8000;
}
fn main() {}
error: generic `Self` types are currently not permitted in anonymous constants
--> $DIR/issue-56445-3.rs:4:15
|
LL | ram: [u8; Self::SIZE],
| ^^^^
error: aborting due to previous error
// check-fail
fn main() {
println!("{}\
"); //~^ ERROR: 1 positional argument in format string, but no arguments were given
}
error: 1 positional argument in format string, but no arguments were given
--> $DIR/issue-83344.rs:4:15
|
LL | println!("{}\
| ^^
error: aborting due to previous error
...@@ -75,8 +75,9 @@ LL | "1", "2", "3", ...@@ -75,8 +75,9 @@ LL | "1", "2", "3",
| |
help: try this help: try this
| |
LL | "some 1{} / {}", "2", "3", LL | "some 1/
| ^ -- LL | {} / {}", "2", "3",
|
error: literal with an empty format string error: literal with an empty format string
--> $DIR/write_literal_2.rs:25:14 --> $DIR/write_literal_2.rs:25:14
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册