Commit graph

140991 commits

Author SHA1 Message Date
Yuki Okushi
1ad7c52812
Rollup merge of #83569 - sjakobi:issue56445-regression-test, r=jackh726
Add regression tests for #56445

Closes #56445.
2021-03-28 01:33:23 +09:00
Yuki Okushi
69acaf335f
Rollup merge of #83567 - jonjensen:patch-1, r=GuillaumeGomez
Update rustup cross-compilation docs link
2021-03-28 01:33:22 +09:00
Yuki Okushi
a800d7f63f
Rollup merge of #83561 - m-ou-se:lock-debug, r=jackh726
Improve Debug implementations of Mutex and RwLock.

This improves the Debug implementations of Mutex and RwLock.

They now show the poison flag and use debug_non_exhaustive. (See #67364.)
2021-03-28 01:33:21 +09:00
Yuki Okushi
8ad5f2143e
Rollup merge of #83560 - m-ou-se:io-chain-debug, r=sfackler
Derive Debug for io::Chain instead of manually implementing it.

This derives Debug for io::Chain instead of manually implementing it.

The manual implementation has the same bounds, so I don't think there's any reason for a manual implementation. The names used in the derive implementation are even nicer (`first`/`second`) than the manual implementation (`t`/`u`), and include the `done_first` field too.
2021-03-28 01:33:19 +09:00
Yuki Okushi
5dc29e189b
Rollup merge of #83559 - m-ou-se:rwlock-guard-debug-fix, r=jackh726
Fix Debug implementation for RwLock{Read,Write}Guard.

This would attempt to print the Debug representation of the lock that the guard has locked, which will try to lock again, fail, and just print `"<locked>"` unhelpfully.

After this change, this just prints the contents of the mutex, like the other smart pointers (and MutexGuard) do.

MutexGuard had this problem too: https://github.com/rust-lang/rust/issues/57702
2021-03-28 01:33:18 +09:00
Yuki Okushi
53cc8065a0
Rollup merge of #83558 - m-ou-se:use-finish-non-exhaustive, r=jackh726
Use DebugStruct::finish_non_exhaustive() in std.

See https://github.com/rust-lang/rust/issues/67364
2021-03-28 01:33:17 +09:00
Yuki Okushi
fa70398d6d
Rollup merge of #83526 - klensy:lazy-too, r=petrochenkov
lazily calls some fns

Replaced some fn's with it's lazy variants.
2021-03-28 01:33:16 +09:00
Yuki Okushi
3f41fdd2eb
Rollup merge of #83462 - ijackson:exitstatus-message-wording, r=joshtriplett
ExitStatus: print "exit status: {}" rather than "exit code: {}" on unix

Proper Unix terminology is "exit status" (vs "wait status").  "exit
code" is imprecise on Unix and therefore unclear.  (As far as I can
tell, "exit code" is correct terminology on Windows.)

This new wording is unfortunately inconsistent with the identifier
names in the Rust stdlib.

It is the identifier names that are wrong, as discussed at length in eg
  https://doc.rust-lang.org/nightly/std/process/struct.ExitStatus.html
  https://doc.rust-lang.org/nightly/std/os/unix/process/trait.ExitStatusExt.html

Unfortunately for API stability reasons it would be a lot of work, and
a lot of disruption, to change the names in the stdlib (eg to rename
`std::process::ExitStatus` to `std::process::ChildStatus` or
something), but we should fix the message output.  Many (probably
most) readers of these messages about exit statuses will be users and
system administrators, not programmers, who won't even know that Rust
has this wrong terminology.

So I think the right thing is to fix the documentation (as I have
already done) and, now, the terminology in the implementation.

This is a user-visible change to the behaviour of all Rust programs
which run Unix subprocesses.  Hopefully no-one is matching against the
exit status string, except perhaps in tests.
2021-03-28 01:33:15 +09:00
Yuki Okushi
973fb4b77f
Rollup merge of #83348 - osa1:issue83344, r=jackh726
format macro argument parsing fix

When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes #83344

---

r? ```@estebank```
2021-03-28 01:33:13 +09:00
Yuki Okushi
1f33a6a0da
Rollup merge of #79399 - pickfire:patch-3, r=JohnTitor
Use detailed and shorter fs error explaination

Includes suggestion from `@the8472` https://github.com/rust-lang/rust/issues/79390#issuecomment-733263336
2021-03-28 01:33:11 +09:00
Simon Jakobi
0927580224 Add regression tests for #56445
Closes #56445.
2021-03-27 15:29:14 +01:00
Jon Jensen
d5bcdd34e7
Update rustup cross-compilation docs link 2021-03-27 07:51:46 -06:00
bors
1010038814 Auto merge of #83245 - the8472:generalize-slice-fill, r=m-ou-se
Generalize and inline slice::fill specializations

This makes the memset specialization applicable to more types. And since the code now lives in a generic method it is also eligible for cross-crate inlining which  should fix #83235
2021-03-27 13:25:16 +00:00
Ivan Tham
5495ce0874 Use detailed and shorter fs error explaination
Includes suggestion from the8472 https://github.com/rust-lang/rust/issues/79390#issuecomment-733263336

More detail error explanation in fs doc
2021-03-27 20:55:51 +08:00
Mara Bos
5402abc493 Improve Debug implementations of Mutex and RwLock.
They now show the poison flag and use debug_non_exhaustive.
2021-03-27 13:47:11 +01:00
Mara Bos
7c01e6c38a Derive Debug for io::Chain instead of manually implementing it.
The manual implementation has the same bounds, so I don't think there's
any reason for a manual implementation. The names used in the derive
implementation are even nicer (`first`/`second`) than the manual
implementation (`t`/`u`), and include the `done_first` field too.
2021-03-27 13:37:52 +01:00
Mara Bos
d73015397d Fix Debug implementation for RwLock{Read,Write}Guard.
This would attempt to print the Debug representation of the lock that
the guard has locked, which will try to lock again, fail, and just print
"<locked>" unhelpfully.

After this change, this just prints the contents of the mutex, like the
other smart pointers (and MutexGuard) do.
2021-03-27 13:33:52 +01:00
Mara Bos
2afa4cc958 Use DebugStruct::finish_non_exhaustive() in std. 2021-03-27 13:29:23 +01:00
bors
aef11409b4 Auto merge of #78618 - workingjubilee:ieee754-fmt, r=m-ou-se
Add IEEE 754 compliant fmt/parse of -0, infinity, NaN

This pull request improves the Rust float formatting/parsing libraries to comply with IEEE 754's formatting expectations around certain special values, namely signed zero, the infinities, and NaN. It also adds IEEE 754 compliance tests that, while less stringent in certain places than many of the existing flt2dec/dec2flt capability tests, are intended to serve as the beginning of a roadmap to future compliance with the standard. Some relevant documentation is also adjusted with clarifying remarks.

This PR follows from discussion in https://github.com/rust-lang/rfcs/issues/1074, and closes #24623.

The most controversial change here is likely to be that -0 is now printed as -0. Allow me to explain: While there appears to be community support for an opt-in toggle of printing floats as if they exist in the naively expected domain of numbers, i.e. not the extended reals (where floats live), IEEE 754-2019 is clear that a float converted to a string should be capable of being transformed into the original floating point bit-pattern when it satisfies certain conditions (namely, when it is an actual numeric value i.e. not a NaN and the original and destination float width are the same). -0 is given special attention here as a value that should have its sign preserved. In addition, the vast majority of other programming languages not only output `-0` but output `-0.0` here.

While IEEE 754 offers a broad leeway in how to handle producing what it calls a "decimal character sequence", it is clear that the operations a language provides should be capable of round tripping, and it is confusing to advertise the f32 and f64 types as binary32 and binary64 yet have the most basic way of producing a string and then reading it back into a floating point number be non-conformant with the standard. Further, existing documentation suggested that e.g. -0 would be printed with -0 regardless of the presence of the `+` fmt character, but it prints "+0" instead if given such (which was what led to the opening of #24623).

There are other parsing and formatting issues for floating point numbers which prevent Rust from complying with the standard, as well as other well-documented challenges on the arithmetic level, but I hope that this can be the beginning of motion towards solving those challenges.
2021-03-27 10:40:16 +00:00
Ömer Sinan Ağacan
5b9bac2ab6 format macro argument parsing fix
When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes #83344
2021-03-27 13:06:36 +03:00
bors
feaac19f17 Auto merge of #83547 - JohnTitor:rollup-qh7j6hg, r=JohnTitor
Rollup of 9 pull requests

Successful merges:

 - #83239 (Remove/replace some outdated crates from the dependency tree)
 - #83328 (Fixes to inline assmebly tests)
 - #83343 (Simplify and fix byte skipping in format! string parser)
 - #83388 (Make # pretty print format easier to discover)
 - #83431 (Tell GitHub to highlight `config.toml.example` as TOML)
 - #83508 (Use the direct link to the platform support page)
 - #83511 (compiletest: handle llvm_version with suffix like "12.0.0libcxx")
 - #83524 (Document that the SocketAddr memory representation is not stable)
 - #83525 (fix doc comment for `ty::Dynamic`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-27 07:59:24 +00:00
klensy
229d199994 lazily calls some fns 2021-03-27 10:20:32 +03:00
Yuki Okushi
1b01e0d36a
Rollup merge of #83525 - rust-lang:lcnr-doc-patch, r=jonas-schievink
fix doc comment for `ty::Dynamic`
2021-03-27 12:37:25 +09:00
Yuki Okushi
d340f63cca
Rollup merge of #83524 - faern:document-socketaddr-mem-layout, r=sfackler
Document that the SocketAddr memory representation is not stable

Intended to help out with #78802. Work has been put into finding and fixing code that assumes the memory layout of `SocketAddrV4` and `SocketAddrV6`. But it turns out there are cases where new code continues to make the same assumption ([example](96927dc2b7 (diff-917db3d8ca6f862ebf42726b23c72a12b35e584e497ebdb24e474348d7c6ffb6R610-R621))).

The memory layout of a type in `std` is never part of the public API. Unless explicitly stated I guess. But since that is invalidly relied upon by a considerable amount of code for these particular types, it might make sense to explicitly document this. This can be temporary. Once #78802 lands it does not make sense to rely on the layout any longer, and this documentation can also be removed.
2021-03-27 12:37:24 +09:00
Yuki Okushi
e675d25506
Rollup merge of #83511 - 12101111:fix-llvm-version-suffix, r=Mark-Simulacrum
compiletest: handle llvm_version with suffix like "12.0.0libcxx"

The previous code only remove the suffix begin with `-`, but Gentoo Linux [define `LLVM_VERSION_SUFFIX="libcxx"`](604d79f327/sys-devel/llvm/llvm-11.1.0.ebuild (L378)) when llvm is linked to libc++ and lead to a panic:

```
thread 'main' panicked at 'Malformed version component: ParseIntError { kind: InvalidDigit }', src/tools/compiletest/src/header.rs:968:28
```

This new code will handle all suffix not beginning with digit or dot.
2021-03-27 12:37:23 +09:00
Yuki Okushi
60cf7729cc
Rollup merge of #83508 - JohnTitor:platform-support-link, r=joshtriplett
Use the direct link to the platform support page
2021-03-27 12:37:22 +09:00
Yuki Okushi
9df2b5f89c
Rollup merge of #83431 - camelid:config-example-gitattributes, r=Mark-Simulacrum
Tell GitHub to highlight `config.toml.example` as TOML

This should be a nice small quality of life improvement when looking at
`config.toml.example` on GitHub or looking at diffs of it in PRs.
2021-03-27 12:37:21 +09:00
Yuki Okushi
c143267901
Rollup merge of #83388 - alamb:alamb/fmt-dcs, r=Mark-Simulacrum
Make # pretty print format easier to discover

# Rationale:

I use (cargo cult?) three formats in rust:  `{}`, debug `{:?}`, and pretty-print debug `{:#?}`. I discovered `{:#?}` in some blog post or guide when I started working in Rust. While `#` is documented I think it is hard to discover. So taking the good advice of ```@carols10cents```  I am trying to improve the docs with a PR

As a reminder "pretty print" means that where `{:?}` will print something like
```
foo: { b1: 1, b2: 2}
```

`{:#?}` will prints something like
```
foo {
  b1: 1
  b2: 3
}
```

# Changes
Add an example to `fmt` to try and make it easier to discover `#`
2021-03-27 12:37:20 +09:00
Yuki Okushi
d7216bae23
Rollup merge of #83343 - osa1:issue83340, r=jackh726
Simplify and fix byte skipping in format! string parser

Fixes '\\' handling in format strings.

Fixes #83340
2021-03-27 12:37:19 +09:00
Yuki Okushi
14d0d51f6f
Rollup merge of #83328 - tmiasko:asm-test, r=joshtriplett
Fixes to inline assmebly tests

* Join test thread to make assertion effective in sym.rs test case
* Use a single codegen unit to reduce non-determinism in srcloc.rs test #82886
2021-03-27 12:37:19 +09:00
Yuki Okushi
5473b6dcfc
Rollup merge of #83239 - JohnTitor:reduce-deps, r=Mark-Simulacrum
Remove/replace some outdated crates from the dependency tree

- Remove `cloudabi` by updating `parking_lot` to 0.11.1.
- Replace `packed_simd` with `packed_simd2` by updating `bytecount` to 0.6.2.
2021-03-27 12:37:18 +09:00
bors
f811f14006 Auto merge of #83418 - ehuss:update-cargo, r=ehuss
Update cargo

12 commits in 90691f2bfe9a50291a98983b1ed2feab51d5ca55..1e8703890f285befb5e32627ad4e0a0454dde1fb
2021-03-16 21:36:55 +0000 to 2021-03-26 16:59:39 +0000
- tests: Tolerate "exit status" in error messages (rust-lang/cargo#9307)
- Default macOS targets to `unpacked` debuginfo (rust-lang/cargo#9298)
- Fix publication of packages with metadata and resolver (rust-lang/cargo#9300)
- Fix config includes not working. (rust-lang/cargo#9299)
- Emit note when `--future-incompat-report` had nothing to report (rust-lang/cargo#9263)
- RFC 3052: Stop including authors field in manifests made by cargo new (rust-lang/cargo#9282)
- Refactor feature handling, and improve error messages. (rust-lang/cargo#9290)
- Split out cargo-util package for cargo-test-support. (rust-lang/cargo#9292)
- Fix redundant_semicolons warning in resolver-tests. (rust-lang/cargo#9293)
- Use serde's error message option to avoid implementing `Deserialize`. (rust-lang/cargo#9237)
- Allow `cargo update` to operate with the --offline flag (rust-lang/cargo#9279)
- Fix typo in faq.md (rust-lang/cargo#9285)
2021-03-26 23:01:18 +00:00
Eric Huss
ea194b8b33 Update cargo 2021-03-26 12:29:08 -07:00
lcnr
7ca2c981b2
fix doc comment for `ty::Dynamic 2021-03-26 19:52:09 +01:00
Linus Färnstrand
147316a094 Document that the SocketAddr memory representation is not stable 2021-03-26 19:44:06 +01:00
bors
5e65467eff Auto merge of #83488 - Aaron1011:ban-expr-inner-attrs, r=petrochenkov
Ban custom inner attributes in expressions and statements

Split out from https://github.com/rust-lang/rust/pull/82608

Custom inner attributes are unstable, so this won't break any stable users.
This allows us to speed up token collection, and avoid a redundant call to `collect_tokens_no_attrs` when parsing an `Expr` that has outer attributes.

r? `@petrochenkov`
2021-03-26 17:26:18 +00:00
bors
b8719c51e0 Auto merge of #83404 - michaelwoerister:issue83045, r=eddyb
Fix #83045 by moving some crate loading verification code to a better place

r? `@eddyb`
2021-03-26 14:39:02 +00:00
bors
e423058751 Auto merge of #82980 - tmiasko:import-cold-multiplier, r=michaelwoerister
Import small cold functions

The Rust code is often written under an assumption that for generic
methods inline attribute is mostly unnecessary, since for optimized
builds using ThinLTO, a method will be code generated in at least one
CGU and available for import.

For example, deref implementations for Box, Vec, MutexGuard, and
MutexGuard are not currently marked as inline, neither is identity
implementation of From trait.

In PGO builds, when functions are determined to be cold, the default
multiplier of zero will stop the import, no matter how trivial the
implementation.

Increase slightly the default multiplier from 0 to 0.1.

r? `@ghost`
2021-03-26 11:57:44 +00:00
12101111
656f6ac975
Handle llvm_version with suffix like "12.0.0libcxx" 2021-03-26 17:29:52 +08:00
bors
4137088d9d Auto merge of #83079 - osa1:issue83046, r=m-ou-se
Update char::escape_debug_ext to handle different escapes in strings and chars

Fixes #83046

The program

    fn main() {
        println!("{:?}", '"');
        println!("{:?}", "'");
    }

would previously print

    '\"'
    "\'"

With this patch it now prints:

    '"'
    "'"
2021-03-26 09:11:18 +00:00
Michael Woerister
09bab38291 Fix #83045 by moving some crate loading verification code to a better place. 2021-03-26 09:59:10 +01:00
Ömer Sinan Ağacan
819247f179 Update char::escape_debug_ext to handle different escapes in strings vs. chars
Fixes #83046

The program

    fn main() {
        println!("{:?}", '"');
        println!("{:?}", "'");
    }

would previously print

    '\"'
    "\'"

With this patch it now prints:

    '"'
    "'"
2021-03-26 11:23:51 +03:00
bors
13167029c2 Auto merge of #83480 - flip1995:clippyup, r=Dylan-DPC
Update Clippy

Bi-weekly Clippy update.

r? `@Manishearth`
2021-03-26 06:30:16 +00:00
JohnTitor
4590d544cc Use the direct link to the platform support page 2021-03-26 14:32:19 +09:00
bors
7637fd588b Auto merge of #83503 - Dylan-DPC:rollup-mqvjfav, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #83055 ([rustdoc] Don't document stripped items in JSON renderer.)
 - #83437 (Refactor #82270 as lint instead of an error)
 - #83444 (Fix bootstrap tests on beta)
 - #83456 (Add docs for Vec::from functions)
 - #83463 (ExitStatusExt: Fix missing word in two docs messages)
 - #83470 (Fix patch note about #80653 not mentioning nested nor recursive)
 - #83485 (Mark asm tests as requiring LLVM 10.0.1)
 - #83486 (Don't ICE when using `#[global_alloc]` on a non-item statement)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-26 04:10:13 +00:00
Dylan DPC
b0bec95534
Rollup merge of #83486 - Aaron1011:fix/global-alloc-error, r=petrochenkov
Don't ICE when using `#[global_alloc]` on a non-item statement

Fixes #83469

We need to return an `Annotatable::Stmt` if we were passed an
`Annotatable::Stmt`
2021-03-26 02:34:45 +01:00
Dylan DPC
c5edb4f28e
Rollup merge of #83485 - Amanieu:asm_llvm10, r=joshtriplett
Mark asm tests as requiring LLVM 10.0.1
2021-03-26 02:34:44 +01:00
Dylan DPC
59205f7759
Rollup merge of #83470 - danielhenrymantilla:patch-1, r=jyn514
Fix patch note about #80653 not mentioning nested nor recursive

Which thus missed the point of the change: `rustdoc` already bundled documentation for methods accessible through one layer of `Deref`, it has now been enhanced to keep recursing 🙂

r? ``@jyn514``
2021-03-26 02:34:43 +01:00
Dylan DPC
85d08e9afe
Rollup merge of #83463 - ijackson:exitstatusext-doc-grammar, r=kennytm
ExitStatusExt: Fix missing word in two docs messages

Looks like I missed the lack of these "and"s.
2021-03-26 02:34:42 +01:00
Dylan DPC
827d1ea590
Rollup merge of #83456 - notriddle:vec-from-docs, r=JohnTitor
Add docs for Vec::from functions

Part of #51430
2021-03-26 02:34:41 +01:00