]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #93634 - matthiaskrgr:clippy_complexity_jan_2022, r=oli-obk
Matthias Krüger [Fri, 18 Feb 2022 15:23:33 +0000 (16:23 +0100)]
Rollup merge of #93634 - matthiaskrgr:clippy_complexity_jan_2022, r=oli-obk

compiler: clippy::complexity fixes

useless_format
map_flatten
useless_conversion
needless_bool
filter_next
clone_on_copy
needless_option_as_deref

2 years agoRollup merge of #93613 - crlf0710:rename_to_async_iter, r=yaahc
Matthias Krüger [Fri, 18 Feb 2022 15:23:32 +0000 (16:23 +0100)]
Rollup merge of #93613 - crlf0710:rename_to_async_iter, r=yaahc

Move `{core,std}::stream::Stream` to `{core,std}::async_iter::AsyncIterator`

Following amendments in https://github.com/rust-lang/rfcs/pull/3208/.

cc #79024
cc ``@yoshuawuyts`` ``@joshtriplett``

2 years agoRollup merge of #93024 - compiler-errors:inline-mir-bad-bounds, r=estebank
Matthias Krüger [Fri, 18 Feb 2022 15:23:30 +0000 (16:23 +0100)]
Rollup merge of #93024 - compiler-errors:inline-mir-bad-bounds, r=estebank

Do not ICE when inlining a function with un-satisfiable bounds

Fixes #93008
This is kinda a hack... but it's the fix I thought had the least blast-radius.

We use `normalize_param_env_or_error` to verify that the predicates in the param env are self-consistent, since with RevealAll, a bad predicate like `<&'static () as Clone>` will be evaluated with an empty ParamEnv (since it references no generics), and we'll raise an error for it.

2 years agoRollup merge of #92959 - asquared31415:test-non-fn-help, r=estebank
Matthias Krüger [Fri, 18 Feb 2022 15:23:29 +0000 (16:23 +0100)]
Rollup merge of #92959 - asquared31415:test-non-fn-help, r=estebank

Add more info and suggestions to use of #[test] on invalid items

This pr changes the diagnostics for using `#[test]` on an item that can't be used as a test to explain that the attribute has no meaningful effect on non-functions and suggests the use of `#[cfg(test)]` for conditional compilation instead.

Example change:
```rs
#[test]
mod test {}
```
previously output
```
error: only functions may be used as tests
 --> src/lib.rs:2:1
  |
2 | mod test {}
  | ^^^^^^^^^^^
  ```
  now outputs
  ```
error: the `#[test]` attribute may only be used on a non-associated function
  --> $DIR/test-on-not-fn.rs:3:1
     |
LL | #[test]
     | ^^^^^^^
LL | mod test {}
     | ----------- expected a non-associated function, found a module
     |
     = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
help: replace with conditional compilation to make the item only exist when tests are being run
     |
LL | #[cfg(test)]
     | ~~~~~~~~~~~~
   ```

2 years agoRollup merge of #92933 - bjorn3:no_bin_lib_mixing, r=estebank
Matthias Krüger [Fri, 18 Feb 2022 15:23:28 +0000 (16:23 +0100)]
Rollup merge of #92933 - bjorn3:no_bin_lib_mixing, r=estebank

Deny mixing bin crate type with lib crate types

The produced library would get a main shim too which conflicts with the
main shim of the executable linking the library.

```
$ cat > main1.rs <<EOF
fn main() {}
pub fn bar() {}
EOF
$ cat > main2.rs <<EOF
extern crate main1;
fn main() {
    main1::bar();
}
EOF
$ rustc --crate-type bin --crate-type lib main1.rs
$ rustc -L. main2.rs
error: linking with `cc` failed: exit status: 1
[...]
  = note: /usr/bin/ld: /tmp/crate_bin_lib/libmain1.rlib(main1.main1.707747aa-cgu.0.rcgu.o): in function `main':
          main1.707747aa-cgu.0:(.text.main+0x0): multiple definition of `main'; main2.main2.02a148fe-cgu.0.rcgu.o:main2.02a148fe-cgu.0:(.text.main+0x0): first defined here
          collect2: error: ld returned 1 exit status
```

2 years agoRollup merge of #92683 - jackh726:issue-92033, r=estebank
Matthias Krüger [Fri, 18 Feb 2022 15:23:28 +0000 (16:23 +0100)]
Rollup merge of #92683 - jackh726:issue-92033, r=estebank

Suggest copying trait associated type bounds on lifetime error

Closes #92033

Kind of the most simple suggestion to make - we don't try to be fancy. Turns out, it's still pretty useful (the couple existing tests that trigger this error end up fixed - for this error - upon applying the fix).

r? ``@estebank``
cc ``@nikomatsakis``

2 years agoAuto merge of #93766 - petrochenkov:doclinkregr, r=camelid,GuillaumeGomez
bors [Fri, 18 Feb 2022 10:26:45 +0000 (10:26 +0000)]
Auto merge of #93766 - petrochenkov:doclinkregr, r=camelid,GuillaumeGomez

rustdoc: Collect traits in scope for lang items

Inherent impls on primitive types are not included in the list of all inherent impls in the crate (`inherent_impls_in_crate_untracked`), they are taken from the list of lang items instead, but such impls can also be inlined by rustdoc, e.g. if something derefs to a primitive type.

r? `@camelid`
Fixes https://github.com/rust-lang/rust/issues/93698

2 years agorustdoc: Collect traits in scope for lang items
Vadim Petrochenkov [Tue, 8 Feb 2022 09:42:22 +0000 (17:42 +0800)]
rustdoc: Collect traits in scope for lang items

2 years agoAuto merge of #94088 - oli-obk:revert, r=jackh726
bors [Fri, 18 Feb 2022 07:35:37 +0000 (07:35 +0000)]
Auto merge of #94088 - oli-obk:revert, r=jackh726

Revert #91403

fixes #94004

r? `@pnkfelix` `@cjgillot`

2 years agoAuto merge of #94095 - Amanieu:update_stdarch, r=dtolnay
bors [Fri, 18 Feb 2022 04:16:03 +0000 (04:16 +0000)]
Auto merge of #94095 - Amanieu:update_stdarch, r=dtolnay

Fix documentation for is_X_feature_detected!

These are now properly documented for all architectures and the
stability attributes in the docs are now correctly displayed.

This addresses this comment by `@ehuss:` https://github.com/rust-lang/rust/pull/90271#issuecomment-1038400916

cc `@adamgemmell`

2 years agoAuto merge of #94103 - matthiaskrgr:rollup-cd70ofn, r=matthiaskrgr
bors [Thu, 17 Feb 2022 22:54:18 +0000 (22:54 +0000)]
Auto merge of #94103 - matthiaskrgr:rollup-cd70ofn, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #93337 (Update tracking issue numbers for inline assembly sub-features)
 - #93758 (Improve comments about type folding/visiting.)
 - #93780 (Generate list instead of div items in sidebar)
 - #93976 (Add MAIN_SEPARATOR_STR)
 - #94011 (Even more let_else adoptions)
 - #94041 (Add a `try_collect()` helper method to `Iterator`)
 - #94043 (Fix ICE when using Box<T, A> with pointer sized A)
 - #94082 (Remove CFG_PLATFORM)
 - #94085 (Clippy: Don't lint `needless_borrow` in method receiver positions)

Failed merges:

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

2 years agoRollup merge of #94085 - flip1995:clippy_needless_borrow_temp_fix, r=Manishearth
Matthias Krüger [Thu, 17 Feb 2022 22:01:03 +0000 (23:01 +0100)]
Rollup merge of #94085 - flip1995:clippy_needless_borrow_temp_fix, r=Manishearth

Clippy: Don't lint `needless_borrow` in method receiver positions

r? `@Manishearth`

cc `@camsteffen` `@Jarcho`

cc rust-lang/rust-clippy#8441

Let's get this fix in before the beta branching tomorrow.

2 years agoRollup merge of #94082 - bjorn3:remove_cfg_platform, r=Mark-Simulacrum
Matthias Krüger [Thu, 17 Feb 2022 22:01:02 +0000 (23:01 +0100)]
Rollup merge of #94082 - bjorn3:remove_cfg_platform, r=Mark-Simulacrum

Remove CFG_PLATFORM

It seems to be unused and it is incorrect for arm/aarch64 anyway.

2 years agoRollup merge of #94043 - DrMeepster:box_alloc_ice, r=oli-obk
Matthias Krüger [Thu, 17 Feb 2022 22:01:01 +0000 (23:01 +0100)]
Rollup merge of #94043 - DrMeepster:box_alloc_ice, r=oli-obk

Fix ICE when using Box<T, A> with pointer sized A

Fixes #78459

Note that using `Box<T, A>` with a more than pointer sized `A` or using a pointer sized `A` with a Box of a DST will produce a different ICE (#92054) which is not fixed by this PR.

2 years agoRollup merge of #94041 - a-lafrance:try-collect, r=scottmcm
Matthias Krüger [Thu, 17 Feb 2022 22:01:00 +0000 (23:01 +0100)]
Rollup merge of #94041 - a-lafrance:try-collect, r=scottmcm

Add a `try_collect()` helper method to `Iterator`

Implement `Iterator::try_collect()` as a helper around `Iterator::collect()` as discussed [here](https://internals.rust-lang.org/t/idea-fallible-iterator-mapping-with-try-map/15715/5?u=a.lafrance).

First time contributor so definitely open to any feedback about my implementation! Specifically wondering if I should open a tracking issue for the unstable feature I introduced.

As the main participant in the internals discussion: r? `@scottmcm`

2 years agoRollup merge of #94011 - est31:let_else, r=lcnr
Matthias Krüger [Thu, 17 Feb 2022 22:00:59 +0000 (23:00 +0100)]
Rollup merge of #94011 - est31:let_else, r=lcnr

Even more let_else adoptions

Continuation of #89933, #91018, #91481, #93046, #93590.

2 years agoRollup merge of #93976 - SUPERCILEX:separator_str, r=yaahc
Matthias Krüger [Thu, 17 Feb 2022 22:00:58 +0000 (23:00 +0100)]
Rollup merge of #93976 - SUPERCILEX:separator_str, r=yaahc

Add MAIN_SEPARATOR_STR

Currently, if someone needs access to the path separator as a str, they need to go through this mess:

```rust
unsafe {
    std::str::from_utf8_unchecked(slice::from_ref(&(MAIN_SEPARATOR as u8)))
}
```

This PR just re-exports an existing path separator str API.

2 years agoRollup merge of #93780 - GuillaumeGomez:links-in-sidebar, r=jsha
Matthias Krüger [Thu, 17 Feb 2022 22:00:57 +0000 (23:00 +0100)]
Rollup merge of #93780 - GuillaumeGomez:links-in-sidebar, r=jsha

Generate list instead of div items in sidebar

Fixes #92986.

Surprisingly, we didn't have much CSS for this...

[Demo](https://rustdoc.crud.net/imperio/links-in-sidebar/std/index.html).

r? `@jsha`

2 years agoRollup merge of #93758 - nnethercote:improve-folding-comments, r=BoxyUwU
Matthias Krüger [Thu, 17 Feb 2022 22:00:55 +0000 (23:00 +0100)]
Rollup merge of #93758 - nnethercote:improve-folding-comments, r=BoxyUwU

Improve comments about type folding/visiting.

I have found this code confusing for years. I've always roughly
understood it, but never exactly. I just made my fourth(?) attempt and
finally cracked it.

This commit improves the comments. In particular, it explicitly
describes how you can't do a custom fold/visit of any type; there are
actually a handful of "types of interest" (e.g. `Ty`, `Predicate`,
`Region`, `Const`) that can be custom folded/visted, and all other types
just get a generic traversal. I think this was the part that eluded me
on all my prior attempts at understanding.

The commit also updates comments to account for some newer changes such
as the fallible/infallible folding distinction, does some minor
reorderings, and moves one `impl` to a better place.

r? `@BoxyUwU`

2 years agoRollup merge of #93337 - Amanieu:asm_tracking, r=tmiasko
Matthias Krüger [Thu, 17 Feb 2022 22:00:55 +0000 (23:00 +0100)]
Rollup merge of #93337 - Amanieu:asm_tracking, r=tmiasko

Update tracking issue numbers for inline assembly sub-features

The main tracking issue for inline assembly is [closed](https://github.com/rust-lang/rust/issues/72016#issuecomment-1022332954), further tracking of the remaining sub-features has been moved to separate tracking issues.

2 years agoSuggest copying trait associated type bounds on lifetime error
Jack Huey [Sun, 9 Jan 2022 04:30:19 +0000 (23:30 -0500)]
Suggest copying trait associated type bounds on lifetime error

2 years agoFix documentation for is_X_feature_detected!
Amanieu d'Antras [Thu, 17 Feb 2022 18:17:15 +0000 (18:17 +0000)]
Fix documentation for is_X_feature_detected!

These are now properly documented for all architectures and the
stability attributes in the docs are now correctly displayed.

2 years agoRevert "Auto merge of #91403 - cjgillot:inherit-async, r=oli-obk"
Oli Scherer [Thu, 17 Feb 2022 16:00:04 +0000 (16:00 +0000)]
Revert "Auto merge of #91403 - cjgillot:inherit-async, r=oli-obk"

This reverts commit 3cfa4def7c87d571bd46d92fed608edf8fad236e, reversing
changes made to 5d8767cb229b097fedb1dd4bd9420d463c37774f.

2 years agoDon't lint `needless_borrow` in method receiver positions
Jason Newcomb [Thu, 17 Feb 2022 04:14:39 +0000 (23:14 -0500)]
Don't lint `needless_borrow` in method receiver positions

2 years agoRemove CFG_PLATFORM
bjorn3 [Thu, 17 Feb 2022 14:32:35 +0000 (15:32 +0100)]
Remove CFG_PLATFORM

It seems to be unused and it is incorrect for arm/aarch64 anyway.

2 years agoAuto merge of #93577 - nikic:llvm-14, r=nagisa
bors [Thu, 17 Feb 2022 13:08:46 +0000 (13:08 +0000)]
Auto merge of #93577 - nikic:llvm-14, r=nagisa

Upgrade to LLVM 14

LLVM patch state:
 * [x] https://github.com/llvm/llvm-project/commit/a55727f334b39600bfc71144b11b42aae6b94e0b Backported.
 * [x] https://github.com/rust-lang/llvm-project/commit/c3c82dc12402dd41441180c0c6cf7aed7e330c53 Backported as https://github.com/llvm/llvm-project/commit/917c47b3bf0dfc45a2a5ba12c1397d647ecf4017.
 * [x] https://github.com/rust-lang/llvm-project/commit/6e8f9ab632d12271355d10d34c9835a7ba14e4b9 No plan to upstream.
 * [x] https://github.com/llvm/llvm-project/commit/319f4b2d52e31b000db75a0a2484b5f2ab90534a Backported.
 * [x] https://github.com/rust-lang/llvm-project/commit/8b2c25d321f877161f85218479e2d1317d770e18 No plan to upstream.
 * [x] https://github.com/rust-lang/llvm-project/commit/75fef2efd427362c8f16b2d09e6ebf44069e3919 No plan to upstream.
 * [ ] https://github.com/rust-lang/llvm-project/commit/adef757547de5a570d9f6a00d3e6ac16c666ab79 Upstreamed as https://github.com/llvm/llvm-project/commit/2d2ef384b2f6e723edb793d08f52e7f4dc94ba3a. Needs backport.
 * [x] https://github.com/rust-lang/llvm-project/commit/4b7c1b4910e9fa9e04f23f06be078e168ef4c0ee No plan to upstream.
 * [x] https://github.com/rust-lang/llvm-project/commit/3f5ab0c061adb723f25b94243828b6b5407720c8 No plan to upstream.
 * [x] https://github.com/rust-lang/llvm-project/commit/514d05500e0e15e358f05f5c4cec78a805858f8e No plan to upstream.
 * [ ] https://github.com/rust-lang/llvm-project/commit/54c586958564582b3341d1838a5de86541e5fecf Under review at https://reviews.llvm.org/D119695 and https://reviews.llvm.org/D119856.

Release timeline:
 * LLVM 14.0.0 final planned for Mar 15.
 * Rust 1.60.0 planned for Apr 7.

Compile-time:
  * https://perf.rust-lang.org/compare.html?start=250384edc5d78533e993f38c60d64e42b21684b2&end=b87df8d2c7c5d9ac448c585de10927ab2ee1b864
  * A slight improvement on average, though no big changes either way.
  * There are some larger max-rss improvements.

r? `@ghost`

2 years agoImprove comments about type folding/visiting.
Nicholas Nethercote [Tue, 8 Feb 2022 00:46:53 +0000 (11:46 +1100)]
Improve comments about type folding/visiting.

I have found this code confusing for years. I've always roughly
understood it, but never exactly. I just made my fourth(?) attempt and
finally cracked it.

This commit improves the comments. In particular, it explicitly
describes how you can't do a custom fold/visit of any type; there are
actually a handful of "types of interest" (e.g. `Ty`, `Predicate`,
`Region`, `Const`) that can be custom folded/visted, and all other types
just get a generic traversal. I think this was the part that eluded me
on all my prior attempts at understanding.

The commit also updates comments to account for some newer changes such
as the fallible/infallible folding distinction, does some minor
reorderings, and moves one `impl` to a better place.

2 years agoAuto merge of #94072 - matthiaskrgr:rollup-7uu2286, r=matthiaskrgr
bors [Thu, 17 Feb 2022 09:13:18 +0000 (09:13 +0000)]
Auto merge of #94072 - matthiaskrgr:rollup-7uu2286, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #89869 (Add documentation to more `From::from` implementations.)
 - #93479 (Use `optflag` for `--report-time`)
 - #93693 (Suggest deriving required supertraits)
 - #93981 (Fix suggestion to slice if scurtinee is a reference to `Result` or `Option`)
 - #93996 (Do not suggest "is a function" for free variables)
 - #94030 (Correctly mark the span of captured arguments in `format_args!()`)
 - #94031 ([diagnostics] Add mentions to `Copy` types being valid for `union` fields)
 - #94064 (Update dist-x86_64-musl to Ubuntu 20.04)

Failed merges:

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

2 years agoRollup merge of #94064 - nikic:update-musl-image, r=Mark-Simulacrum
Matthias Krüger [Thu, 17 Feb 2022 05:30:05 +0000 (06:30 +0100)]
Rollup merge of #94064 - nikic:update-musl-image, r=Mark-Simulacrum

Update dist-x86_64-musl to Ubuntu 20.04

This updates the dist-x86_64-musl image to use Ubuntu 20.04. The current Ubuntu 16.04 based image only works due to the Docker cache, it's not possible anymore to run it locally because of the usual certificate expiration issue.

I believe updating the OS here is relatively safe because this targets musl, so there are no concerns about raising the glibc baseline. There is some risk here in that it updates the compiler toolchain used to produce artifacts, though I'm not aware of any specific issues that could cause.

r? ``@Mark-Simulacrum``

2 years agoRollup merge of #94031 - danielhenrymantilla:diagnostics/union-drop-suggest-copy...
Matthias Krüger [Thu, 17 Feb 2022 05:30:03 +0000 (06:30 +0100)]
Rollup merge of #94031 - danielhenrymantilla:diagnostics/union-drop-suggest-copy-bound-alternative, r=davidtwco

[diagnostics] Add mentions to `Copy` types being valid for `union` fields

This came up from some user on Discord which was using a `T : PrimitiveInt` generic type, and they wanted to use in a `union`. Rather than adding a `Copy` bound, they started pondering about the `ManuallyDrop<T>` road, and how to correctly use `unsafe` to perform the drops.

<img width="648" alt="Screen Shot 2022-02-15 at 22 28 34" src="https://user-images.githubusercontent.com/9920355/154152496-8f9be74b-ad59-4724-8f9e-48b446774e06.png">

  - [Discord link](https://discord.com/channels/442252698964721669/443150878111694848/943092778534072320)

So, it seemed like the error message for types with potential drop glue on `union` fields could be improved to also mention the `Copy` alternative, since in many cases where `union`s are concerned, people are dealing with PODs / `Copy` types anyways 🙂

___

``@rustbot`` modify labels: +A-diagnostics +D-terse

2 years agoRollup merge of #94030 - ChayimFriedman2:issue-94010, r=petrochenkov
Matthias Krüger [Thu, 17 Feb 2022 05:30:02 +0000 (06:30 +0100)]
Rollup merge of #94030 - ChayimFriedman2:issue-94010, r=petrochenkov

Correctly mark the span of captured arguments in `format_args!()`

It should not include the braces, or misspelling suggestions will be wrong.

Fixes #94010.

2 years agoRollup merge of #93996 - notriddle:notriddle/magically-becomes-a-function, r=petrochenkov
Matthias Krüger [Thu, 17 Feb 2022 05:30:01 +0000 (06:30 +0100)]
Rollup merge of #93996 - notriddle:notriddle/magically-becomes-a-function, r=petrochenkov

Do not suggest "is a function" for free variables

Part of #82323

2 years agoRollup merge of #93981 - ChayimFriedman2:slice-pat-reference-option-result, r=davidtwco
Matthias Krüger [Thu, 17 Feb 2022 05:30:00 +0000 (06:30 +0100)]
Rollup merge of #93981 - ChayimFriedman2:slice-pat-reference-option-result, r=davidtwco

Fix suggestion to slice if scurtinee is a reference to `Result` or `Option`

Fixes https://github.com/rust-lang/rust/pull/91343#issuecomment-1037718339 and https://github.com/rust-lang/rust/pull/91343#discussion_r761466979.

2 years agoRollup merge of #93693 - rukai:91550, r=davidtwco
Matthias Krüger [Thu, 17 Feb 2022 05:29:59 +0000 (06:29 +0100)]
Rollup merge of #93693 - rukai:91550, r=davidtwco

Suggest deriving required supertraits

closes https://github.com/rust-lang/rust/issues/91550

I chose to just hardcode handling for PartialOrd and PartialEq because that should be robust enough and I dont know how to go about doing it generically

r? rust-lang/diagnostics

2 years agoRollup merge of #93479 - smoelius:master, r=yaahc
Matthias Krüger [Thu, 17 Feb 2022 05:29:59 +0000 (06:29 +0100)]
Rollup merge of #93479 - smoelius:master, r=yaahc

Use `optflag` for `--report-time`

Essentially, what is described here:
https://github.com/rust-lang/rust/issues/64888#issuecomment-1008047228

There is one difference. The comment proposes to add a
`--report-time-color` option. This change instead uses libtest's
existing `--color` option for that purpose.

2 years agoRollup merge of #89869 - kpreid:from-doc, r=yaahc
Matthias Krüger [Thu, 17 Feb 2022 05:29:57 +0000 (06:29 +0100)]
Rollup merge of #89869 - kpreid:from-doc, r=yaahc

Add documentation to more `From::from` implementations.

For users looking at documentation through IDE popups, this gives them relevant information rather than the generic trait documentation wording “Performs the conversion”. For users reading the documentation for a specific type for any reason, this informs them when the conversion may allocate or copy significant memory versus when it is always a move or cheap copy.

Notes on specific cases:
* The new documentation for `From<T> for T` explains that it is not a conversion at all.
* Also documented `impl<T, U> Into<U> for T where U: From<T>`, the other central blanket implementation of conversion.
* The new documentation for construction of maps and sets from arrays of keys mentions the handling of duplicates. Future work could be to do this for *all* code paths that convert an iterable to a map or set.
* I did not add documentation to conversions of a specific error type to a more general error type.
* I did not add documentation to unstable code.

This change was prepared by searching for the text "From<... for" and so may have missed some cases that for whatever reason did not match. I also looked for `Into` impls but did not find any worth documenting by the above criteria.

2 years agoAdd MAIN_SEPARATOR_STR
Alex Saveau [Sun, 13 Feb 2022 22:20:29 +0000 (14:20 -0800)]
Add MAIN_SEPARATOR_STR

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2 years agoAuto merge of #94040 - Mark-Simulacrum:destabilize-load-store, r=Amanieu
bors [Thu, 17 Feb 2022 01:56:40 +0000 (01:56 +0000)]
Auto merge of #94040 - Mark-Simulacrum:destabilize-load-store, r=Amanieu

Destabilize cfg(target_has_atomic_load_store = ...)

This was not intended to be stabilized yet.

This keeps the cfg_target_has_atomic feature gate name since compiler-builtins otherwise depends on it and I'd rather not try to manage a bump across a crates.io published repository given the time-sensitivity here (we need to land this quickly to avoid a beta backport).

Closes https://github.com/rust-lang/rust/issues/32976

r? `@Amanieu`

2 years agoadd comment explaining the check
DrMeepster [Thu, 17 Feb 2022 00:52:06 +0000 (16:52 -0800)]
add comment explaining the check

2 years agoAdd a `try_collect()` helper method to `Iterator`
Arthur Lafrance [Wed, 16 Feb 2022 02:58:42 +0000 (18:58 -0800)]
Add a `try_collect()` helper method to `Iterator`

Tweaked `try_collect()` to accept more `Try` types

Updated feature attribute for tracking issue

2 years agoAuto merge of #91182 - ChrisDenton:command-broken-symlink, r=m-ou-se
bors [Wed, 16 Feb 2022 22:11:22 +0000 (22:11 +0000)]
Auto merge of #91182 - ChrisDenton:command-broken-symlink, r=m-ou-se

Maintain broken symlink behaviour for the Windows exe resolver

When the resolver was updated to remove the current directory from the search path (see #87704), care was take to avoid unintentional changes that hadn't been discussed. However, I missed the broken symlink behaviour. This PR fixes that.

**Edit** This turned out to be more important than I first realised. There are some types of application stubs that will redirect to the actual process when run using `CreateProcessW`, but due to the way they're implemented they cannot be opened normally using a `File::open` that follows reparse points. So this doesn't work with our current `exists` and `try_exists` methods.

Fixes #91177

2 years agoAdopt let_else in even more places
est31 [Tue, 15 Feb 2022 04:58:25 +0000 (05:58 +0100)]
Adopt let_else in even more places

2 years agoUpdate dist-x86_64-musl to Ubuntu 20.04
Nikita Popov [Wed, 16 Feb 2022 19:03:40 +0000 (20:03 +0100)]
Update dist-x86_64-musl to Ubuntu 20.04

2 years agoUpdate compiler-builtins to 0.1.70
Nikita Popov [Wed, 16 Feb 2022 08:22:44 +0000 (09:22 +0100)]
Update compiler-builtins to 0.1.70

This pulls in https://github.com/rust-lang/compiler-builtins/pull/455,
which exports __float/__fix builtins with the expected Win64 ABI
on LLVM 14.

2 years agoExpose unstable llvm14-builtins-abi target feature for cfg use
Nikita Popov [Tue, 15 Feb 2022 14:22:13 +0000 (15:22 +0100)]
Expose unstable llvm14-builtins-abi target feature for cfg use

2 years agoAdd cmake directory to llvm source distribution
Nikita Popov [Wed, 9 Feb 2022 16:44:56 +0000 (17:44 +0100)]
Add cmake directory to llvm source distribution

This directory is required for building LLVM now.

2 years agoUpdate coverage IR test
Nikita Popov [Wed, 2 Feb 2022 09:48:42 +0000 (10:48 +0100)]
Update coverage IR test

2 years agoUpdate data layout for wasm32 targets
Nikita Popov [Wed, 2 Feb 2022 09:16:48 +0000 (10:16 +0100)]
Update data layout for wasm32 targets

New address spaces were added in https://reviews.llvm.org/D111154.

2 years agoUpdate data layout for 32-bit msvc targets
Nikita Popov [Wed, 2 Feb 2022 09:01:02 +0000 (10:01 +0100)]
Update data layout for 32-bit msvc targets

https://reviews.llvm.org/D115942 changed the alignment of f80.

2 years agoUpdate optimization remark test for LLVM 14
Nikita Popov [Wed, 2 Feb 2022 08:53:45 +0000 (09:53 +0100)]
Update optimization remark test for LLVM 14

The format of the remark changed slightly.

2 years agoUpdate LLVM submodule
Nikita Popov [Wed, 2 Feb 2022 08:35:11 +0000 (09:35 +0100)]
Update LLVM submodule

2 years agoUpdate rustdoc tests to adapt to changes to the sidebar
Guillaume Gomez [Tue, 8 Feb 2022 16:05:00 +0000 (17:05 +0100)]
Update rustdoc tests to adapt to changes to the sidebar

2 years agoUnify sidebar a bit more by generating a list using <ul> instead of <div> elements
Guillaume Gomez [Tue, 8 Feb 2022 16:04:53 +0000 (17:04 +0100)]
Unify sidebar a bit more by generating a list using <ul> instead of <div> elements

2 years agoAuto merge of #94061 - matthiaskrgr:rollup-oduekp5, r=matthiaskrgr
bors [Wed, 16 Feb 2022 18:52:59 +0000 (18:52 +0000)]
Auto merge of #94061 - matthiaskrgr:rollup-oduekp5, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #92366 (Resolve concern of `derive_default_enum`)
 - #93382 (Add a bit more padding in search box)
 - #93962 (Make [u8]::cmp implementation branchless)
 - #94015 (rustdoc --check option documentation)
 - #94017 (Clarify confusing UB statement in MIR)
 - #94020 (Support pretty printing of invalid constants)
 - #94027 (Update browser UI test version)
 - #94037 (Fix inconsistent symbol mangling with -Zverbose)
 - #94045 (Update books)
 - #94054 (:arrow_up: rust-analyzer)

Failed merges:

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

2 years agoRollup merge of #94054 - lnicola:rust-analyzer-2022-02-16, r=lnicola
Matthias Krüger [Wed, 16 Feb 2022 17:59:36 +0000 (18:59 +0100)]
Rollup merge of #94054 - lnicola:rust-analyzer-2022-02-16, r=lnicola

:arrow_up: rust-analyzer

r? ``@ghost``

2 years agoRollup merge of #94045 - ehuss:update-books, r=ehuss
Matthias Krüger [Wed, 16 Feb 2022 17:59:35 +0000 (18:59 +0100)]
Rollup merge of #94045 - ehuss:update-books, r=ehuss

Update books

## nomicon

3 commits in 9493715a6280a1f74be759c7e1ef9999b5d13e6f..90993eeac93dbf9388992de92965f99cf6f29a03
2022-01-27 19:00:32 -0800 to 2022-02-13 12:44:12 +0900
- Fix a small typo in exception-safety.md (rust-lang/nomicon#341)
- Make `Vec::new` public in vec-alloc.md (rust-lang/nomicon#336)
- Fix a syntax error in leaking.md (rust-lang/nomicon#335)

## reference

6 commits in 411c2f0d5cebf48453ae2d136ad0c5e611d39aec..70fc73a6b908e08e66aa0306856c5211312f6c05
2022-01-30 12:46:37 -0800 to 2022-02-14 19:33:01 -0800
- Document pre-Rust-2021 special case for IntoIterator method lookup (rust-lang/reference#1154)
- Mention std::is_aarch64_feature_detected (rust-lang/reference#1061)
- Fix link to the Bastion of the Turbofish (rust-lang/reference#1161)
- Improve associated constant item CTFE timing section (rust-lang/reference#1147)
- document `#![feature(const_generics_defaults)]` (rust-lang/reference#1098)
- Update patterns allowed in @ patterns (rust-lang/reference#1158)

## book

6 commits in 98904efaa4fc968db8ff59cf2744d9f7ed158166..67b768c0b660a069a45f0e5d8ae2f679df1022ab
2022-01-29 21:22:31 -0500 to 2022-02-09 21:52:41 -0500
- Snapshot of ch18 for nostarch
- Remove mention of destructuring references as that's not covered currently
- Add note that exhaustiveness checking doesn't extend to match guards
- Change match guard example to actually be unexpressable with patterns alone
- Corrected listing number from 9-10 to 9-13
- Remove duplicate paragraph after No Starch related changes

## rustc-dev-guide

3 commits in 8763adb62c712df69b1d39ea3e692b6d696cc4d9..62f58394ba7b203f55ac35ddcc4c0b79578f5706
2022-01-26 14:01:40 -0800 to 2022-02-11 08:42:50 -0500
- Correction, building stage3 compiler (rust-lang/rustc-dev-guide#1298)
- Triage some date references (rust-lang/rustc-dev-guide#1293)
- mention test folders for cfg(bootstrap) (rust-lang/rustc-dev-guide#1294)

2 years agoRollup merge of #94037 - tmiasko:verbose, r=Mark-Simulacrum
Matthias Krüger [Wed, 16 Feb 2022 17:59:34 +0000 (18:59 +0100)]
Rollup merge of #94037 - tmiasko:verbose, r=Mark-Simulacrum

Fix inconsistent symbol mangling with -Zverbose

Always skip arguments that are the defaults of their respective
parameters, to avoid generating inconsistent symbols for builds
with `-Zverbose` flag and without it.

2 years agoRollup merge of #94027 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Matthias Krüger [Wed, 16 Feb 2022 17:59:33 +0000 (18:59 +0100)]
Rollup merge of #94027 - GuillaumeGomez:update-browser-ui-test, r=notriddle

Update browser UI test version

Might help a bit with https://github.com/rust-lang/rust/issues/93784 (still need to figure out what's going on with the driver).

r? ```@notriddle```

2 years agoRollup merge of #94020 - tmiasko:pp, r=oli-obk
Matthias Krüger [Wed, 16 Feb 2022 17:59:32 +0000 (18:59 +0100)]
Rollup merge of #94020 - tmiasko:pp, r=oli-obk

Support pretty printing of invalid constants

Make it possible to pretty print invalid constants by introducing a
fallible variant of `destructure_const` and falling back to debug
formatting when it fails.

Closes #93688.

2 years agoRollup merge of #94017 - fee1-dead:unub, r=bjorn3
Matthias Krüger [Wed, 16 Feb 2022 17:59:31 +0000 (18:59 +0100)]
Rollup merge of #94017 - fee1-dead:unub, r=bjorn3

Clarify confusing UB statement in MIR

2 years agoRollup merge of #94015 - GuillaumeGomez:check-option, r=notriddle
Matthias Krüger [Wed, 16 Feb 2022 17:59:30 +0000 (18:59 +0100)]
Rollup merge of #94015 - GuillaumeGomez:check-option, r=notriddle

rustdoc --check option documentation

Part of #92763.

r? ```@notriddle```

2 years agoRollup merge of #93962 - joboet:branchless_slice_ord, r=Mark-Simulacrum
Matthias Krüger [Wed, 16 Feb 2022 17:59:29 +0000 (18:59 +0100)]
Rollup merge of #93962 - joboet:branchless_slice_ord, r=Mark-Simulacrum

Make [u8]::cmp implementation branchless

The current implementation generates rather ugly assembly code, branching when the common parts are equal. By performing the comparison of the lengths upfront using a subtraction, the assembly gets much prettier: https://godbolt.org/z/4e5fnEKGd.

This will probably not impact speed too much, as the expensive part is in most cases the `memcmp`, but it sure looks better (I'm porting a sorting algorithm currently, and that branch just bothered me).

2 years agoRollup merge of #93382 - GuillaumeGomez:search-input-padding, r=jsha
Matthias Krüger [Wed, 16 Feb 2022 17:59:28 +0000 (18:59 +0100)]
Rollup merge of #93382 - GuillaumeGomez:search-input-padding, r=jsha

Add a bit more padding in search box

As asked in https://github.com/rust-lang/rust/pull/93113#issuecomment-1021565703, here is a bit more padding.

You can check it [here](https://rustdoc.crud.net/imperio/search-input-padding/foo/index.html).

r? `@camelid`

2 years agoRollup merge of #92366 - jhpratt:derive-default-enum, r=Mark-Simulacrum
Matthias Krüger [Wed, 16 Feb 2022 17:59:27 +0000 (18:59 +0100)]
Rollup merge of #92366 - jhpratt:derive-default-enum, r=Mark-Simulacrum

Resolve concern of `derive_default_enum`

This resolves the concern in favor of prohibiting multiple instances of
the attribute. This is similar to non-helper attributes as introduced in
#88681.

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

2 years agoDo not suggest "is a function" for free variables
Michael Howell [Sun, 13 Feb 2022 20:06:06 +0000 (13:06 -0700)]
Do not suggest "is a function" for free variables

Part of #82323

2 years agoDestabilize cfg(target_has_atomic_load_store = ...)
Mark Rousskov [Wed, 16 Feb 2022 02:40:07 +0000 (21:40 -0500)]
Destabilize cfg(target_has_atomic_load_store = ...)

This was not intended to be stabilized yet.

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Wed, 16 Feb 2022 15:23:51 +0000 (17:23 +0200)]
:arrow_up: rust-analyzer

2 years agoAuto merge of #94044 - ehuss:update-cargo, r=ehuss
bors [Wed, 16 Feb 2022 12:51:41 +0000 (12:51 +0000)]
Auto merge of #94044 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in c082648646cbb2be266df9ecbcdc253058158d68..ea2a21c994ca1e4d4c49412827b3cf4dcb158b1d
2022-02-08 14:55:05 +0000 to 2022-02-15 04:24:07 +0000
- cargo-new should not add ignore rule on Cargo.lock inside subdirs (rust-lang/cargo#10379)
- Add a badge for github actions (rust-lang/cargo#10385)
- Remove outdated badges (rust-lang/cargo#10380)
- Remove `strip = "off"` (and undocumented `strip = "n"`/`strip = "no"`) (rust-lang/cargo#10376)
- Fix unmatched backticks (rust-lang/cargo#10375)

2 years agoAdd mentions to `Copy` for `union` fields
Daniel Henry-Mantilla [Tue, 15 Feb 2022 19:16:19 +0000 (20:16 +0100)]
Add mentions to `Copy` for `union` fields

2 years agoCorrectly mark the span of captured arguments in `format_args!()`
Chayim Refael Friedman [Wed, 16 Feb 2022 00:38:04 +0000 (00:38 +0000)]
Correctly mark the span of captured arguments in `format_args!()`

It should only include the identifier, or misspelling suggestions will be wrong.

2 years agoUpdate cargo
Eric Huss [Wed, 16 Feb 2022 04:31:20 +0000 (20:31 -0800)]
Update cargo

2 years agoUpdate books
Eric Huss [Wed, 16 Feb 2022 04:17:31 +0000 (20:17 -0800)]
Update books

2 years agofix assumption that ScalarPair Box is always a fat pointer
DrMeepster [Wed, 16 Feb 2022 03:24:12 +0000 (19:24 -0800)]
fix assumption that ScalarPair Box is always a fat pointer

2 years agoCleanup uses
Lucas Kent [Wed, 16 Feb 2022 04:01:19 +0000 (15:01 +1100)]
Cleanup uses

2 years agoMake implementation generic
Lucas Kent [Sat, 12 Feb 2022 06:43:21 +0000 (17:43 +1100)]
Make implementation generic

2 years agoSuggest deriving required supertraits
Lucas Kent [Sun, 6 Feb 2022 06:44:41 +0000 (17:44 +1100)]
Suggest deriving required supertraits

2 years agoAuto merge of #93800 - b-naber:static-initializers-mir-val, r=oli-obk
bors [Wed, 16 Feb 2022 03:03:03 +0000 (03:03 +0000)]
Auto merge of #93800 - b-naber:static-initializers-mir-val, r=oli-obk

Treat static refs as `mir::ConstantKind::Val`

With the upcoming introduction of Valtrees we want to treat more values as `mir::ConstantKind::Val` directly.

r? `@lcnr`

cc `@oli-obk`

2 years agoFix inconsistent symbol mangling with -Zverbose
Tomasz Miąsko [Wed, 16 Feb 2022 00:00:00 +0000 (00:00 +0000)]
Fix inconsistent symbol mangling with -Zverbose

Always skip arguments that are the defaults of their respective
parameters, to avoid generating inconsistent symbols for builds
with `-Zverbose` flag and without it.

2 years agoAuto merge of #94021 - tmiasko:inline, r=nagisa
bors [Tue, 15 Feb 2022 23:48:43 +0000 (23:48 +0000)]
Auto merge of #94021 - tmiasko:inline, r=nagisa

Inline a few trivial conversion functions

2 years agoSupport pretty printing of invalid constants
Tomasz Miąsko [Tue, 15 Feb 2022 12:58:34 +0000 (13:58 +0100)]
Support pretty printing of invalid constants

Make it possible to pretty print invalid constants by introducing a
fallible variant of `destructure_const` and falling back to debug
formatting when it fails.

2 years agotry to bless 32bit mir tests manually
b-naber [Mon, 14 Feb 2022 15:48:05 +0000 (16:48 +0100)]
try to bless 32bit mir tests manually

2 years agoAuto merge of #93439 - abrown:cf-protection, r=nagisa
bors [Tue, 15 Feb 2022 21:20:49 +0000 (21:20 +0000)]
Auto merge of #93439 - abrown:cf-protection, r=nagisa

Add support for control-flow protection

This change adds a flag for configuring control-flow protection in the LLVM backend. In Clang, this flag is exposed as `-fcf-protection` with options `none|branch|return|full`. This convention is followed for `rustc`, though as a codegen option: `rustc -Z cf-protection=<none|branch|return|full>`. Tracking issue for future work is #93754.

2 years agoAdd documentation for rustdoc --check option
Guillaume Gomez [Tue, 15 Feb 2022 10:48:41 +0000 (11:48 +0100)]
Add documentation for rustdoc --check option

2 years agoFix GUI test
Guillaume Gomez [Tue, 15 Feb 2022 19:54:52 +0000 (20:54 +0100)]
Fix GUI test

2 years agoUpdate browser-ui-test version
Guillaume Gomez [Tue, 15 Feb 2022 20:31:31 +0000 (21:31 +0100)]
Update browser-ui-test version

2 years agouse AllocId and Ty in ExprKind::StaticRef and delay ConstValue construction
b-naber [Wed, 9 Feb 2022 15:18:57 +0000 (16:18 +0100)]
use AllocId and Ty in ExprKind::StaticRef and delay ConstValue construction

2 years agobless mir-opt tests
b-naber [Wed, 9 Feb 2022 13:21:49 +0000 (14:21 +0100)]
bless mir-opt tests

2 years agouse mir::Visitor when collecting alloc_ids in pretty printing
b-naber [Wed, 9 Feb 2022 13:21:25 +0000 (14:21 +0100)]
use mir::Visitor when collecting alloc_ids in pretty printing

2 years agobless tests
b-naber [Wed, 9 Feb 2022 10:43:47 +0000 (11:43 +0100)]
bless tests

2 years agotreat mir::ConstantKind::Val correctly in check_static_ptr
b-naber [Wed, 9 Feb 2022 10:43:04 +0000 (11:43 +0100)]
treat mir::ConstantKind::Val correctly in check_static_ptr

2 years agouse ConstantKind::Val in StaticRef
b-naber [Tue, 8 Feb 2022 11:14:44 +0000 (12:14 +0100)]
use ConstantKind::Val in StaticRef

2 years agoAuto merge of #93820 - compiler-errors:gat-wfcheck, r=jackh726
bors [Tue, 15 Feb 2022 19:03:38 +0000 (19:03 +0000)]
Auto merge of #93820 - compiler-errors:gat-wfcheck, r=jackh726

Rework GAT `where` clause check

rework the GAT where check to use a fixed-point algorithm, and check all GATs in a trait at once

fixes #93278

r? `@jackh726`
cc `@nikomatsakis`

2 years agoInline LocalExpnId::from_raw and LocalExpnId::as_raw
Tomasz Miąsko [Tue, 15 Feb 2022 00:00:00 +0000 (00:00 +0000)]
Inline LocalExpnId::from_raw and LocalExpnId::as_raw

2 years agoInline Target::deref
Tomasz Miąsko [Sat, 12 Feb 2022 00:00:00 +0000 (00:00 +0000)]
Inline Target::deref

2 years agoInline GenericArg conversion functions
Tomasz Miąsko [Thu, 10 Feb 2022 00:00:00 +0000 (00:00 +0000)]
Inline GenericArg conversion functions

2 years agoInline UnifyKey::index and UnifyKey::from_index
Tomasz Miąsko [Thu, 10 Feb 2022 00:00:00 +0000 (00:00 +0000)]
Inline UnifyKey::index and UnifyKey::from_index

2 years agoAdd removed comments back in self-outlives-lint
Michael Goulet [Mon, 14 Feb 2022 17:08:06 +0000 (09:08 -0800)]
Add removed comments back in self-outlives-lint

2 years agoadd some more comments to GAT where clause check
Michael Goulet [Sat, 12 Feb 2022 22:55:53 +0000 (14:55 -0800)]
add some more comments to GAT where clause check

2 years agoadd test for issue-93278, bless
Michael Goulet [Wed, 9 Feb 2022 06:28:00 +0000 (22:28 -0800)]
add test for issue-93278, bless

2 years agomake the gat wfcheck algorithm a loop
Michael Goulet [Fri, 11 Feb 2022 08:17:22 +0000 (00:17 -0800)]
make the gat wfcheck algorithm a loop