]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #7627 - xFrednet:0000-updating-issue-templates-again, r=llogiq
bors [Sun, 5 Sep 2021 14:53:33 +0000 (14:53 +0000)]
Auto merge of #7627 - xFrednet:0000-updating-issue-templates-again, r=llogiq

Updating issue templates again for rustbot

It turns out that our current issue template can sometimes trigger a rustbot error message, as can be seen in [#7626](https://github.com/rust-lang/rust-clippy/issues/7626). I originally tested this in #7599, but it's apparently a bit inconsistent. This PR adds backticks to the commands, as correctly suggested by `@mikerite` in the comments. (Thank you!)

``@rustbot` label +S-blocked`

---

Now I also pushed a tiny link fix as well. :upside_down_face:

---

changelog: none

2 years agoAuto merge of #7629 - mikerite:fix-7623-2, r=xFrednet
bors [Sun, 5 Sep 2021 13:17:02 +0000 (13:17 +0000)]
Auto merge of #7629 - mikerite:fix-7623-2, r=xFrednet

Make `approx_const` MSRV aware

changelog: [`approx_const`]: Add MRSV checks for LOG10_2 and LOG2_10.

Fixes #7623

2 years agoAuto merge of #88604 - camelid:rustdoc-lifetime-bounds, r=GuillaumeGomez
bors [Sun, 5 Sep 2021 12:52:34 +0000 (12:52 +0000)]
Auto merge of #88604 - camelid:rustdoc-lifetime-bounds, r=GuillaumeGomez

rustdoc: Clean up handling of lifetime bounds

Previously, rustdoc recorded lifetime bounds by rendering them into the
name of the lifetime parameter. Now, it leaves the name as the actual
name and instead records lifetime bounds in an `outlives` list, similar
to how type parameter bounds are recorded.

Also, higher-ranked lifetimes cannot currently have bounds, so I simplified
the code to reflect that.

r? `@GuillaumeGomez`

2 years agoAvoid slice indexing in Clippy (down with the ICEs)
xFrednet [Sat, 4 Sep 2021 16:21:49 +0000 (18:21 +0200)]
Avoid slice indexing in Clippy (down with the ICEs)

2 years agoAuto merge of #88662 - m-ou-se:rollup-h6lgp7k, r=m-ou-se
bors [Sun, 5 Sep 2021 10:11:37 +0000 (10:11 +0000)]
Auto merge of #88662 - m-ou-se:rollup-h6lgp7k, r=m-ou-se

Rollup of 4 pull requests

Successful merges:

 - #88257 (Provide more context on incorrect inner attribute)
 - #88432 (Fix a typo in raw_vec)
 - #88511 (x.py clippy: don't run with --all-targets by default)
 - #88657 (Fix 2021 `dyn` suggestion that used code as label)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoAdd tests
Giacomo Stevanato [Sat, 4 Sep 2021 12:00:10 +0000 (14:00 +0200)]
Add tests

2 years agoRollup merge of #88657 - camelid:fix-dyn-sugg, r=m-ou-se
Mara Bos [Sun, 5 Sep 2021 08:32:24 +0000 (10:32 +0200)]
Rollup merge of #88657 - camelid:fix-dyn-sugg, r=m-ou-se

Fix 2021 `dyn` suggestion that used code as label

The arguments to `span_suggestion` were in the wrong order, so the error
looked like this:

    error[E0783]: trait objects without an explicit `dyn` are deprecated
      --> src/test/ui/editions/dyn-trait-sugg-2021.rs:10:5
       |
    10 |     Foo::hi(123);
       |     ^^^ help: <dyn Foo>: `use `dyn``

Now the error looks like this, as expected:

    error[E0783]: trait objects without an explicit `dyn` are deprecated
      --> src/test/ui/editions/dyn-trait-sugg-2021.rs:10:5
       |
    10 |     Foo::hi(123);
       |     ^^^ help: use `dyn`: `<dyn Foo>`

This issue was only present in the 2021 error; the 2018 lint was
correct.

r? `@m-ou-se`

2 years agoRollup merge of #88511 - matthiaskrgr:xpyclippydefaulttarget, r=jyn514
Mara Bos [Sun, 5 Sep 2021 08:32:23 +0000 (10:32 +0200)]
Rollup merge of #88511 - matthiaskrgr:xpyclippydefaulttarget, r=jyn514

x.py clippy: don't run with --all-targets by default

this caused a lot of noise because benchmarks and tests were also checked

before:
`./x.py clippy |& wc -l`
`74026`

with change:
`./x.py clippy |& wc -l`
`43269`

Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/x.2Epy.20check.20default.20targets

r?  `@jyn514` or `@Mark-Simulacrum`

2 years agoRollup merge of #88432 - terrarier2111:patch-1, r=joshtriplett
Mara Bos [Sun, 5 Sep 2021 08:32:21 +0000 (10:32 +0200)]
Rollup merge of #88432 - terrarier2111:patch-1, r=joshtriplett

Fix a typo in raw_vec

2 years agoRollup merge of #88257 - estebank:invalid-attr-error, r=oli-obk
Mara Bos [Sun, 5 Sep 2021 08:32:20 +0000 (10:32 +0200)]
Rollup merge of #88257 - estebank:invalid-attr-error, r=oli-obk

Provide more context on incorrect inner attribute

Suggest changing an inner attribute into an outer attribute if followed by an item.

2 years agoAuto merge of #88603 - nikic:llvm-update, r=cuviper
bors [Sun, 5 Sep 2021 07:04:27 +0000 (07:04 +0000)]
Auto merge of #88603 - nikic:llvm-update, r=cuviper

Update LLVM submodule

This merges upstream `release/13.x` changes to our fork. In particular, this fixes #85580.

2 years agoImprove `approx_constant` output
Michael Wright [Sun, 5 Sep 2021 06:42:00 +0000 (08:42 +0200)]
Improve `approx_constant` output

2 years agoAdd MSRV to `approx_constant` documentation
Michael Wright [Sun, 5 Sep 2021 06:19:30 +0000 (08:19 +0200)]
Add MSRV to `approx_constant` documentation

2 years agoCorrect typo
est31 [Sun, 5 Sep 2021 06:04:20 +0000 (08:04 +0200)]
Correct typo

2 years agoAuto merge of #88559 - bjorn3:archive_logic_dedup, r=cjgillot
bors [Sun, 5 Sep 2021 04:37:12 +0000 (04:37 +0000)]
Auto merge of #88559 - bjorn3:archive_logic_dedup, r=cjgillot

Move add_rlib and add_native_library to cg_ssa

This deduplicates logic between codegen backends.

cc `@antoyo` and `@khyperia` for cg_gcc and rust-gpu.

2 years agoRemove SmallVector mention
est31 [Sun, 5 Sep 2021 04:08:34 +0000 (06:08 +0200)]
Remove SmallVector mention

SmallVector is long gone, as it's been first replaced
by OneVector in commit e5e6375352636360add297c1f5a1f37ce71506e9,
which then has been removed entirely in favour of SmallVec in
commit 130a32fa7259d348dc3a684b38e688da398c30bb.

2 years agoFix formatting
Theodore Luo Wang [Sun, 5 Sep 2021 02:38:39 +0000 (22:38 -0400)]
Fix formatting

2 years agoUse verbose suggestions and only match if the + is seen before a numeric literal
Theodore Luo Wang [Sun, 5 Sep 2021 02:35:59 +0000 (22:35 -0400)]
Use verbose suggestions and only match if the + is seen before a numeric literal

2 years agoAuto merge of #88469 - patrick-gu:master, r=dtolnay
bors [Sun, 5 Sep 2021 01:56:25 +0000 (01:56 +0000)]
Auto merge of #88469 - patrick-gu:master, r=dtolnay

Add links in docs for some primitive types

This pull request adds additional links in existing documentation of some of the primitive types.

Where items are linked only once, I have used the `[link](destination)` format. For items in `std`, I have linked directly to the HTML, since although the primitives are in `core`, they are not displayed on `core` documentation. I was unsure of what length I should keep lines of documentation to, so I tried to keep them within reason.

Additionally, I have avoided excessively linking to keywords like `self` when they are not relevant to the documentation. I can add these links if it would be an improvement.

I hope this can improve Rust. Please let me know if there's anything I did wrong!

2 years agoFix 2021 `dyn` suggestion that used code as label
Noah Lev [Sun, 5 Sep 2021 01:29:03 +0000 (18:29 -0700)]
Fix 2021 `dyn` suggestion that used code as label

The arguments to `span_suggestion` were in the wrong order, so the error
looked like this:

    error[E0783]: trait objects without an explicit `dyn` are deprecated
      --> src/test/ui/editions/dyn-trait-sugg-2021.rs:10:5
       |
    10 |     Foo::hi(123);
       |     ^^^ help: <dyn Foo>: `use `dyn``

Now the error looks like this, as expected:

    error[E0783]: trait objects without an explicit `dyn` are deprecated
      --> src/test/ui/editions/dyn-trait-sugg-2021.rs:10:5
       |
    10 |     Foo::hi(123);
       |     ^^^ help: use `dyn`: `<dyn Foo>`

This issue was only present in the 2021 error; the 2018 lint was
correct.

2 years agoUpdate clippy_lints/src/needless_option_as_deref.rs
lyj [Sun, 5 Sep 2021 00:33:04 +0000 (08:33 +0800)]
Update clippy_lints/src/needless_option_as_deref.rs

Co-authored-by: llogiq <bogusandre@gmail.com>
2 years agoAuto merge of #88626 - cjgillot:lfitb, r=petrochenkov
bors [Sat, 4 Sep 2021 23:11:07 +0000 (23:11 +0000)]
Auto merge of #88626 - cjgillot:lfitb, r=petrochenkov

Simplify lifetimes_from_impl_trait_bounds

Part of https://github.com/rust-lang/rust/pull/87234

r? `@petrochenkov`

2 years agoAuto merge of #7570 - HKalbasi:derivable-impls, r=camsteffen
bors [Sat, 4 Sep 2021 21:40:04 +0000 (21:40 +0000)]
Auto merge of #7570 - HKalbasi:derivable-impls, r=camsteffen

Add the `derivable_impls` lint

Fix #7550

changelog: Add new derivable_impls lint. mem_replace_with_default now covers non constructor cases.

2 years agoAuto merge of #7584 - shepmaster:unnecessary_expect, r=camsteffen
bors [Sat, 4 Sep 2021 21:25:55 +0000 (21:25 +0000)]
Auto merge of #7584 - shepmaster:unnecessary_expect, r=camsteffen

Extend unnecessary_unwrap to look for expect in addition to unwrap

changelog: Extend ``[`unnecessary_unwrap`]`` to also check for `Option::expect` and `Result::expect`. Also give code suggestions in some cases.

Fixes #7581

2 years agoadd derivable impls lint
hamidreza kalbasi [Mon, 16 Aug 2021 15:04:41 +0000 (19:34 +0430)]
add derivable impls lint

2 years agoAuto merge of #88364 - pietroalbini:llvm-install-filecheck, r=Mark-Simulacrum
bors [Sat, 4 Sep 2021 20:44:41 +0000 (20:44 +0000)]
Auto merge of #88364 - pietroalbini:llvm-install-filecheck, r=Mark-Simulacrum

Make sure FileCheck is copied in the LLVM output directory

The tool, which is needed by parts of our test suite, is built as part of LLVM but is *not* copied to the directory containing the output LLVM binaries. This adds a flag to ensure the binary is copied. This shouldn't add any extra built time, as the flag just installs extra binaries that were already compiled.

This is not strictly needed for the test suite to work (as it also checks `build/$target/llvm/build/bin` for the binary), but it allows deleting the `build/$TARGET/llvm/build` directory (which also contains the intermediary build artifacts) without affecting the test suite, saving disk space.

2 years agoClarify what “a container” is in `FromIterator<Option<A>> for Option<V>` doc.
Kevin Reid [Sat, 4 Sep 2021 18:19:59 +0000 (11:19 -0700)]
Clarify what “a container” is in `FromIterator<Option<A>> for Option<V>` doc.

2 years agoAdd sentence punctuation and links in `Option` docs.
Kevin Reid [Sat, 4 Sep 2021 18:17:34 +0000 (11:17 -0700)]
Add sentence punctuation and links in `Option` docs.

2 years ago“Moves” instead of “copies” in `<Option<T> as From<T>>::from` doc.
Kevin Reid [Sat, 4 Sep 2021 18:05:36 +0000 (11:05 -0700)]
“Moves” instead of “copies” in `<Option<T> as From<T>>::from` doc.

This implementation has no `Copy` or `Clone` bound, so its operation is
guaranteed to be a move. The call site might copy, but the function
itself cannot.

Also linkify `Some` while we're touching the line anyway.

2 years agoDocument when to use Windows' `symlink_dir` vs. `symlink_file`
Chris Denton [Sat, 4 Sep 2021 18:22:34 +0000 (19:22 +0100)]
Document when to use Windows' `symlink_dir` vs. `symlink_file`

It was previously unclear which should be used when.

2 years agoAuto merge of #88574 - camelid:box-genericarg-const, r=GuillaumeGomez
bors [Sat, 4 Sep 2021 18:18:00 +0000 (18:18 +0000)]
Auto merge of #88574 - camelid:box-genericarg-const, r=GuillaumeGomez

rustdoc: Box `GenericArg::Const` to reduce enum size

This should reduce the amount of memory allocated in the common cases
where the `GenericArg` is a lifetime or type.

2 years agoneedless_option_as_deref
lengyijun [Tue, 24 Aug 2021 14:06:46 +0000 (22:06 +0800)]
needless_option_as_deref

2 years agoAuto merge of #88550 - dpaoliello:dpaoliello/allocdebuginfo, r=estebank
bors [Sat, 4 Sep 2021 12:27:45 +0000 (12:27 +0000)]
Auto merge of #88550 - dpaoliello:dpaoliello/allocdebuginfo, r=estebank

Include debug info for the allocator shim

Issue Details:
In some cases it is necessary to generate an "allocator shim" to forward various Rust allocation functions (e.g., `__rust_alloc`) to an underlying function (e.g., `malloc`). However, since this allocator shim is a manually created LLVM module it is not processed via the normal module processing code and so no debug info is generated for it (if debugging info is enabled).

Fix Details:
* Modify the `debuginfo` code to allow creating debug info for a module without a `CodegenCx` (since it is difficult, and expensive, to create one just to emit some debug info).
* After creating the allocator shim add in basic debug info.

2 years agoFix documentation of eval_order_dependence
chansuke [Sat, 4 Sep 2021 12:07:25 +0000 (21:07 +0900)]
Fix documentation of eval_order_dependence

2 years agoFix #88256, remove duplicated diagnostic
yukang [Sat, 4 Sep 2021 11:26:25 +0000 (19:26 +0800)]
Fix #88256, remove duplicated diagnostic

2 years agoFix #88256, remove duplicated diagnostic
yukang [Sat, 4 Sep 2021 11:26:25 +0000 (19:26 +0800)]
Fix #88256, remove duplicated diagnostic

2 years agoAuto merge of #88547 - notriddle:notriddle/is-expr-delims-necessary, r=davidtwco
bors [Sat, 4 Sep 2021 09:46:58 +0000 (09:46 +0000)]
Auto merge of #88547 - notriddle:notriddle/is-expr-delims-necessary, r=davidtwco

fix(rustc_lint): better detect when parens are necessary

Fixes #88519

2 years agoAuto merge of #88538 - bjorn3:no_session_in_crate_loader, r=petrochenkov
bors [Sat, 4 Sep 2021 07:17:12 +0000 (07:17 +0000)]
Auto merge of #88538 - bjorn3:no_session_in_crate_loader, r=petrochenkov

CrateLocator refactorings

This makes the `CrateLocator` a lot cleaner IMHO and much more self-contained. The last commit removes `extra_filename` from the crate metadata. This is an **insta-stable** change as it allows a crate like `libfoo-abc.rlib` to be used as dependency and then be renamed as `libfoo-bcd.rlib` while still being found as indirect dependency. This may reduce performance when there are a lot of versions of the same crate available as the extra filename won't be used to do an early rejection of crates before trying to load metadata, but it makes the logic to find the right filename a lot cleaner.

2 years agoAuto merge of #88633 - Mark-Simulacrum:bump-version, r=Mark-Simulacrum
bors [Sat, 4 Sep 2021 04:32:59 +0000 (04:32 +0000)]
Auto merge of #88633 - Mark-Simulacrum:bump-version, r=Mark-Simulacrum

Bump version to 1.57

r? `@Mark-Simulacrum`

2 years agoBump version to 1.57
Mark Rousskov [Sat, 4 Sep 2021 01:54:48 +0000 (21:54 -0400)]
Bump version to 1.57

2 years agoAuto merge of #88598 - estebank:type-ascription-can-die-in-a-fire, r=wesleywiser
bors [Sat, 4 Sep 2021 01:40:36 +0000 (01:40 +0000)]
Auto merge of #88598 - estebank:type-ascription-can-die-in-a-fire, r=wesleywiser

Detect bare blocks with type ascription that were meant to be a `struct` literal

Address part of #34255.

Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.

2 years agoFix accidentally deleted part
patrick-gu [Sat, 4 Sep 2021 00:13:42 +0000 (17:13 -0700)]
Fix accidentally deleted part

2 years agoAdd a missing backtick
patrick-gu [Sat, 4 Sep 2021 00:11:57 +0000 (17:11 -0700)]
Add a missing backtick

2 years agoRemove excessive linking
patrick-gu [Sat, 4 Sep 2021 00:09:37 +0000 (17:09 -0700)]
Remove excessive linking

2 years agoAuto merge of #88482 - athei:add-import-test, r=the8472
bors [Fri, 3 Sep 2021 23:12:35 +0000 (23:12 +0000)]
Auto merge of #88482 - athei:add-import-test, r=the8472

Add regression test for a spurious import

This PR adds a test that verifies that the bug described in the linked issue does not creep back into the code. In essence it checks that compiling some specific code (that uses 128 bit multiplication) with a specific set of compiler options does not lead to a spurious import of a panic function.

I noticed that other wasm tests use `# only-wasm32-bare` in their `Makefile`. This will skip the test for me. I did not find out how to run this test locally. Maybe someone can help.

closes #78744
r? `@jyn514`

2 years agoReplace Vec by Option.
Camille GILLOT [Thu, 1 Apr 2021 17:42:27 +0000 (19:42 +0200)]
Replace Vec by Option.

2 years agoSimplify lifetimes_from_impl_trait_bounds.
Camille GILLOT [Thu, 15 Jul 2021 21:00:42 +0000 (23:00 +0200)]
Simplify lifetimes_from_impl_trait_bounds.

2 years agorustdoc: Box `GenericArg::Const` to reduce enum size
Noah Lev [Wed, 1 Sep 2021 22:26:07 +0000 (15:26 -0700)]
rustdoc: Box `GenericArg::Const` to reduce enum size

2 years agoAuto merge of #88572 - matthewjasper:if-let-scoping-fix, r=oli-obk
bors [Fri, 3 Sep 2021 20:31:43 +0000 (20:31 +0000)]
Auto merge of #88572 - matthewjasper:if-let-scoping-fix, r=oli-obk

Fix drop handling for `if let` expressions

MIR lowering for `if let` expressions is now more complicated now that
`if let` exists in HIR. This PR adds a scope for the variables bound in
an `if let` expression and then uses an approach similar to how we
handle loops to ensure that we reliably drop the correct variables.

Closes #88307
cc `@flip1995` `@richkadel` `@c410-f3r`

2 years agoUpdate coverage tests
Matthew Jasper [Fri, 3 Sep 2021 18:51:27 +0000 (19:51 +0100)]
Update coverage tests

2 years agoAuto merge of #88454 - devnexen:sunos_asan, r=wesleywiser
bors [Fri, 3 Sep 2021 17:50:51 +0000 (17:50 +0000)]
Auto merge of #88454 - devnexen:sunos_asan, r=wesleywiser

sunos systems add sanitizer supported.

2 years agoAuto merge of #88597 - cjgillot:lower-global, r=petrochenkov
bors [Fri, 3 Sep 2021 14:47:13 +0000 (14:47 +0000)]
Auto merge of #88597 - cjgillot:lower-global, r=petrochenkov

Move global analyses from lowering to resolution

Split off https://github.com/rust-lang/rust/pull/87234

r? `@petrochenkov`

2 years agoDetect bare blocks with type ascription that were meant to be a `struct` literal
Esteban Kuber [Thu, 2 Sep 2021 18:34:03 +0000 (18:34 +0000)]
Detect bare blocks with type ascription that were meant to be a `struct` literal

Address part of #34255.

Potential improvement: silence the other knock down errors in
`issue-34255-1.rs`.

2 years agoCorrect link in documentation for the file `clippy_lints::utils::conf`
Fridtjof Stoldt [Fri, 3 Sep 2021 13:31:53 +0000 (15:31 +0200)]
Correct link in documentation for the file `clippy_lints::utils::conf`

2 years agoUpdating issue templates again for rustbot
xFrednet [Fri, 3 Sep 2021 10:12:16 +0000 (12:12 +0200)]
Updating issue templates again for rustbot

2 years agoAuto merge of #88618 - m-ou-se:rollup-6tss5z6, r=m-ou-se
bors [Fri, 3 Sep 2021 11:37:52 +0000 (11:37 +0000)]
Auto merge of #88618 - m-ou-se:rollup-6tss5z6, r=m-ou-se

Rollup of 7 pull requests

Successful merges:

 - #88202 (Add an example for deriving PartialOrd on enums)
 - #88483 (Fix LLVM libunwind build for non-musl targets)
 - #88507 (Add test case for using `slice::fill` with MaybeUninit)
 - #88557 (small const generics cleanup)
 - #88579 (remove redundant / misplaced sentence from docs)
 - #88610 (Update outdated docs of array::IntoIter::new.)
 - #88613 (Update primitive docs for rust 2021.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #88613 - m-ou-se:array-docs-2021, r=Amanieu
Mara Bos [Fri, 3 Sep 2021 11:30:51 +0000 (13:30 +0200)]
Rollup merge of #88613 - m-ou-se:array-docs-2021, r=Amanieu

Update primitive docs for rust 2021.

Fixes https://github.com/rust-lang/rust/issues/87701

2 years agoRollup merge of #88610 - m-ou-se:array-into-iter-docs, r=Amanieu
Mara Bos [Fri, 3 Sep 2021 11:30:50 +0000 (13:30 +0200)]
Rollup merge of #88610 - m-ou-se:array-into-iter-docs, r=Amanieu

Update outdated docs of array::IntoIter::new.

2 years agoRollup merge of #88579 - ast-ral:master, r=m-ou-se
Mara Bos [Fri, 3 Sep 2021 11:30:49 +0000 (13:30 +0200)]
Rollup merge of #88579 - ast-ral:master, r=m-ou-se

remove redundant / misplaced sentence from docs

Removes sentence that seems to have drifted down into the examples section. Luckily, someone already added an explanation of what happens with packed structs back into the initial section of the doc entry and this wayward sentence can likely just be deleted.

2 years agoRollup merge of #88557 - lcnr:const-generics-cleanup, r=BoxyUwU
Mara Bos [Fri, 3 Sep 2021 11:30:48 +0000 (13:30 +0200)]
Rollup merge of #88557 - lcnr:const-generics-cleanup, r=BoxyUwU

small const generics cleanup

2 years agoRollup merge of #88507 - atsuzaki:slice-fill-maybeuninit-test, r=RalfJung
Mara Bos [Fri, 3 Sep 2021 11:30:47 +0000 (13:30 +0200)]
Rollup merge of #88507 - atsuzaki:slice-fill-maybeuninit-test, r=RalfJung

Add test case for using `slice::fill` with MaybeUninit

Adds test for #87891

Looks alright? `@RalfJung`
Fixes #87891

2 years agoRollup merge of #88483 - jethrogb:jb/llvm-libunwind-self-contained, r=petrochenkov
Mara Bos [Fri, 3 Sep 2021 11:30:46 +0000 (13:30 +0200)]
Rollup merge of #88483 - jethrogb:jb/llvm-libunwind-self-contained, r=petrochenkov

Fix LLVM libunwind build for non-musl targets

Broken in #85600. AFAICT, [only musl, mingw, and wasm](https://github.com/rust-lang/rust/blob/673d0db5e393e9c64897005b470bfeb6d5aec61b/compiler/rustc_target/src/spec/crt_objects.rs#L128-L132) should use the “self-contained” logic in rustbuild.

2 years agoRollup merge of #88202 - azdavis:master, r=jyn514
Mara Bos [Fri, 3 Sep 2021 11:30:46 +0000 (13:30 +0200)]
Rollup merge of #88202 - azdavis:master, r=jyn514

Add an example for deriving PartialOrd on enums

For some reason, I always forget which variants are smaller and which
are larger when you derive PartialOrd on an enum. And the wording in the
current docs is not entirely clear to me.

So, I often end up making a small enum, deriving PartialOrd on it, and
then writing a `#[test]` with an assert that the top one is smaller than
the bottom one (or the other way around) to figure out which way the
deriving goes.

So then I figured, it would be great if the standard library docs just
had that example, so if I keep forgetting, at least I can figure it out
quickly by looking at std's docs.

2 years agoUpdate primitive docs for rust 2021.
Mara Bos [Fri, 3 Sep 2021 10:49:37 +0000 (12:49 +0200)]
Update primitive docs for rust 2021.

2 years agoUpdate outdated docs of array::IntoIter::new.
Mara Bos [Fri, 3 Sep 2021 09:24:52 +0000 (11:24 +0200)]
Update outdated docs of array::IntoIter::new.

2 years agoAuto merge of #86454 - tlyu:refactor-unsized-suggestions, r=davidtwco
bors [Fri, 3 Sep 2021 08:51:21 +0000 (08:51 +0000)]
Auto merge of #86454 - tlyu:refactor-unsized-suggestions, r=davidtwco

Refactor unsized suggestions

`@rustbot` label +A-diagnostics +A-traits +A-typesystem +C-cleanup +T-compiler

2 years ago2229: Don't move out of drop type
Aman Arora [Wed, 1 Sep 2021 07:00:50 +0000 (03:00 -0400)]
2229: Don't move out of drop type

2 years agoMake `approx_const` MSRV aware
Michael Wright [Fri, 3 Sep 2021 06:34:34 +0000 (08:34 +0200)]
Make `approx_const` MSRV aware

Fixes #7623.

2 years agoAuto merge of #88428 - petrochenkov:stmtid, r=Aaron1011
bors [Fri, 3 Sep 2021 06:10:27 +0000 (06:10 +0000)]
Auto merge of #88428 - petrochenkov:stmtid, r=Aaron1011

expand: Treat more macro calls as statement macro calls

This PR implements the suggestion from https://github.com/rust-lang/rust/pull/87981#issuecomment-906641052 and treats fn-like macro calls inside `StmtKind::Item` and `StmtKind::Semi` as statement macro calls, which is consistent with treatment of attribute invocations in the same positions and with token-based macro expansion model in general.

This also allows to remove a special case in `NodeId` assignment (previously tried in #87779), and to use statement `NodeId`s for linting (`assign_id!`).

r? `@Aaron1011`

2 years agoReorder approx_consts constant to match rust docs
Michael Wright [Fri, 3 Sep 2021 04:41:30 +0000 (06:41 +0200)]
Reorder approx_consts constant to match rust docs

2 years agoAuto merge of #88386 - estebank:unmatched-delims, r=jackh726
bors [Fri, 3 Sep 2021 03:13:18 +0000 (03:13 +0000)]
Auto merge of #88386 - estebank:unmatched-delims, r=jackh726

Point at unclosed delimiters as part of the primary MultiSpan

Both the place where the parser encounters a needed closed delimiter and
the unclosed opening delimiter are important, so they should get the
same level of highlighting in the output.

_Context: https://twitter.com/mwk4/status/1430631546432675840_

2 years agoAdjust the output of unnecessary_unwrap and provide a suggestion
Jake Goulding [Wed, 18 Aug 2021 20:33:50 +0000 (16:33 -0400)]
Adjust the output of unnecessary_unwrap and provide a suggestion

2 years agoExtend unnecessary_unwrap to look for expect in addition to unwrap
Jake Goulding [Wed, 18 Aug 2021 13:56:25 +0000 (09:56 -0400)]
Extend unnecessary_unwrap to look for expect in addition to unwrap

Closes #7581

2 years agoAuto merge of #88363 - michaelwoerister:remapped-diagnostics, r=estebank
bors [Fri, 3 Sep 2021 00:23:10 +0000 (00:23 +0000)]
Auto merge of #88363 - michaelwoerister:remapped-diagnostics, r=estebank

Path remapping: Make behavior of diagnostics output dependent on presence of --remap-path-prefix.

This PR fixes a regression (#87745) with `--remap-path-prefix` where the flag stopped causing diagnostic messages to be remapped as well. The regression was introduced in https://github.com/rust-lang/rust/pull/83813 where we erroneously assumed that remapping of diagnostic messages was not desired anymore (because #70642 partially undid that functionality with nobody objecting).

The issue is fixed by making `--remap-path-prefix` remap diagnostic messages again, including for paths that have been remapped in upstream crates (e.g. the standard library). This means that "sysroot-localization" (implemented in #70642) is also disabled if `rustc` is invoked with `--remap-path-prefix`. The assumption is that once someone starts explicitly remapping paths they also don't want paths to their local Rust installation in their build output.

In the future we might want to give more fine-grained control over this behavior via compiler flags (see https://github.com/rust-lang/rfcs/pull/3127 for a related RFC). For now this PR is intended as a regression fix.

This PR is an alternative to https://github.com/rust-lang/rust/pull/88191, which makes diagnostic messages be remapped unconditionally. That approach, however, would effectively revert #70642.

Fixes https://github.com/rust-lang/rust/issues/87745.

cc `@cbeuw`
r? `@ghost`

2 years agoAuto merge of #88363 - michaelwoerister:remapped-diagnostics, r=estebank
bors [Fri, 3 Sep 2021 00:23:10 +0000 (00:23 +0000)]
Auto merge of #88363 - michaelwoerister:remapped-diagnostics, r=estebank

Path remapping: Make behavior of diagnostics output dependent on presence of --remap-path-prefix.

This PR fixes a regression (#87745) with `--remap-path-prefix` where the flag stopped causing diagnostic messages to be remapped as well. The regression was introduced in https://github.com/rust-lang/rust/pull/83813 where we erroneously assumed that remapping of diagnostic messages was not desired anymore (because #70642 partially undid that functionality with nobody objecting).

The issue is fixed by making `--remap-path-prefix` remap diagnostic messages again, including for paths that have been remapped in upstream crates (e.g. the standard library). This means that "sysroot-localization" (implemented in #70642) is also disabled if `rustc` is invoked with `--remap-path-prefix`. The assumption is that once someone starts explicitly remapping paths they also don't want paths to their local Rust installation in their build output.

In the future we might want to give more fine-grained control over this behavior via compiler flags (see https://github.com/rust-lang/rfcs/pull/3127 for a related RFC). For now this PR is intended as a regression fix.

This PR is an alternative to https://github.com/rust-lang/rust/pull/88191, which makes diagnostic messages be remapped unconditionally. That approach, however, would effectively revert #70642.

Fixes https://github.com/rust-lang/rust/issues/87745.

cc `@cbeuw`
r? `@ghost`

2 years agorustdoc: Higher-ranked lifetimes can't have bounds
Noah Lev [Thu, 2 Sep 2021 16:54:32 +0000 (09:54 -0700)]
rustdoc: Higher-ranked lifetimes can't have bounds

This cleans up the other spot I found where rustdoc was rendering bounds
into the lifetime name itself. However, in this case, I don't think it
could have actually happened because higher-ranked lifetime definitions
aren't currently allowed to have bounds.

2 years agorustdoc: Clean up handling of lifetime bounds
Noah Lev [Wed, 1 Sep 2021 23:20:14 +0000 (16:20 -0700)]
rustdoc: Clean up handling of lifetime bounds

Previously, rustdoc recorded lifetime bounds by rendering them into the
name of the lifetime parameter. Now, it leaves the name as the actual
name and instead records lifetime bounds in an `outlives` list, similar
to how type parameter bounds are recorded.

2 years agoAuto merge of #85868 - Aaron1011:projection-cache, r=jackh726
bors [Thu, 2 Sep 2021 21:26:59 +0000 (21:26 +0000)]
Auto merge of #85868 - Aaron1011:projection-cache, r=jackh726

Preserve most sub-obligations in the projection cache

Fixes https://github.com/rust-lang/rust/issues/85360

When we evaluate a projection predicate, we may produce sub-obligations. During trait evaluation, evaluating these sub-obligations might cause us to produce `EvaluatedToOkModuloRegions`.

When we cache the result of projection in our projection cache, we try to throw away some of the sub-obligations, so that we don't need to re-evaluate/process them the next time we need to perform this particular projection. However, we may end up throwing away predicates that will (recursively) evaluate to `EvaluatedToOkModuloRegions`. If we do, then the result of evaluating a predicate will depend on the state of the predicate cache - this is global untracked state, which interacts badly with incremental compilation.

To fix this, we now only discard global predicates that evaluate to `EvaluatedToOk`. This ensures that any predicates that (may) evaluate to `EvaluatedToOkModuloRegions` are kept in the cache, and influence the results of any queries which perform this projection.

2 years agoUpdate LLVM submodule
Nikita Popov [Thu, 2 Sep 2021 20:39:43 +0000 (22:39 +0200)]
Update LLVM submodule

2 years agotidy
Ellen [Thu, 2 Sep 2021 20:30:13 +0000 (21:30 +0100)]
tidy

2 years agoE-not-needs-test
Ellen [Thu, 2 Sep 2021 20:20:51 +0000 (21:20 +0100)]
E-not-needs-test

2 years agoProvide more context on incorrect inner attribute
Esteban Kuber [Mon, 23 Aug 2021 10:49:31 +0000 (10:49 +0000)]
Provide more context on incorrect inner attribute

Suggest changing an inner attribute into an outer attribute if followed by an item.

2 years agoAuto merge of #88596 - m-ou-se:rollup-cidzt4v, r=m-ou-se
bors [Thu, 2 Sep 2021 18:58:12 +0000 (18:58 +0000)]
Auto merge of #88596 - m-ou-se:rollup-cidzt4v, r=m-ou-se

Rollup of 12 pull requests

Successful merges:

 - #88177 (Stabilize std::os::unix::fs::chroot)
 - #88505 (Use `unwrap_unchecked` where possible)
 - #88512 (Upgrade array_into_iter lint to include Deref-to-array types.)
 - #88532 (Remove single use variables)
 - #88543 (Improve closure dummy capture suggestion in macros.)
 - #88560 (`fmt::Formatter::pad`: don't call chars().count() more than one time)
 - #88565 (Add regression test for issue 83190)
 - #88567 (Remove redundant `Span` in `QueryJobInfo`)
 - #88573 (rustdoc: Don't panic on ambiguous inherent associated types)
 - #88582 (Implement #88581)
 - #88589 (Correct doc comments inside `use_expr_visitor.rs`)
 - #88592 (Fix ICE in const check)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoBless ast-json tests.
Camille GILLOT [Wed, 1 Sep 2021 18:06:08 +0000 (20:06 +0200)]
Bless ast-json tests.

2 years agoRename walk_crate.
Camille GILLOT [Thu, 2 Sep 2021 17:22:24 +0000 (19:22 +0200)]
Rename walk_crate.

2 years agoRollup merge of #88592 - b-naber:region_substs, r=oli-obk
Mara Bos [Thu, 2 Sep 2021 17:10:24 +0000 (19:10 +0200)]
Rollup merge of #88592 - b-naber:region_substs, r=oli-obk

Fix ICE in const check

Fixes https://github.com/rust-lang/rust/issues/88433

2 years agoRollup merge of #88589 - xFrednet:00000-correct-comment-to-doc, r=petrochenkov
Mara Bos [Thu, 2 Sep 2021 17:10:23 +0000 (19:10 +0200)]
Rollup merge of #88589 - xFrednet:00000-correct-comment-to-doc, r=petrochenkov

Correct doc comments inside `use_expr_visitor.rs`

Just a simple update. I haven't changed any content inside the comments, as they still seem correct. Have a wonderful rest of the day :upside_down_face:

2 years agoRollup merge of #88582 - jhpratt:int_roundings, r=joshtriplett
Mara Bos [Thu, 2 Sep 2021 17:10:22 +0000 (19:10 +0200)]
Rollup merge of #88582 - jhpratt:int_roundings, r=joshtriplett

Implement #88581

See #88581 for details. This API was discussed on Zulip.

`@rustbot` label: +T-libs-api +S-waiting-on-review

r? `@joshtriplett`

2 years agoRollup merge of #88573 - camelid:rustdoc-assoc-panic, r=GuillaumeGomez
Mara Bos [Thu, 2 Sep 2021 17:10:21 +0000 (19:10 +0200)]
Rollup merge of #88573 - camelid:rustdoc-assoc-panic, r=GuillaumeGomez

rustdoc: Don't panic on ambiguous inherent associated types

Instead, return `Type::Infer` since compilation should fail anyway.
That's how rustdoc handles `hir::TyKind::Err`s, so this just extends
that behavior to `ty::Err`s when analyzing associated types.

For some reason, the error is printed twice with rustdoc (though only
once with rustc). I'm not sure why that is, but it's better than
panicking.

This commit also makes rustdoc fail early in the non-projection,
non-error case, instead of returning a `Res::Err` that would likely
cause rustdoc to panic later on. This change is originally from #88379.

r? `@GuillaumeGomez`

2 years agoRollup merge of #88567 - camelid:query-job-info, r=cjgillot
Mara Bos [Thu, 2 Sep 2021 17:10:20 +0000 (19:10 +0200)]
Rollup merge of #88567 - camelid:query-job-info, r=cjgillot

Remove redundant `Span` in `QueryJobInfo`

Previously, `QueryJobInfo` was composed of two parts: a `QueryInfo` and
a `QueryJob`. However, both `QueryInfo` and `QueryJob` have a `span`
field, which seem to be the same. So, the `span` was recorded twice.

Now, `QueryJobInfo` is composed of a `QueryStackFrame` (the other field
of `QueryInfo`) and a `QueryJob`. So, now, the `span` is only recorded
once.

2 years agoRollup merge of #88565 - lqd:issue-83190, r=spastorino
Mara Bos [Thu, 2 Sep 2021 17:10:19 +0000 (19:10 +0200)]
Rollup merge of #88565 - lqd:issue-83190, r=spastorino

Add regression test for issue 83190

Reduced from `bioyino-metric` by ````@hellow554```` and myself.

Closes #83190.

r? ````@spastorino````

2 years agoRollup merge of #88560 - klensy:formatter-pad-shrink, r=m-ou-se
Mara Bos [Thu, 2 Sep 2021 17:10:18 +0000 (19:10 +0200)]
Rollup merge of #88560 - klensy:formatter-pad-shrink, r=m-ou-se

`fmt::Formatter::pad`: don't call chars().count() more than one time

First commit merges two branches of match to call chars().count() only once: that should be faster if this method hits place of 3rd (previous) branch, plus quarter shorter.
Second commit fixes some clippy lints while i'm here (should it be separate PR?).

2 years agoRollup merge of #88543 - m-ou-se:closure-migration-macro-block-fragment, r=estebank
Mara Bos [Thu, 2 Sep 2021 17:10:17 +0000 (19:10 +0200)]
Rollup merge of #88543 - m-ou-se:closure-migration-macro-block-fragment, r=estebank

Improve closure dummy capture suggestion in macros.

Fixes some cases of https://github.com/rust-lang/rust/issues/88440

Fixes https://crater-reports.s3.amazonaws.com/pr-87190-3/try%23a7a572ce3edd6d476191fbfe92c9c1986e009b34/reg/rcodec-1.0.1/log.txt

2 years agoRollup merge of #88532 - ptrojahn:single_use, r=davidtwco
Mara Bos [Thu, 2 Sep 2021 17:10:16 +0000 (19:10 +0200)]
Rollup merge of #88532 - ptrojahn:single_use, r=davidtwco

Remove single use variables

2 years agoRollup merge of #88512 - m-ou-se:array-into-iter-deref-stuff, r=estebank
Mara Bos [Thu, 2 Sep 2021 17:10:15 +0000 (19:10 +0200)]
Rollup merge of #88512 - m-ou-se:array-into-iter-deref-stuff, r=estebank

Upgrade array_into_iter lint to include Deref-to-array types.

Fixes https://github.com/rust-lang/rust/issues/88099

Fixes the issue mentioned here: https://github.com/rust-lang/rust/pull/84147#issuecomment-819000436

2 years agoRollup merge of #88505 - ibraheemdev:use-unwrap-unchecked, r=kennytm
Mara Bos [Thu, 2 Sep 2021 17:10:14 +0000 (19:10 +0200)]
Rollup merge of #88505 - ibraheemdev:use-unwrap-unchecked, r=kennytm

Use `unwrap_unchecked` where possible

2 years agoRollup merge of #88177 - joshtriplett:stabilize-chroot, r=m-ou-se
Mara Bos [Thu, 2 Sep 2021 17:10:12 +0000 (19:10 +0200)]
Rollup merge of #88177 - joshtriplett:stabilize-chroot, r=m-ou-se

Stabilize std::os::unix::fs::chroot

I've verified that this works as documented, and I've tested it in (a nightly
build of) production software as a replacement for an unsafe call to
`libc::chroot`. It's been available in nightly for a few releases. I think it's
ready to stabilize.

---

Tracking issue: https://github.com/rust-lang/rust/issues/84715

2 years agoDrop walk_crate_and_attributes.
Camille GILLOT [Thu, 26 Aug 2021 18:27:06 +0000 (20:27 +0200)]
Drop walk_crate_and_attributes.

2 years agoBless tests.
Camille GILLOT [Thu, 26 Aug 2021 18:17:19 +0000 (20:17 +0200)]
Bless tests.

2 years agoDirectly access the module for use suggestions.
Camille GILLOT [Thu, 26 Aug 2021 17:16:33 +0000 (19:16 +0200)]
Directly access the module for use suggestions.