Commit graph

152337 commits

Author SHA1 Message Date
Yuki Okushi
1757d6b34d
Rollup merge of #87583 - tmiasko:compression-cache, r=wesleywiser
Refactor compression cache in v0 symbol mangler

* Remove redundant option around compression caches (they are always present).
* Flatten compression caches into symbol mangler to avoid dynamic memory allocation.
* Implement printer for `&mut SymbolMangler` instead of `SymbolMangler` to avoid passing now slightly larger symbol mangler by value.
2021-07-30 16:26:58 +09:00
Yuki Okushi
3bc6c28376
Rollup merge of #87574 - cuviper:retain-examples, r=joshtriplett
Update the examples in `String` and `VecDeque::retain`

The examples added in #60396 used a "clever" post-increment hack,
unrelated to the actual point of the examples. That hack was found
[confusing] in the users forum, and #81811 already changed the `Vec`
example to use a more direct iterator. This commit changes `String` and
`VecDeque` in the same way for consistency.

[confusing]: https://users.rust-lang.org/t/help-understand-strange-expression/62858
2021-07-30 16:26:57 +09:00
Yuki Okushi
55ce7ed5f2
Rollup merge of #87564 - spastorino:adjust-min-tait-removed-version, r=jackh726
min_type_alias_impl_trait is going to be removed in 1.56

#87501 removed `min_type_alias_impl_trait` but meanwhile that PR was approved in homu queue, a new beta was cut so we need to bump the version because it won't be removed in 1.55.

r? ```@oli-obk```

```@bors``` rollup=always
2021-07-30 16:26:56 +09:00
Yuki Okushi
aaef1a1649
Rollup merge of #87554 - sexxi-goose:fix-issue-87426, r=nikomatsakis
2229: Discr should be read when PatKind is Range

This PR fixes an issue related to pattern matching in closures when Edition 2021 is enabled.

- If any of the patterns the discr is being matched on is `PatKind::Range` then the discr should be read

r? ```@nikomatsakis```

Closes https://github.com/rust-lang/rust/issues/87426
2021-07-30 16:26:55 +09:00
Yuki Okushi
7e4b1737ff
Rollup merge of #87553 - bjorn3:fix_hotplug_codegen_version, r=wesleywiser
Fix typo in rustc_driver::version

This caused rustc `-Zcodegen-backend=foo.so -vV` to look for `oo.so` instead of `foo.so`
2021-07-30 16:26:54 +09:00
Yuki Okushi
fd79e7740b
Rollup merge of #87522 - frogtd:patch-1, r=yaahc
Fix assert in diy_float

The shifting should have gone the other way, the current incarnation is always true.
2021-07-30 16:26:53 +09:00
Yuki Okushi
c25b979db6
Rollup merge of #87052 - phlopsi:patch-1, r=jyn514
Optimize fmt::PadAdapter::wrap

After adding the first `write!` usage to my project and printing the result to the console, I noticed, that my binary contains the strings "called `Option::unwrap()` on a `None` value`" and more importantly "C:\Users\Patrick Fischer\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\fmt\builders.rs", with my release build being configured as follows:
```
[profile.release]
panic = "abort"
codegen-units = 1
strip = "symbols" # the important bit
lto = true
```
I am in a no_std environment and my custom panic handler is a simple `loop {}`. I did not expect the above information to be preserved. I heavily suspect the edited function to be the culprit. It contains the only direct use of `Option::unwrap` in the entire file and I tracked the symbols in the assembly to be used from the section `_ZN68_$LT$core..fmt..builders..PadAdapter$u20$as$u20$core..fmt..Write$GT$9write_str17ha1d5e5efe167202aE`.

Aside from me suspecting this function to be the culprit, the replaced code performs the same operation as `Option::insert`, but without the `unreachable_unchecked` optimization `Option::insert` provides. Therefore, it makes sense to me to use the more optimized version, instead.

As I don't change any semantics, I hope a simple pull request suffices.
2021-07-30 16:26:52 +09:00
bors
f739552870 Auto merge of #87483 - oli-obk:tait_ice, r=lqd
Mir borrowck does not generate lifetime variables for 'static lifetimes during opaque type resolution

Fixes #87455

This situation was unreachable before #87287 as we used to just grab the resolved opaque type from typeck and replaced all regions with new inference vars. After #87287 we let the `InferCx` in mir borrowck figure out the opaque type all by itself (which it already did before, but it only used the result to sanity check with the typeck result).
2021-07-30 07:02:34 +00:00
bors
fe1c942eee Auto merge of #87445 - amalik18:issue-83584-fix, r=kennytm
Fix may not to appropriate might not or must not

I went through and changed occurrences of `may not` to be more explicit with `might not` and `must not`.
2021-07-30 04:34:13 +00:00
Aaron Hill
4677efd01a
Bump LLVM for RegAllocFast bugfix
Fixes #83854
2021-07-29 19:23:41 -05:00
bors
e66a8c260c Auto merge of #87285 - GuillaumeGomez:intra-doc-span, r=estebank
Improve intra doc errors display

#87169

`@jyn514` This is what I had in mind to avoid having duplicated backticks. I also gave a try to simply updating the span for the suggestion/help messages but I think this current one is better because less "noisy". Anyway, that allows you to see the result. ;)
2021-07-29 23:33:18 +00:00
Jonas Schievink
c5a29f9245 Update error code description 2021-07-30 00:33:30 +02:00
Lukas Kalbertodt
5cc7702bde
Add docs about performance and Iterator::map to [T; N]::map 2021-07-30 00:08:48 +02:00
Jonas Schievink
550948c553 Update tests 2021-07-29 23:21:54 +02:00
Jonas Schievink
4ee1840c0c Add tracking issues 2021-07-29 23:21:54 +02:00
Jonas Schievink
3c6678a968 Add const_for test 2021-07-29 23:21:54 +02:00
Jonas Schievink
dbd126901a Add feature gates for for and ? in consts 2021-07-29 23:21:54 +02:00
bors
492723897e Auto merge of #85901 - ijackson:bufwriter-tweaks, r=joshtriplett
Bufwriter disassembly tweaks

In #80690 `@BurntSushi` observed that `WriterPanicked` was erroneously not exported, and suggested renaming `into_raw_parts` to `into_parts`. (More info in my commit messages.)

r? `@BurntSushi`
2021-07-29 20:52:34 +00:00
Yuki Okushi
5b5391e283
Add some TAIT-related regression tests 2021-07-30 04:49:08 +09:00
Wesley Wiser
286cdc81a8 [backtraces]: look for the begin symbol only after seeing end
On `x86_64-pc-windows-msvc`, we often get backtraces which look like
this:

```
10:     0x7ff77e0e9be5 - std::panicking::rust_panic_with_hook
11:     0x7ff77e0e11b4 - std::sys_common::backtrace::__rust_begin_short_backtrace::h5769736bdb11136c
12:     0x7ff77e0e116f - std::sys_common::backtrace::__rust_end_short_backtrace::h61c7ecb1b55338ae
13:     0x7ff77e0f89dd - std::panicking::begin_panic::h8e60ef9f82a41805
14:     0x7ff77e0e108c - d
15:     0x7ff77e0e1069 - c
16:     0x7ff77e0e1059 - b
17:     0x7ff77e0e1049 - a
18:     0x7ff77e0e1039 - core::ptr::drop_in_place<std::rt::lang_start<()>::{{closure}}>::h1bfcd14d5e15ba81
19:     0x7ff77e0e1186 - std::sys_common::backtrace::__rust_begin_short_backtrace::h5769736bdb11136c
20:     0x7ff77e0e100c - std::rt::lang_start::{{closure}}::ha054184bbf9921e3
```

Notice that `__rust_begin_short_backtrace` appears on frame 11 before
`__rust_end_short_backtrace` on frame 12. This is because in typical
release binaries without debug symbols, dbghelp.dll, which we use to walk
and symbolize the stack, does not know where CGU internal functions
start or end and so the closure invoked by `__rust_end_short_backtrace`
is incorrectly described as `__rust_begin_short_backtrace` because it
happens to be near that symbol.

While that can obviously change, this has been happening quite
consistently since #75048. Since this is a very small change to the std
and the change makes sense by itself, I think this is worth doing.

This doesn't completely resolve the situation for release binaries on
Windows, since without debug symbols, the stack printed can still show
incorrect symbol names (this is why the test uses `#[no_mangle]`) but it
does slightly improve the situation in that you see the same backtrace
you would see with `RUST_BACKTRACE=full` or in a debugger (without the
uninteresting bits at the top and bottom).
2021-07-29 13:51:27 -04:00
Wesley Wiser
3fda7086cc Add regression test 2021-07-29 13:51:27 -04:00
David Carlier
ce1bd70035 fs File get_path procfs usage for netbsd same as linux. 2021-07-29 17:49:48 +01:00
bors
a985d8e6c7 Auto merge of #87579 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2021-07-29 15:36:52 +00:00
Guillaume Gomez
0f7f85ede9 Update rustdoc-ui tests for intra-doc links errors 2021-07-29 17:36:11 +02:00
Aaron Hill
e70ce57f30
Remove unnecessary trailing semicolons from clippy tests 2021-07-29 09:52:35 -05:00
Ian Jackson
bf30c51541 Rename feature gate bufwriter_into_parts from bufwriter_into_raw_parts
As requested
  https://github.com/rust-lang/rust/pull/85901#pullrequestreview-698404772

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-07-29 15:23:32 +01:00
Ian Jackson
66f38075af BufWriter: rename into_parts from into_raw_parts
I looked in stdlib and as @BurntSushi thought, `raw` is generally
used for raw pointers, or other hazardous kinds of thing.  stdlib does
not have `into_parts` apart from the one I added to `IntoInnerError`.

I did an ad-hoc search of the rustdocs for my current game project
Otter, which includes quite a large number of dependencies.
`into_parts` seems heavily used for things quite like this.

So change this name.

Suggested-by: Andrew Gallant <jamslam@gmail.com>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-07-29 15:23:32 +01:00
Ian Jackson
cbba940daf BufWriter: actually export WriterPanicked error
I didn't notice the submodule, which means I failed to re-export this
to make it actually-public.

Reported-by: Andrew Gallant <jamslam@gmail.com>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-07-29 13:54:16 +01:00
Guillaume Gomez
cf0f5021f4 Add missing links for core::char types 2021-07-29 14:13:41 +02:00
Guillaume Gomez
a2f3e4a5da Change span for intra-doc links errors 2021-07-29 13:37:09 +02:00
Tomasz Miąsko
0eabbf84ba Implement Printer for &mut SymbolMangler
to avoid passing the symbol mangler by value.
2021-07-29 13:30:40 +02:00
Tomasz Miąsko
0ce8001a47 Flatten compression caches into symbol mangler
The compression caches currently don't have any dedicated functionality
that would benefit from being separated. Incorporating caches directly
into the symbol manger also avoids dynamic memory allocation.

The symbol mangler, which is often passed by value, is now slightly
larger. This aspect will be addressed by a follow-up commit.
2021-07-29 13:28:08 +02:00
Tomasz Miąsko
8307072edf Remove redundant option around compression caches
Compression caches are always present. Remove unnecessary option.
2021-07-29 13:28:04 +02:00
flip1995
8570a367e0
Update Cargo.lock (Clippy version bump) 2021-07-29 12:17:29 +02:00
flip1995
72d655b5b6
Merge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyup 2021-07-29 12:16:06 +02:00
bors
0cce3f643b Auto merge of #7504 - flip1995:rename-lints, r=flip1995
Rename two lints to comply with our lint naming convention

self_named_constructor -> self_named_constructors
append_instead_of_extend -> extend_with_drain

We don't need to `register_renamed` those lints, since I'll backport them to beta, so the old names won't hit stable.

changelog: none
(I'll adapt the changelog before merging #7498)
2021-07-29 10:14:31 +00:00
flip1995
54e539121d
Rename two lints to comply with our lint naming convention
self_named_constructor -> self_named_constructors
append_instead_of_extend -> extend_with_drain
2021-07-29 12:10:18 +02:00
bjorn3
2f6662da85 Use strip_prefix 2021-07-29 11:54:39 +02:00
bors
5fb3394cbd Auto merge of #86664 - m-ou-se:uninit-track-caller, r=JohnTitor
Add #[track_caller] for some function in core::mem.

These functions can panic for some types. This makes the panic point to the code that calls e.g. mem::uninitialized(), instead of inside the definition of mem::uninitialized.
2021-07-29 09:35:23 +00:00
bors
766f09f5c1 Auto merge of #7503 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2021-07-29 09:35:13 +00:00
flip1995
80116f9009
Bump Clippy Version -> 0.1.56 2021-07-29 11:15:11 +02:00
flip1995
7ed7b29d73
Bump nightly version -> 2021-07-29 2021-07-29 11:14:53 +02:00
flip1995
490beda6be
Merge remote-tracking branch 'upstream/master' into rustup 2021-07-29 11:14:25 +02:00
bors
6e0a8bf790 Auto merge of #86998 - m-ou-se:const-panic-fmt-as-str, r=oli-obk
Make const panic!("..") work in Rust 2021.

During const eval, this replaces calls to core::panicking::panic_fmt and std::panicking::being_panic_fmt with a call to a new const fn: core::panicking::const_panic_fmt. That function uses fmt::Arguments::as_str() to get the str and calls panic_str with that instead.

panic!() invocations with formatting arguments are still not accepted, as the creation of such a fmt::Arguments cannot be done in constant functions right now.

r? `@RalfJung`
2021-07-29 07:12:07 +00:00
Ali Malik
ffcf8a0d76 Fix may not to appropriate might not or must not 2021-07-29 01:16:53 -04:00
Ali Malik
e43254aad1 Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
bors
581b1664c9 Auto merge of #87416 - Aaron1011:query-side-effect, r=cjgillot
Create `QuerySideEffects` and use it for diagnostics

The code for saving and loading diagnostics during execution is generalized to handle a new `QuerySideEffects` struct. Currently, this struct just holds diagnostics - in a follow-up PR, I plan to add support for storing attriutes marked as used during query execution.

This is a pure refactor, with no intended behavior changes.
2021-07-29 02:51:19 +00:00
bors
85237886df Auto merge of #85874 - steffahn:fix_unsound_zip_optimization, r=yaahc
Remove unsound TrustedRandomAccess implementations

Removes the implementations that depend on the user-definable trait `Copy`.

Fixes #85873 in the most straightforward way.

<hr>

_Edit:_ This PR now contains additional trait infrastructure to avoid performance regressions around in-place collect, see the discussion in this thread starting from the codegen test failure at https://github.com/rust-lang/rust/pull/85874#issuecomment-872327577.

With this PR, `TrustedRandomAccess` gains additional documentation that specifically allows for and specifies the safety conditions around subtype coercions – those coercions can happen in safe Rust code with the `Zip` API’s usage of `TrustedRandomAccess`. This PR introduces a new supertrait of `TrustedRandomAccess`(currently named `TrustedRandomAccessNoCoerce`) that _doesn’t allow_ such coercions, which means it can be still be useful for optimizing cases such as in-place collect where no iterator is handed out to a user (who could do coercions) after a `get_unchecked` call; the benefit of the supertrait is that it doesn’t come with the additional safety conditions around supertraits either, so it can be implemented for more types than `TrustedRandomAccess`.

The `TrustedRandomAccess` implementations for `vec::IntoIter`, `vec_deque::IntoIter`, and `array::IntoIter` are removed as they don’t conform with the newly documented safety conditions, this way unsoundness is removed. But this PR in turn (re-)adds a `TrustedRandomAccessNoCoerce` implementation for `vec::IntoIter` to avoid performance regressions from stable in a case of in-place collecting of `Vec`s [the above-mentioned codegen test failure]. Re-introducing the (currently nightly+beta-only) impls for `VecDeque`’s and `[T; N]`’s iterators is technically possible, but goes beyond the scope of this PR (i.e. it can happen in a future PR).
2021-07-29 00:31:07 +00:00
Josh Stone
d4a60ab34f Update the examples in String and VecDeque::retain
The examples added in #60396 used a "clever" post-increment hack,
unrelated to the actual point of the examples. That hack was found
[confusing] in the users forum, and #81811 already changed the `Vec`
example to use a more direct iterator. This commit changes `String` and
`VecDeque` in the same way for consistency.

[confusing]: https://users.rust-lang.org/t/help-understand-strange-expression/62858
2021-07-28 16:35:59 -07:00
bors
4533be947b Auto merge of #87569 - JohnTitor:rollup-7ydfetw, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #81050 (Stabilize core::task::ready!)
 - #81363 (Remove P: Unpin bound on impl Future for Pin)
 - #86839 (Add doc aliases to fs.rs)
 - #87435 (fix example code for E0617)
 - #87451 (Add support for tuple struct field documentation)
 - #87491 (Integrate context into the memorial to Anna)
 - #87521 (Add long explanation for E0498)
 - #87527 (Don't run MIR unsafeck at all when using `-Zthir-unsafeck`)
 - #87550 (Add `CI_ONLY_WHEN_CHANNEL` and run `x86_64-gnu-stable` only on nightly)
 - #87565 (Use backticks when referring to `core::future::Ready` in panic message)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-28 22:06:51 +00:00