Commit graph

161121 commits

Author SHA1 Message Date
bors b13a5bf3c4 Auto merge of #92927 - matthiaskrgr:rollup-pgzwfcm, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #92747 (Simplification of BigNum::bit_length)
 - #92767 (Use the new language identifier for Rust in the PDB debug format)
 - #92775 (Inline std::os::unix::ffi::OsStringExt methods)
 - #92863 (Remove `&mut` from `io::read_to_string` signature)
 - #92865 (Ignore static lifetimes for GATs outlives lint)
 - #92873 (Generate more precise generator names)
 - #92879 (Add Sync bound to allocator parameter in vec::IntoIter)
 - #92892 (Do not fail evaluation in const blocks)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-15 10:57:03 +00:00
Matthias Krüger 539175c026
Rollup merge of #92892 - compiler-errors:const-param-env-for-const-block, r=fee1-dead
Do not fail evaluation in const blocks

Evaluate const blocks with a const param-env, so we properly check `~const` trait bounds.

Fixes #92713
(I will fix the poor diagnostics in #92713 and #92712 in a separate PR)

cc `@nbdd0121` who wrote the code this PR touches in #89561
2022-01-15 11:28:28 +01:00
Matthias Krüger 784e4ba9a4
Rollup merge of #92879 - compiler-errors:into_iter_unsound, r=dtolnay
Add Sync bound to allocator parameter in vec::IntoIter

The `A: Sync` bound was forgotten in 8725e4c337 (diff-b78c3ab6d37f4ede32195707528f8a76c49d4557cc9d3a7a09417b5157729b9fR3132)

Similar `unsafe impl Sync` in that commit _do_ include the `A: Sync` bound (and around the alloc lib), so I think this was just an honest mistake.

Here's an example of the unsoundness:  https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=16cbfeff7c934ae72ab632c1476fdd8b

`@steffahn` found this, I'm just putting up the fix cause nobody else did :^)

Fixes #92633
2022-01-15 11:28:27 +01:00
Matthias Krüger 85c119cd51
Rollup merge of #92873 - eholk:async-symbol-names, r=tmandry
Generate more precise generator names

Currently all generators are named with a `generator$N` suffix, regardless of where they come from. This means an `async fn` shows up as a generator in stack traces, which can be surprising to async programmers since they should not need to know that async functions are implementated using generators.

This change generators a different name depending on the generator kind, allowing us to tell whether the generator is the result of an async block, an async closure, an async fn, or a plain generator.

r? `@tmandry`
cc `@michaelwoerister` `@wesleywiser` `@dpaoliello`
2022-01-15 11:28:26 +01:00
Matthias Krüger cd93be0094
Rollup merge of #92865 - jackh726:gats-outlives-no-static, r=nikomatsakis
Ignore static lifetimes for GATs outlives lint

cc https://github.com/rust-lang/rust/issues/87479#issuecomment-1010484170

Also included a bit of cleanup of `ty_known_to_outlive` and `region_known_to_outlive`

r? `@nikomatsakis`
2022-01-15 11:28:25 +01:00
Matthias Krüger d878ad0559
Rollup merge of #92863 - camelid:read_to_string-rm-mut, r=m-ou-se
Remove `&mut` from `io::read_to_string` signature

``@m-ou-se`` [realized][1] that because `Read` is implemented for `&mut impl
Read`, there's no need to take `&mut` in `io::read_to_string`.

Removing the `&mut` from the signature allows users to remove the `&mut`
from their calls (and thus pass an owned reader) if they don't use the
reader later.

r? `@m-ou-se`

[1]: https://github.com/rust-lang/rust/issues/80218#issuecomment-874322129
2022-01-15 11:28:24 +01:00
Matthias Krüger 1b241bb703
Rollup merge of #92775 - xfix:osstringext-inline, r=m-ou-se
Inline std::os::unix::ffi::OsStringExt methods

Those methods essentially do nothing at assembly level. On Unix systems, `OsString` is represented as a `Vec` without performing any transformations.
2022-01-15 11:28:23 +01:00
Matthias Krüger ff1db43b50
Rollup merge of #92767 - arlosi:pdbenum, r=cuviper
Use the new language identifier for Rust in the PDB debug format

Rust currently identifies as MASM (Microsoft Assembler) in the PDB
debug info format on Windows because no identifier was available.

This change pulls in a cherry-pick to Rust's LLVM that includes the
change to use the new identifier for Rust.

https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang
2022-01-15 11:28:22 +01:00
Matthias Krüger f511360fd2
Rollup merge of #92747 - swenson:bignum-bit-length-optimization, r=scottmcm
Simplification of BigNum::bit_length

As indicated in the comment, the BigNum::bit_length function could be
optimized by using CLZ, which is often a single instruction instead a
loop.

I think the code is also simpler now without the loop.

I added some additional tests for Big8x3 and Big32x40 to ensure that
there were no regressions.
2022-01-15 11:28:22 +01:00
bors 38c22af015 Auto merge of #92604 - nnethercote:optimize-impl_read_unsigned_leb128, r=michaelwoerister
Optimize `impl_read_unsigned_leb128`

I see instruction count improvements of up to 3.5% locally with these changes, mostly on the smaller benchmarks.

r? `@michaelwoerister`
2022-01-15 07:27:30 +00:00
bors 69d25fc582 Auto merge of #92915 - matthiaskrgr:rollup-pxxk8jp, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #92191 (Prefer projection candidates instead of param_env candidates for Sized predicates)
 - #92382 (Extend const_convert to rest of blanket core::convert impls)
 - #92625 (Add `#[track_caller]` to `mirbug`)
 - #92684 (Export `tcp::IntoIncoming`)
 - #92743 (Use pre-interned symbols in a couple of places)
 - #92838 (Clean up some links in RELEASES)
 - #92868 (librustdoc: Address some clippy lints)
 - #92875 (Make `opt_const_param_of` work in the presence of `GenericArg::Infer`)
 - #92891 (Add myself to .mailmap)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-15 04:24:13 +00:00
Matthias Krüger ff6c17598f
Rollup merge of #92891 - JamesHinshelwood:patch-1, r=Mark-Simulacrum
Add myself to .mailmap

(to de-duplicate my identities in the contributors list)
2022-01-15 02:25:21 +01:00
Matthias Krüger 6c94f99d83
Rollup merge of #92875 - BoxyUwU:infer_arg_opt_const_param_of, r=lcnr
Make `opt_const_param_of` work in the presence of `GenericArg::Infer`

highly recommend viewing the first and second commits on their own rather than looking at file changes 🤣

Because we filtered args down to just const args we would ignore `GenericArg::Infer` which made us get a `arg_index` which was wrong by however many const `GenericArg::Infer` came previously

[example](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=46dba6a53aca6333028a10908ef16e0b) of the [bugs](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=a8eebced26eefa4119fc2e7ae0c76de6) fixed.

r? ```@lcnr```
2022-01-15 02:25:20 +01:00
Matthias Krüger 8f4155909c
Rollup merge of #92868 - pierwill:librustdoc-clippy, r=camelid
librustdoc: Address some clippy lints
2022-01-15 02:25:19 +01:00
Matthias Krüger c693442f4c
Rollup merge of #92838 - ehuss:cleanup-release-links, r=Mark-Simulacrum
Clean up some links in RELEASES

This fixes some issues with markdown links in the RELEASES file.
2022-01-15 02:25:18 +01:00
Matthias Krüger 8326f3f317
Rollup merge of #92743 - bjorn3:less_symbol_intern, r=camelid
Use pre-interned symbols in a couple of places

Re-open of https://github.com/rust-lang/rust/pull/92733 as bors glitched.
2022-01-15 02:25:17 +01:00
Matthias Krüger d7e512c5c7
Rollup merge of #92684 - ibraheemdev:patch-10, r=m-ou-se
Export `tcp::IntoIncoming`

Added in #88339 but not publicly exported.
2022-01-15 02:25:16 +01:00
Matthias Krüger 8df08e8bce
Rollup merge of #92625 - inquisitivecrystal:mirbug-caller, r=michaelwoerister
Add `#[track_caller]` to `mirbug`

When a "'no errors encountered even though `delay_span_bug` issued" error results from the `mirbug` function, the file location information points to the `mirbug` function itself, rather than its caller. This doesn't make sense, since the caller is the real source of the bug. Adding `#[track_caller]` will produce diagnostics that are more useful to anyone fixing the ICE.
2022-01-15 02:25:15 +01:00
Matthias Krüger 1d9ab77eb7
Rollup merge of #92382 - clarfonthey:const_convert, r=scottmcm
Extend const_convert to rest of blanket core::convert impls

This adds constness to all the blanket impls in `core::convert` under the existing `const_convert` feature, tracked by #88674.

Existing impls under that feature:

```rust
impl<T> const From<T> for T;
impl<T, U> const Into<U> for T where U: ~const From<T>;

impl<T> const ops::Try for Option<T>;
impl<T> const ops::FromResidual for Option<T>;

impl<T, E> const ops::Try for Result<T, E>;
impl<T, E, F> const ops::FromResidual<Result<convert::Infallible, E>> for Result<T, F> where F: ~const From<E>;
```

Additional impls:

```rust
impl<T: ?Sized, U: ?Sized> const AsRef<U> for &T where T: ~const AsRef<U>;
impl<T: ?Sized, U: ?Sized> const AsRef<U> for &mut T where T: ~const AsRef<U>;
impl<T: ?Sized, U: ?Sized> const AsMut<U> for &mut T where T: ~const AsMut<U>;

impl<T, U> const TryInto<U> for T where U: ~const TryFrom<T>;
impl<T, U> const TryFrom<U> for T where U: ~const Into<T>;
```
2022-01-15 02:25:14 +01:00
Matthias Krüger 64716825b0
Rollup merge of #92191 - jackh726:issue-89352, r=nikomatsakis
Prefer projection candidates instead of param_env candidates for Sized predicates

Fixes #89352

Also includes some drive by logging and verbose printing changes that I found useful when debugging this, but I can remove this if needed.

This is a little hacky - but imo no more than the rest of `candidate_should_be_dropped_in_favor_of`. Importantly, in a Chalk-like world, both candidates should be completely compatible.

r? ```@nikomatsakis```
2022-01-15 02:25:14 +01:00
bors de9b573eed Auto merge of #92912 - calebcartwright:rustfmt-generated-files, r=Mark-Simulacrum
resolve rustfmt issue with generated files

Discussed in https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/1.2E58.20patch.20release

refs https://github.com/rust-lang/rustfmt/issues/5080#issuecomment-1013303455 and https://github.com/rust-lang/rustfmt/issues/5172

updating in-tree vs. subtree sync to make backporting easier, would like to nominate backporting to both beta/1.59 as well as the 1.58.1 patch release
2022-01-15 01:18:10 +00:00
Caleb Cartwright bcf72a7293 fix(rustfmt): resolve generated file formatting issue 2022-01-14 18:18:37 -06:00
Michael Goulet b9a3c32f31 Do not fail evaluation in const blocks 2022-01-14 13:05:16 -08:00
bors b0ec3e09a9 Auto merge of #91948 - nnethercote:rustdoc-more-Symbols, r=GuillaumeGomez
rustdoc: avoid many `Symbol` to `String` conversions.

Particularly when constructing file paths and fully qualified paths.
This avoids a lot of allocations, speeding things up on almost all
examples.

r? `@GuillaumeGomez`
2022-01-14 20:34:18 +00:00
Noah Lev c7147e4e1a Document and test UrlPartsBuilder::push_fmt 2022-01-14 12:05:35 -08:00
Noah Lev cef250d90b Make AVG_PART_LENGTH a power of 2
I seem to recall that in general, it's best to request an allocation
with a size that's a power of 2. The low estimate of 5 was probably a
little too low as well.
2022-01-14 12:05:35 -08:00
Noah Lev 8f59eb6da0 Estimate path length instead of hardcoding 64 bytes 2022-01-14 12:05:35 -08:00
Noah Lev 53f1bed83a Use UrlPartsBuilder and remove join_with_slash 2022-01-14 12:05:35 -08:00
Nicholas Nethercote 6b19cf9f74 rustdoc: remove some unnecessary sigils. 2022-01-14 12:05:35 -08:00
Nicholas Nethercote 1e4637cf4d rustdoc: remove many unnecessary .as_ref() calls. 2022-01-14 12:05:34 -08:00
Nicholas Nethercote 10b1c9aa8b rustdoc: avoid many Symbol to String conversions.
Particularly when constructing file paths and fully qualified paths.
This avoids a lot of allocations, speeding things up on almost all
examples.
2022-01-14 11:57:18 -08:00
bors ad46af2471 Auto merge of #92883 - matthiaskrgr:rollup-uoudywx, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #92045 (Don't fall back to crate-level opaque type definitions.)
 - #92381 (Suggest `return`ing tail expressions in async functions)
 - #92768 (Partially stabilize `maybe_uninit_extra`)
 - #92810 (Deduplicate box deref and regular deref suggestions)
 - #92818 (Update documentation for doc_cfg feature)
 - #92840 (Fix some lints documentation)
 - #92849 (Clippyup)
 - #92854 (Use the updated Rust logo in rustdoc)
 - #92864 (Fix a missing dot in the main item heading)

Failed merges:

 - #92838 (Clean up some links in RELEASES)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-14 17:31:28 +00:00
Eric Huss 6b726a10ee Fix some links that had colliding reference names.
These reference names were very general, and used in other places.
2022-01-14 07:49:43 -08:00
Eric Huss c7926c7dd8 Fix link name collision for cargo#2365 (1.8cv) 2022-01-14 07:49:43 -08:00
Eric Huss 12fa471984 Fix incorrect link for #38622. 2022-01-14 07:49:43 -08:00
Eric Huss c1526c69f2 Remove duplicate #39983. It was part of 1.19. 2022-01-14 07:49:43 -08:00
Eric Huss ddab0bf6bf Remove duplicate cargo/4270. It was part of 1.21. 2022-01-14 07:49:43 -08:00
Eric Huss 9b9fc606a6 Remove unused link references. 2022-01-14 07:48:45 -08:00
bors 02c9e73e6c Auto merge of #92681 - Aaron1011:task-deps-ref, r=cjgillot
Introduce new `TaskDepsRef` enum to track allow/ignore/forbid status
2022-01-14 14:20:17 +00:00
Ellen 61c07a9a23 reviews ish 2022-01-14 13:45:07 +00:00
James Hinshelwood fd7cc7978e
Add myself to .mailmap
(to de-duplicate my identities in the contributors list)
2022-01-14 10:13:50 +00:00
Matthias Krüger 2ae4afddd7
Rollup merge of #92864 - Urgau:fix-missing-source-dot, r=jsha
Fix a missing dot in the main item heading

This pull-request fix a missing `·` in the item header ~~and also make use of `&nbsp;` to explicit that the spaces are mandatory~~.

| Before | After |
| --- | --- |
| ![image](https://user-images.githubusercontent.com/3616612/149393966-7cca6dc5-9a62-47fa-8c9c-18f936d43aa9.png) | ![image](https://user-images.githubusercontent.com/3616612/149393869-5ffd6e44-d91c-4ece-b69e-d103304f6626.png) |

PS: This was introduce yesterday by https://github.com/rust-lang/rust/pull/92526 (the migration from Tera to Askama) and is not currently observable in the nightly doc.
2022-01-14 07:47:39 +01:00
Matthias Krüger dae3ef2eb2
Rollup merge of #92854 - Urgau:better-rust-logo, r=GuillaumeGomez
Use the updated Rust logo in rustdoc

This pull-request use the updated Rust logo from https://github.com/rust-lang/rust-artwork/pull/9 and also change the logo format from PNG to SVG.

| Before | After |
| --- | --- |
| ![Screenshot 2022-01-13 at 14-33-40 std - Rust](https://user-images.githubusercontent.com/3616612/149342697-7afe4c3e-2be5-444b-86f3-118712b4f7ae.png) | ![Screenshot 2022-01-13 at 14-33-15 std - Rust](https://user-images.githubusercontent.com/3616612/149342705-54ed27c6-0806-4c2d-baa1-4d65ed897e2b.png) |

I also took the liberty to update the two PNG favicons with the SVG reducing their size by ~35% each.

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

r? ```@jsha```
2022-01-14 07:47:38 +01:00
Matthias Krüger ccfee3d53b
Rollup merge of #92849 - flip1995:clippyup, r=Manishearth
Clippyup

r? ```@Manishearth```
2022-01-14 07:47:37 +01:00
Matthias Krüger 1794b24bf9
Rollup merge of #92840 - hafeoz:master, r=ehuss
Fix some lints documentation

Several lints documentation failed to show the output of the example (mostly due to `ignore` attribute):

- [irrefutable_let_patterns](https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#irrefutable-let-patterns)
- [asm_sub_register](https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#asm-sub-register)
- [bad_asm_style](https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#bad-asm-style)
- [ineffective_unstable_trait_impl](https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html#ineffective-unstable-trait-impl)
- duplicate_macro_attributes

This pull request fixes these lints output so that they can be displayed properly.
2022-01-14 07:47:36 +01:00
Matthias Krüger 3cbc448c9c
Rollup merge of #92818 - GuillaumeGomez:update-doc-cfg-doc, r=camelid
Update documentation for doc_cfg feature

Fixes  #92484.
2022-01-14 07:47:35 +01:00
Matthias Krüger 9d5cb20978
Rollup merge of #92810 - compiler-errors:deduplicate-box-deref-suggestion, r=camelid
Deduplicate box deref and regular deref suggestions

Remove the suggestion code special-cased for Box deref.

r? ```@camelid```
since you introduced the code in #90627
2022-01-14 07:47:34 +01:00
Matthias Krüger 558da934c1
Rollup merge of #92768 - ojeda:stabilize-maybe_uninit_extra, r=Mark-Simulacrum
Partially stabilize `maybe_uninit_extra`

This covers:

```rust
impl<T> MaybeUninit<T> {
    pub unsafe fn assume_init_read(&self) -> T { ... }
    pub unsafe fn assume_init_drop(&mut self) { ... }
}
```

It does not cover the const-ness of `write` under `const_maybe_uninit_write` nor the const-ness of `assume_init_read` (this commit adds `const_maybe_uninit_assume_init_read` for that).

FCP: https://github.com/rust-lang/rust/issues/63567#issuecomment-958590287.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-01-14 07:47:33 +01:00
Matthias Krüger 347c744fe0
Rollup merge of #92381 - ThePuzzlemaker:issue-92308, r=estebank
Suggest `return`ing tail expressions in async functions

This PR fixes #92308.

Previously, the suggestion to `return` tail expressions (introduced in #81769) did not apply to `async` functions, as the suggestion checked whether the types were equal disregarding `impl Future<Output = T>` syntax sugar for `async` functions. This PR changes that in order to fix a potential papercut.

I'm not sure if this is the "right" way to do this, so if there is a better way then please let me know.

I amended an existing test introduced in #81769 to add a regression test for this, if you think I should make a separate test I will.
2022-01-14 07:47:32 +01:00
Matthias Krüger f13e871ac5
Rollup merge of #92045 - oli-obk:cleanup, r=petrochenkov
Don't fall back to crate-level opaque type definitions.

That would just hide bugs, as it works accidentally if the opaque type is defined at the crate level.

Only works after #90948 which worked by accident for our entire test suite.
2022-01-14 07:47:31 +01:00