Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 12 pull requests #84411

Merged
merged 40 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9aa6c1e
fix 'const-stable since' for NonZeroU*::new_unchecked
RalfJung Apr 16, 2021
df01b3a
Document that `index` and `index_mut` can panic
wooster0 Apr 18, 2021
c86ffe9
Say that it "may panic"
wooster0 Apr 18, 2021
1212040
Move `sys::vxworks` code to `sys::unix`
CDirkx Apr 12, 2021
9bd9cbb
Fix `vxworks` compilation errors
CDirkx Apr 14, 2021
8cc918a
Improve the docstrings of the `Lto` struct.
vext01 Apr 20, 2021
389fef3
Replace `Void` with never type
CDirkx Apr 14, 2021
d45e131
Change uses of never type
CDirkx Apr 14, 2021
c968594
Fix broken doc link
starthal Apr 20, 2021
0c193f8
Write Rustdoc titles like "x in crate::mod - Rust"
syvb Apr 20, 2021
b6647b5
Add test for issue #79949
marmeladema Apr 20, 2021
19e51aa
Add test for issue #79636
marmeladema Apr 20, 2021
25cb1af
Add test for issue #78671
marmeladema Apr 20, 2021
1ef760d
Add test for issue #70303
marmeladema Apr 20, 2021
7cf4f42
Rename pushname to is_module
syvb Apr 20, 2021
a9ff7ac
Merge mod-title and item-title tests
syvb Apr 20, 2021
05121a2
fix is_module check
syvb Apr 20, 2021
cbd0d89
Add test for issue #70304
marmeladema Apr 20, 2021
d328dbc
Add test for issue #71176
marmeladema Apr 20, 2021
3ddafb2
Add test for title of root page in item-title.rs
syvb Apr 20, 2021
df147c7
Just merge all of the <title> tests into one
syvb Apr 20, 2021
82dc73b
Format `Struct { .. }` on one line even with `{:#?}`.
m-ou-se Apr 21, 2021
cc44ce0
Correctly handle --open argument on doc command
GuillaumeGomez Apr 21, 2021
1fb3256
Replace all `fmt.pad` with `debug_struct`
CDirkx Apr 5, 2021
fdae757
Change the `Debug` impl of `Any` and `UnsafeCell` to use `finish_non_…
CDirkx Apr 21, 2021
fccc75c
Fix `alloc::test::test_show`
CDirkx Apr 21, 2021
aa46f08
Apply suggestions from code review
CDirkx Apr 21, 2021
f1f3069
Remove `delete` alias from `mem::drop`.
m-ou-se Apr 21, 2021
a7a7737
Rollup merge of #84013 - CDirkx:fmt, r=m-ou-se
m-ou-se Apr 21, 2021
3897ad1
Rollup merge of #84119 - CDirkx:vxworks, r=m-ou-se
m-ou-se Apr 21, 2021
31b8380
Rollup merge of #84212 - CDirkx:void, r=m-ou-se
m-ou-se Apr 21, 2021
47886ea
Rollup merge of #84251 - RalfJung:non-zero-const-since, r=kennytm
m-ou-se Apr 21, 2021
d341851
Rollup merge of #84301 - r00ster91:patch-1, r=kennytm
m-ou-se Apr 21, 2021
6967b68
Rollup merge of #84365 - vext01:improve-lto-docstrings, r=petrochenkov
m-ou-se Apr 21, 2021
193b631
Rollup merge of #84378 - starthal:patch-1, r=jyn514
m-ou-se Apr 21, 2021
e7f2033
Rollup merge of #84379 - marmeladema:test-for-issue-79949, r=jackh726
m-ou-se Apr 21, 2021
2cddda3
Rollup merge of #84380 - Smittyvb:rdoc-title-order, r=jsha
m-ou-se Apr 21, 2021
49a5c80
Rollup merge of #84390 - m-ou-se:make-debug-non-exhaustive-without-fi…
m-ou-se Apr 21, 2021
0749ea7
Rollup merge of #84393 - GuillaumeGomez:better-open-handling, r=jyn514
m-ou-se Apr 21, 2021
268d29d
Rollup merge of #84406 - m-ou-se:drop-delete-alias, r=dtolnay
m-ou-se Apr 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,21 @@ impl_stable_hash_via_hash!(OptLevel);

/// This is what the `LtoCli` values get mapped to after resolving defaults and
/// and taking other command line options into account.
///
/// Note that linker plugin-based LTO is a different mechanism entirely.
#[derive(Clone, PartialEq)]
pub enum Lto {
/// Don't do any LTO whatsoever
/// Don't do any LTO whatsoever.
No,

/// Do a full crate graph LTO with ThinLTO
/// Do a full-crate-graph (inter-crate) LTO with ThinLTO.
Thin,

/// Do a local graph LTO with ThinLTO (only relevant for multiple codegen
/// units).
/// Do a local ThinLTO (intra-crate, over the CodeGen Units of the local crate only). This is
/// only relevant if multiple CGUs are used.
ThinLocal,

/// Do a full crate graph LTO with "fat" LTO
/// Do a full-crate-graph (inter-crate) LTO with "fat" LTO.
Fat,
}

Expand Down
8 changes: 4 additions & 4 deletions library/alloc/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ fn test_show() {
let b = Box::new(Test) as Box<dyn Any>;
let a_str = format!("{:?}", a);
let b_str = format!("{:?}", b);
assert_eq!(a_str, "Any");
assert_eq!(b_str, "Any");
assert_eq!(a_str, "Any { .. }");
assert_eq!(b_str, "Any { .. }");

static EIGHT: usize = 8;
static TEST: Test = Test;
let a = &EIGHT as &dyn Any;
let b = &TEST as &dyn Any;
let s = format!("{:?}", a);
assert_eq!(s, "Any");
assert_eq!(s, "Any { .. }");
let s = format!("{:?}", b);
assert_eq!(s, "Any");
assert_eq!(s, "Any { .. }");
}

#[test]
Expand Down
6 changes: 3 additions & 3 deletions library/core/src/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<T: 'static + ?Sized> Any for T {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for dyn Any {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Any")
f.debug_struct("Any").finish_non_exhaustive()
}
}

Expand All @@ -151,14 +151,14 @@ impl fmt::Debug for dyn Any {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for dyn Any + Send {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Any")
f.debug_struct("Any").finish_non_exhaustive()
}
}

#[stable(feature = "any_send_sync_methods", since = "1.28.0")]
impl fmt::Debug for dyn Any + Send + Sync {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Any")
f.debug_struct("Any").finish_non_exhaustive()
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@ impl fmt::Display for EscapeDefault {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for EscapeDefault {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("EscapeDefault { .. }")
f.debug_struct("EscapeDefault").finish_non_exhaustive()
}
}
2 changes: 1 addition & 1 deletion library/core/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub enum c_void {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for c_void {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("c_void")
f.debug_struct("c_void").finish()
}
}

Expand Down
27 changes: 9 additions & 18 deletions library/core/src/fmt/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,28 +188,19 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
#[stable(feature = "debug_non_exhaustive", since = "1.53.0")]
pub fn finish_non_exhaustive(&mut self) -> fmt::Result {
self.result = self.result.and_then(|_| {
// Draw non-exhaustive dots (`..`), and open brace if necessary (no fields).
if self.is_pretty() {
if !self.has_fields {
self.fmt.write_str(" {\n")?;
}
let mut slot = None;
let mut state = Default::default();
let mut writer = PadAdapter::wrap(&mut self.fmt, &mut slot, &mut state);
writer.write_str("..\n")?;
} else {
if self.has_fields {
self.fmt.write_str(", ..")?;
if self.has_fields {
if self.is_pretty() {
let mut slot = None;
let mut state = Default::default();
let mut writer = PadAdapter::wrap(&mut self.fmt, &mut slot, &mut state);
writer.write_str("..\n")?;
self.fmt.write_str("}")
} else {
self.fmt.write_str(" { ..")?;
self.fmt.write_str(", .. }")
}
}
if self.is_pretty() {
self.fmt.write_str("}")?
} else {
self.fmt.write_str(" }")?;
self.fmt.write_str(" { .. }")
}
Ok(())
});
self.result
}
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2220,7 +2220,7 @@ impl Debug for () {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> Debug for PhantomData<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
f.pad("PhantomData")
f.debug_struct("PhantomData").finish()
}
}

Expand Down Expand Up @@ -2270,7 +2270,7 @@ impl<T: ?Sized + Debug> Debug for RefMut<'_, T> {
#[stable(feature = "core_impl_debug", since = "1.9.0")]
impl<T: ?Sized> Debug for UnsafeCell<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
f.pad("UnsafeCell")
f.debug_struct("UnsafeCell").finish_non_exhaustive()
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ pub struct BuildHasherDefault<H>(marker::PhantomData<H>);
#[stable(since = "1.9.0", feature = "core_impl_debug")]
impl<H> fmt::Debug for BuildHasherDefault<H> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("BuildHasherDefault")
f.debug_struct("BuildHasherDefault").finish()
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/iter/sources/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ unsafe impl<T> Sync for Empty<T> {}
#[stable(feature = "core_impl_debug", since = "1.9.0")]
impl<T> fmt::Debug for Empty<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Empty")
f.debug_struct("Empty").finish()
}
}

Expand Down
1 change: 0 additions & 1 deletion library/core/src/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,6 @@ pub const fn replace<T>(dest: &mut T, src: T) -> T {
/// ```
///
/// [`RefCell`]: crate::cell::RefCell
#[doc(alias = "delete")]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn drop<T>(_x: T) {}
Expand Down
28 changes: 14 additions & 14 deletions library/core/src/num/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ macro_rules! impl_nonzero_fmt {
}

macro_rules! nonzero_integers {
( $( #[$stability: meta] $Ty: ident($Int: ty); )+ ) => {
( $( #[$stability: meta] #[$const_new_unchecked_stability: meta] $Ty: ident($Int: ty); )+ ) => {
$(
/// An integer that is known not to equal zero.
///
Expand All @@ -48,7 +48,7 @@ macro_rules! nonzero_integers {
///
/// The value must not be zero.
#[$stability]
#[rustc_const_stable(feature = "nonzero", since = "1.34.0")]
#[$const_new_unchecked_stability]
#[inline]
pub const unsafe fn new_unchecked(n: $Int) -> Self {
// SAFETY: this is guaranteed to be safe by the caller.
Expand Down Expand Up @@ -146,18 +146,18 @@ macro_rules! nonzero_integers {
}

nonzero_integers! {
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU64(u64);
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU128(u128);
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroUsize(usize);
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI8(i8);
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI16(i16);
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI32(i32);
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI64(i64);
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI128(i128);
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU64(u64);
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU128(u128);
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroUsize(usize);
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI8(i8);
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI16(i16);
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI32(i32);
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI64(i64);
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI128(i128);
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
}

macro_rules! from_str_radix_nzint_impl {
Expand Down
8 changes: 8 additions & 0 deletions library/core/src/ops/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ pub trait Index<Idx: ?Sized> {
type Output: ?Sized;

/// Performs the indexing (`container[index]`) operation.
///
/// # Panics
///
/// May panic if the index is out of bounds.
#[stable(feature = "rust1", since = "1.0.0")]
#[track_caller]
fn index(&self, index: Idx) -> &Self::Output;
Expand Down Expand Up @@ -161,6 +165,10 @@ see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#ind
#[doc(alias = "[]")]
pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
/// Performs the mutable indexing (`container[index]`) operation.
///
/// # Panics
///
/// May panic if the index is out of bounds.
#[stable(feature = "rust1", since = "1.0.0")]
#[track_caller]
fn index_mut(&mut self, index: Idx) -> &mut Self::Output;
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/slice/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl<'a> fmt::Display for EscapeAscii<'a> {
#[unstable(feature = "inherent_ascii_escape", issue = "77174")]
impl<'a> fmt::Debug for EscapeAscii<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("EscapeAscii { .. }")
f.debug_struct("EscapeAscii").finish_non_exhaustive()
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/str/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ pub struct EncodeUtf16<'a> {
#[stable(feature = "collection_debug", since = "1.17.0")]
impl fmt::Debug for EncodeUtf16<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("EncodeUtf16 { .. }")
f.debug_struct("EncodeUtf16").finish_non_exhaustive()
}
}

Expand Down
7 changes: 1 addition & 6 deletions library/core/tests/fmt/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,7 @@ mod debug_struct {
}

assert_eq!("Foo { .. }", format!("{:?}", Foo));
assert_eq!(
"Foo {
..
}",
format!("{:#?}", Foo)
);
assert_eq!("Foo { .. }", format!("{:#?}", Foo));
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2257,7 +2257,7 @@ where
F: FnMut(&K, &mut V) -> bool,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("DrainFilter { .. }")
f.debug_struct("DrainFilter").finish_non_exhaustive()
}
}

Expand Down Expand Up @@ -2957,7 +2957,7 @@ impl Default for RandomState {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for RandomState {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("RandomState { .. }")
f.debug_struct("RandomState").finish_non_exhaustive()
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ where
F: FnMut(&K) -> bool,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("DrainFilter { .. }")
f.debug_struct("DrainFilter").finish_non_exhaustive()
}
}

Expand Down
6 changes: 3 additions & 3 deletions library/std/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl Iterator for Vars {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Vars {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Vars { .. }")
f.debug_struct("Vars").finish_non_exhaustive()
}
}

Expand All @@ -172,7 +172,7 @@ impl Iterator for VarsOs {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for VarsOs {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("VarsOs { .. }")
f.debug_struct("VarOs").finish_non_exhaustive()
}
}

Expand Down Expand Up @@ -419,7 +419,7 @@ impl<'a> Iterator for SplitPaths<'a> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for SplitPaths<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("SplitPaths { .. }")
f.debug_struct("SplitPaths").finish_non_exhaustive()
}
}

Expand Down
12 changes: 6 additions & 6 deletions library/std/src/io/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ impl Stdin {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Stdin {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Stdin { .. }")
f.debug_struct("Stdin").finish_non_exhaustive()
}
}

Expand Down Expand Up @@ -467,7 +467,7 @@ impl BufRead for StdinLock<'_> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for StdinLock<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("StdinLock { .. }")
f.debug_struct("StdinLock").finish_non_exhaustive()
}
}

Expand Down Expand Up @@ -607,7 +607,7 @@ impl Stdout {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Stdout {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Stdout { .. }")
f.debug_struct("Stdout").finish_non_exhaustive()
}
}

Expand Down Expand Up @@ -689,7 +689,7 @@ impl Write for StdoutLock<'_> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for StdoutLock<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("StdoutLock { .. }")
f.debug_struct("StdoutLock").finish_non_exhaustive()
}
}

Expand Down Expand Up @@ -804,7 +804,7 @@ impl Stderr {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Stderr {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Stderr { .. }")
f.debug_struct("Stderr").finish_non_exhaustive()
}
}

Expand Down Expand Up @@ -886,7 +886,7 @@ impl Write for StderrLock<'_> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for StderrLock<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("StderrLock { .. }")
f.debug_struct("StderrLock").finish_non_exhaustive()
}
}

Expand Down
Loading