Dylan DPC [Fri, 11 Mar 2022 12:38:36 +0000 (13:38 +0100)]
Rollup merge of #93283 - m1guelperez:master, r=Mark-Simulacrum
Fix for localized windows editions in testcase fn read_link() Issue#93211
This PR aims to fix the issue with localized windows versions that do not necessarily have the folder "Documents and settings" in English.
The idea was provided by `@the8472.` We check if the "CI" environment variable is set, then we always check for the "Documents and Settings"-folder, otherwise we check if the folder exists on the local machine, and if not we skip this assert.
Dylan DPC [Fri, 11 Mar 2022 02:32:06 +0000 (03:32 +0100)]
Rollup merge of #94826 - allgoewer:fix-retain-documentation, r=yaahc
Improve doc wording for retain on some collections
I found the documentation wording on the various retain methods on many collections to be unusual.
I tried to invert the relation by switching `such that` with `for which` .
Dylan DPC [Fri, 11 Mar 2022 02:32:04 +0000 (03:32 +0100)]
Rollup merge of #94765 - m-ou-se:is-some-and, r=Dylan-DPC
Rename is_{some,ok,err}_with to is_{some,ok,err}_and.
This renames `is_{some,ok,err}_with` to `is_{some,ok,err}_and`. This was discussed on the [tracking issue](https://github.com/rust-lang/rust/issues/93050).
Dylan DPC [Fri, 11 Mar 2022 02:32:02 +0000 (03:32 +0100)]
Rollup merge of #93293 - nvzqz:nonzero-min-max, r=joshtriplett
Implement `MIN`/`MAX` constants for non-zero integers
This adds the associated [`MIN`](https://doc.rust-lang.org/stable/std/primitive.usize.html#associatedconstant.MIN)/[`MAX`](https://doc.rust-lang.org/stable/std/primitive.usize.html#associatedconstant.MAX) constants to `NonZero{U,I}{8,16,32,64,128,size}`, requested in #89065.
This reimplements #89077 due that PR being stagnant for 4 months. I am fine with closing this in favor of that one if the author revisits it. If so, I'd like to see that PR have the docs link to the `$Int`'s constants.
Dylan DPC [Thu, 10 Mar 2022 22:12:59 +0000 (23:12 +0100)]
Rollup merge of #94719 - jonhoo:enable-static-lld, r=Mark-Simulacrum
Statically compile libstdc++ everywhere if asked
PR #93918 made it so that `-static-libstdc++` was only set in one place,
and was only set during linking, but accidentally also made it so that
it is no longer passed when building LLD, only when building LLVM
itself. This moves the logic for setting `-static-libstdc++` in the
linker flags to `configure_cmake` so that it takes effect for all CMake
invocations in `native.rs`.
As a side-effect, this also causes libstdc++ to be statically compiled
into sanitizers, whereas previously the `llvm-static-stdcpp` flag had no
effect on sanitizers. It also makes it so that LLD will be compiled
statically if `llvm-tools-enabled` is set, even though previously it was
only linked statically if `llvm-static-stdcpp` was set explicitly. Both
of these seem like they match expected behavior than what was there
prior to #93918.
Dylan DPC [Thu, 10 Mar 2022 22:12:57 +0000 (23:12 +0100)]
Rollup merge of #94274 - djkoloski:unknown_unstable_lints, r=tmandry
Treat unstable lints as unknown
This change causes unstable lints to be ignored if the `unknown_lints`
lint is allowed. To achieve this, it also changes lints to apply as soon
as they are processed. Previously, lints in the same set were processed
as a batch and then all simultaneously applied.
Implementation of https://github.com/rust-lang/compiler-team/issues/469
Dylan DPC [Thu, 10 Mar 2022 22:12:57 +0000 (23:12 +0100)]
Rollup merge of #93950 - T-O-R-U-S:use-modern-formatting-for-format!-macros, r=Mark-Simulacrum
Use modern formatting for format! macros
This updates the standard library's documentation to use the new format_args syntax.
The documentation is worthwhile to update as it should be more idiomatic
(particularly for features like this, which are nice for users to get acquainted
with). The general codebase is likely more hassle than benefit to update: it'll
hurt git blame, and generally updates can be done by folks updating the code if
(and when) that makes things more readable with the new format.
A few places in the compiler and library code are updated (mostly just due to
already having been done when this commit was first authored).
`eprintln!("{}", e)` becomes `eprintln!("{e}")`, but `eprintln!("{}", e.kind())` remains untouched.
bors [Thu, 10 Mar 2022 18:28:45 +0000 (18:28 +0000)]
Auto merge of #94814 - matthiaskrgr:rollup-a5sk366, r=matthiaskrgr
Rollup of 8 pull requests
Successful merges:
- #94440 (Better error for normalization errors from parent crates that use `#![feature(generic_const_exprs)]`)
- #94587 (Document new recommended use of `FromIterator::from_iter`)
- #94644 (Fix soundness issue in scoped threads.)
- #94740 (Unify impl blocks by wrapping them into a div)
- #94753 (Improve rustdoc book)
- #94796 (Allow `cargo run` instead of `cargo run -p bootstrap`)
- #94805 (Revert accidental stabilization)
- #94809 (RustWrapper: add missing include)
Matthias Krüger [Thu, 10 Mar 2022 18:00:10 +0000 (19:00 +0100)]
Rollup merge of #94796 - jyn514:cargo-run-bootstrap, r=Mark-Simulacrum
Allow `cargo run` instead of `cargo run -p bootstrap`
This was part of `@Mark-Simulacrum` 's original PR in https://github.com/rust-lang/rust/commit/ecb424f12992a4aebace8a153d5efea040327a01,
but I missed it when writing #92260.
This also has the side effect of allowing `cargo build --bins` instead of `cargo build -p bootstrap --bins`. I'm not sure when you would want to run cargo build/check/test without going through bootstrap, but this still allows you to do so as long as you pass `-p` for all the crates you want to build.
Matthias Krüger [Thu, 10 Mar 2022 18:00:09 +0000 (19:00 +0100)]
Rollup merge of #94753 - Urgau:rustdoc-book-improvements, r=GuillaumeGomez
Improve rustdoc book
This pull-request improves the `rustdoc` book by doing some (light) cleanup, by merging some stuff, by adding some missing stuff (like tracking issues links, for those who had one) and also by moving some chapter's into sub-chapter's to improve the flow of the book.
~~Note that I locally tested with `mdbook-lintcheck` that no links became accidentally broken.~~ (Not enough, ;-))
Matthias Krüger [Thu, 10 Mar 2022 18:00:08 +0000 (19:00 +0100)]
Rollup merge of #94740 - GuillaumeGomez:unify-impl-blocks, r=notriddle
Unify impl blocks by wrapping them into a div
The blanket and "auto traits" sections are wrapped into a `div` with an ID. This PR fixes this incoherence by wrapping each impl section (the "deref impl" and the "inherent impl" sections were missing it). It'll also make some tests simpler to write.
Matthias Krüger [Thu, 10 Mar 2022 18:00:07 +0000 (19:00 +0100)]
Rollup merge of #94644 - m-ou-se:scoped-threads-drop-soundness, r=joshtriplett
Fix soundness issue in scoped threads.
This was discovered in https://github.com/rust-lang/rust/pull/94559#discussion_r820116323
The `scope()` function returns when all threads are finished, but I accidentally considered a thread 'finished' before dropping their panic payload or ignored return value.
So if a thread returned (or panics with) something that in its `Drop` implementation still uses borrowed stuff, it goes wrong.
Matthias Krüger [Thu, 10 Mar 2022 18:00:06 +0000 (19:00 +0100)]
Rollup merge of #94587 - JKAnderson409:issue-90107-fix, r=scottmcm
Document new recommended use of `FromIterator::from_iter`
#90107
Most of the added prose was paraphrased from the links provided in the issue. The suggested `VecDeque` example seemed to make the point well enough so I just used that.
Matthias Krüger [Thu, 10 Mar 2022 18:00:05 +0000 (19:00 +0100)]
Rollup merge of #94440 - compiler-errors:issue-94282, r=lcnr
Better error for normalization errors from parent crates that use `#![feature(generic_const_exprs)]`
This PR implements a somewhat rudimentary heuristic to suggest using `#![feature(generic_const_exprs)]` in a child crate when a function from a foreign crate (that may have used `#![feature(generic_const_exprs)]`) fails to normalize during codegen.
T-O-R-U-S [Sat, 12 Feb 2022 19:16:17 +0000 (23:16 +0400)]
Use implicit capture syntax in format_args
This updates the standard library's documentation to use the new syntax. The
documentation is worthwhile to update as it should be more idiomatic
(particularly for features like this, which are nice for users to get acquainted
with). The general codebase is likely more hassle than benefit to update: it'll
hurt git blame, and generally updates can be done by folks updating the code if
(and when) that makes things more readable with the new format.
A few places in the compiler and library code are updated (mostly just due to
already having been done when this commit was first authored).
bors [Thu, 10 Mar 2022 12:32:01 +0000 (12:32 +0000)]
Auto merge of #94802 - matthiaskrgr:rollup-4plu0fi, r=matthiaskrgr
Rollup of 5 pull requests
Successful merges:
- #92150 (Improve suggestion when casting usize to (possibly) wide pointer)
- #94635 (Merge `#[deprecated]` and `#[rustc_deprecated]`)
- #94657 (Constify `Index{,Mut}` for `[T]`, `str`, and `[T; N]`)
- #94746 (diagnostics: use rustc_on_unimplemented to recommend `[].iter()`)
- #94788 (Account for suggestions for complete removal of lines)
Matthias Krüger [Thu, 10 Mar 2022 11:20:51 +0000 (12:20 +0100)]
Rollup merge of #94635 - jhpratt:merge-deprecated-attrs, r=davidtwco
Merge `#[deprecated]` and `#[rustc_deprecated]`
The first commit makes "reason" an alias for "note" in `#[rustc_deprecated]`, while still prohibiting it in `#[deprecated]`.
The second commit changes "suggestion" to not just be a feature of `#[rustc_deprecated]`. This is placed behind the new `deprecated_suggestion` feature. This needs a tracking issue; let me know if this PR will be approved and I can create one.
The third commit is what permits `#[deprecated]` to be used when `#![feature(staged_api)]` is enabled. This isn't yet used in stdlib (only tests), as it would require duplicating all deprecation attributes until a bootstrap occurs. I intend to submit a follow-up PR that replaces all uses and removes the remaining `#[rustc_deprecated]` code after the next bootstrap.
Matthias Krüger [Thu, 10 Mar 2022 11:20:50 +0000 (12:20 +0100)]
Rollup merge of #92150 - compiler-errors:better_usize_to_wide_ptr_cast, r=petrochenkov
Improve suggestion when casting usize to (possibly) wide pointer
I thought #92125 was a wonderful idea, so I went ahead and took a stab at it. Not sure if my approach is the best going forward, but I'm happy with the improvement in the error message.
Iwill definitely address any changes if people are more opinionated with the wordings or want more features.
Scott McMurray [Sun, 6 Mar 2022 07:51:10 +0000 (23:51 -0800)]
short-circuit the easy cases in `is_copy_modulo_regions`
This change is somewhat extensive, since it affects MIR -- since this is called to determine Copy vs Move -- so any test that's `no_core` needs to actually have the normal `impl`s it uses.
bors [Thu, 10 Mar 2022 05:53:59 +0000 (05:53 +0000)]
Auto merge of #94059 - b-naber:constantkind-val-transformation, r=lcnr
Treat constant values as mir::ConstantKind::Val
Another step that is necessary for the introduction of Valtrees: we don't want to treat `ty::Const` instances of kind `ty::ConstKind::Value` as `mir::ConstantKind::Ty` anymore.
bors [Thu, 10 Mar 2022 02:38:43 +0000 (02:38 +0000)]
Auto merge of #94787 - matthiaskrgr:rollup-yyou15f, r=matthiaskrgr
Rollup of 8 pull requests
Successful merges:
- #91804 (Make some `Clone` impls `const`)
- #92541 (Mention intent of `From` trait in its docs)
- #93057 (Add Iterator::collect_into)
- #94739 (Suggest `if let`/`let_else` for refutable pat in `let`)
- #94754 (Warn users about `||` in let chain expressions)
- #94763 (Add documentation about lifetimes to thread::scope.)
- #94768 (Ignore `close_read_wakes_up` test on SGX platform)
- #94772 (Add miri to the well known conditional compilation names and values)
bors [Thu, 10 Mar 2022 00:15:39 +0000 (00:15 +0000)]
Auto merge of #94737 - lcnr:pass-stuff-by-value, r=davidtwco
add `#[rustc_pass_by_value]` to more types
the only interesting changes here should be to `TransitiveRelation`, but I believe to be highly unlikely that we will ever use a non `Copy` type with this type.
Matthias Krüger [Wed, 9 Mar 2022 22:14:16 +0000 (23:14 +0100)]
Rollup merge of #94772 - Urgau:check-cfg-miri, r=petrochenkov
Add miri to the well known conditional compilation names and values
This pull request adds `miri` to the list of well known names and values of the conditional compilation checking (`--check-cfg`).
This was brought up in [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/RFC.203013.3A.20Checking.20conditional.20compilation.20at.20compile.20time/near/274513827) when discussing about the future of `--check-cfg`.
Matthias Krüger [Wed, 9 Mar 2022 22:14:11 +0000 (23:14 +0100)]
Rollup merge of #93057 - frengor:iter_collect_into, r=m-ou-se
Add Iterator::collect_into
This PR adds `Iterator::collect_into` as proposed by ``@cormacrelf`` in #48597 (see https://github.com/rust-lang/rust/pull/48597#issuecomment-842083688).
Followup of #92982.
This adds the following method to the Iterator trait:
Matthias Krüger [Wed, 9 Mar 2022 22:14:10 +0000 (23:14 +0100)]
Rollup merge of #92541 - asquared31415:from-docs, r=m-ou-se
Mention intent of `From` trait in its docs
This pr is a docs modification to add to the documentation of the `From` trait a note about its intent as a perfect conversion. This is already stated in the `TryFrom` docs so this is simply adding that information in a more visible way.
Matthias Krüger [Wed, 9 Mar 2022 22:14:09 +0000 (23:14 +0100)]
Rollup merge of #91804 - woppopo:const_clone, r=oli-obk
Make some `Clone` impls `const`
Tracking issue: #91805
`Clone::clone_from` and some impls (Option, Result) bounded on `~const Drop`.
```rust
// core::clone
impl const Clone for INTEGER
impl const Clone for FLOAT
impl const Clone for bool
impl const Clone for char
impl const Clone for !
impl<T: ?Sized> const Clone for *const T
impl<T: ?Sized> const Clone for *mut T
impl<T: ?Sized> const Clone for &T
// core::option
impl<T> const Clone for Option<T>
where
T: ~const Clone + ~const Drop
bors [Wed, 9 Mar 2022 06:30:19 +0000 (06:30 +0000)]
Auto merge of #94761 - Dylan-DPC:rollup-v4emqsy, r=Dylan-DPC
Rollup of 6 pull requests
Successful merges:
- #94312 (Edit `rustc_trait_selection::infer::lattice` docs)
- #94583 (Add a team for '`@rustbot` ping fuchsia')
- #94686 (Do not allow `#[rustc_legacy_const_generics]` on methods)
- #94699 (BTree: remove dead data needlessly complicating insert)
- #94756 (Use `unreachable!` for an unreachable code path)
- #94759 (Update cargo)
Dylan DPC [Wed, 9 Mar 2022 05:38:53 +0000 (06:38 +0100)]
Rollup merge of #94759 - ehuss:update-cargo, r=ehuss
Update cargo
11 commits in 3d6970d50e30e797b8e26b2b9b1bdf92dc381f34..65c82664263feddc5fe2d424be0993c28d46377a
2022-02-28 19:29:07 +0000 to 2022-03-09 02:32:56 +0000
- Remove remaining 2 warn(clippy::*) instances (rust-lang/cargo#10438)
- Use `available_parallelism` instead of `num_cpus` (rust-lang/cargo#10427)
- Wait up to one second while waiting for curl (rust-lang/cargo#10456)
- Improve code coverage (rust-lang/cargo#10460)
- Don't recommend leaking tokens into the console history (rust-lang/cargo#10458)
- fix some typos (rust-lang/cargo#10454)
- Use `extend` instead of `push`ing in a loop (rust-lang/cargo#10453)
- Use locked_version more (rust-lang/cargo#10449)
- Disable dependabot (rust-lang/cargo#10443)
- Update git2 dependencies (rust-lang/cargo#10442)
- Stop gating stable features (rust-lang/cargo#10434)
bors [Wed, 9 Mar 2022 02:17:58 +0000 (02:17 +0000)]
Auto merge of #94750 - cuviper:dirent64_min, r=joshtriplett
unix: reduce the size of DirEntry
On platforms where we call `readdir` instead of `readdir_r`, we store
the name as an allocated `CString` for variable length. There's no point
carrying around a full `dirent64` with its fixed-length `d_name` too.