Commit Graph

210153 Commits

Author SHA1 Message Date
Dylan DPC
978e7abece
Rollup merge of #100633 - estebank:must_use_async_fn_return, r=tmandry
Consider `#[must_use]` annotation on `async fn` as also affecting the `Future::Output`

No longer lint against `#[must_use] async fn foo()`.

When encountering a statement that awaits on a `Future`, check if the
`Future`'s parent item is annotated with `#[must_use]` and emit a lint
if so. This effectively makes `must_use` an annotation on the
`Future::Output` instead of only the `Future` itself.

Fix #78149.
2022-11-11 20:51:38 +05:30
Oli Scherer
df2adc4760 Print all labels, even if they have no span. Fall back to main item's span. 2022-11-11 14:45:28 +00:00
Oli Scherer
21ce58732b Don't add message that will never be shown to users
It will still be used in json, as seen by the ui test changes
2022-11-11 14:45:28 +00:00
Oli Scherer
014f7f4092 Remove some redundant arguments 2022-11-11 14:17:27 +00:00
bors
742d3f02c2 Auto merge of #102872 - mikebenfield:better-get-discr, r=nagisa
rustc_codegen_ssa: Better code generation for niche discriminants.

In some cases we can avoid arithmetic before checking whether a niche is a tag.

Also rename some identifiers around niches.

This is relevant to #101872
2022-11-11 13:50:32 +00:00
Camille GILLOT
9d86e6abaf Use the interned stable hash as plain hash. 2022-11-11 13:02:37 +00:00
Camille GILLOT
d47424b833 Hash spans when interning. 2022-11-11 13:02:37 +00:00
Camille GILLOT
c42a4245cc Do not rename bound variables when verbose-printing binders. 2022-11-11 13:02:37 +00:00
León Orell Valerian Liehr
c2b906ba9a
Recover from fn ptr tys with generic param list 2022-11-11 13:42:40 +01:00
Albert Larsan
a1909b7b07
Try another way 2022-11-11 12:17:32 +01:00
Camille GILLOT
6c95805a34 Clean-up formatting. 2022-11-11 10:32:49 +00:00
Camille GILLOT
60892e8b1d Visit opaque types during type collection too. 2022-11-11 10:29:27 +00:00
Jannis Christopher Köhl
3c6d1a723d Add test for repr(transparent) with scalar 2022-11-11 11:24:31 +01:00
Albert Larsan
fb98796892
Apply suggestions 2022-11-11 11:14:09 +01:00
Camille GILLOT
3075f03513 Resolve lifetimes using the regular logic for RPIT. 2022-11-11 10:12:28 +00:00
Camille GILLOT
44c10e4cb0 Resolve lifetimes independently for each item-like. 2022-11-11 10:11:50 +00:00
Camille GILLOT
0ff1d1e122 Tweak signatures in rustc_middle::hir::map. 2022-11-11 10:10:16 +00:00
Florian Bartels
ae71df987b Add nto as known target_os 2022-11-11 10:44:48 +01:00
Florian Bartels
84e1fbcadf Add no_std AArch64 support for the QNX Neutrino (nto) 7.1 RTOS
This change allows to compile no_std applications for the QNX Neutrino
realtime operating system for ARM 64 bit CPUs.
Tested with QNX Neutrino 7.1.
2022-11-11 10:44:48 +01:00
Michael Benfield
51918dcc51 rustc_codegen_ssa: Better code generation for niche discriminants.
In some cases we can avoid arithmetic before checking whether a niche
represents an untagged variant.

This is relevant to #101872
2022-11-11 05:54:30 +00:00
bors
b7b7f2716e Auto merge of #103898 - Nilstrieb:match-macro, r=nnethercote
Retry failed macro matching for diagnostics

When a declarative macro fails to match, retry the matching to collect diagnostic info instead of collecting it on the fly in the hot path. Split out of #103439.

You made a bunch of changes to declarative macro matching, so
r? `@nnethercote`

This change should produce a few small perf wins: https://github.com/rust-lang/rust/pull/103439#issuecomment-1294249602
2022-11-11 04:54:59 +00:00
Ben Reeves
94f67e667b Oops, bless this test. 2022-11-10 22:14:08 -06:00
Esteban Küber
f57713b010 Fix tests after rebase 2022-11-10 19:01:33 -08:00
bors
5b82ea74b7 Auto merge of #99918 - WaffleLapkin:fnFnfun, r=estebank
Recover wrong-cased keywords that start items

(_this pr was inspired by [this tweet](https://twitter.com/Azumanga/status/1552982326409367561)_)

r? `@estebank`

We've talked a bit about this recovery, but I just wanted to make sure that this is the right approach :)

For now I've only added the case insensitive recovery to `use`s, since most other items like `impl` blocks, modules, functions can start with multiple keywords which complicates the matter.
2022-11-11 02:07:52 +00:00
Esteban Küber
8bd8484972 review comments 2022-11-10 18:06:59 -08:00
Esteban Küber
243496e129 Consider #[must_use] annotation on async fn as also affecting the Future::Output
No longer lint against `#[must_use] async fn foo()`.

When encountering a statement that awaits on a `Future`, check if the
`Future`'s parent item is annotated with `#[must_use]` and emit a lint
if so. This effectively makes `must_use` an annotation on the
`Future::Output` instead of only the `Future` itself.

Fix #78149.
2022-11-10 18:01:03 -08:00
Esteban Küber
50bb7a40e1 Tweak span for #[must_use]
Do not point at whole statement, only at the expression (skip pointing at `;`)
2022-11-10 18:01:02 -08:00
Takayuki Maeda
6018f115aa emit errors when using RangeFrom and RangeTo 2022-11-11 10:51:02 +09:00
Takayuki Maeda
004986b79b avoid unnecessary format! 2022-11-11 10:51:02 +09:00
Takayuki Maeda
c467006fd0 suggest removing unnecessary . to use a floating point literal 2022-11-11 10:51:00 +09:00
kubycsolutions
b8edf0213e Avoid runtime dependency on static libstdc++
Usually, we do want to use the static C++ library when building rustc_llvm, but do not want to have that dependency at compiler runtime. Change the defaults to Make It So.
2022-11-10 19:37:09 -05:00
Michael Howell
0f3ae6218e rustdoc: use checkbox instead of switch for settings toggles
The switch is designed to give the application a "physical" feel, but
nothing else in here really followed through. They didn't support the
"flick" gesture that real iOS switches support, and the radio
buttons that were also used in Rustdoc Settings were a more "classic"
form element anyway.

Also, while "switches" are the exclusive toggle design on iOS (since
[Apple HIG] reserves checkboxes for Mac only), the [Google Material]
guidelines say that lists of switches are bad, and you should just use
check boxes.

[Apple HIG]: https://developer.apple.com/design/human-interface-guidelines/components/selection-and-input/toggles
[Google Material]: https://m3.material.io/components/checkbox/guidelines#6902f23d-ceba-4b19-ae3b-b78b9b01d185
2022-11-10 17:22:37 -07:00
Michael Goulet
07aa592504 Regression test for coercion of mut-ref to dyn-star 2022-11-10 23:54:34 +00:00
Albert Larsan
d85b61460a
Add a reference to ilog2 in leading_zeros integer docs
Asked in #104248
2022-11-11 00:47:52 +01:00
Michael Goulet
fea8d0eb99 More nits 2022-11-10 21:29:20 +00:00
Michael Goulet
43ad19b250 bless tests 2022-11-10 21:18:06 +00:00
lcnr
8ec6c84bb3 add some more tests 2022-11-10 21:18:06 +00:00
lcnr
0f2e45b18f make Sized coinductive 2022-11-10 21:18:06 +00:00
Michael Goulet
9c8037c430 Deduce closure signature from TAIT supertraits 2022-11-10 20:24:41 +00:00
Michael Goulet
55f1f993ff More accurately report error when formal and expected signature types differ 2022-11-10 20:21:31 +00:00
Michael Goulet
312d6b8e9a Don't emit coerce suggestions for a type into itself 2022-11-10 20:21:13 +00:00
bors
c1a859b25a Auto merge of #104164 - cjgillot:u64-cache, r=compiler-errors
Use 64 bits for incremental cache in-file positions

We currently use a 32-bit integer to encode byte positions into the incremental cache.
This is not enough when the query chache file is >4GB.

As the overflow check was a `debug_assert`, it was removed in released compilers, making compilation succeed silently.
At the next compilation, cache decoding would try to read unrelated data because of garbled file position, triggering an ICE.

Fixes https://github.com/rust-lang/rust/issues/79786
(I'm closing that bug since it the original report and the subsequent questions are probably different instances. A new bug should be opened for new instances of that ICE.)
2022-11-10 20:13:42 +00:00
Michael Goulet
033cf9880d Support DoubleEndedIterator for subst_iter and subst_iter_copied 2022-11-10 19:36:14 +00:00
Ben Reeves
fe53cacff9 Apply PR feedback. 2022-11-10 12:56:33 -06:00
Ben Reeves
c0ae62ee95 Require ~const qualifier on trait bounds in specializing impls if present in base impl. 2022-11-10 12:37:07 -06:00
Ben Reeves
d492b9b000 Add #[const_trait] where needed in tests. 2022-11-10 12:37:07 -06:00
Ben Reeves
ce03d259da Disallow specializing on const impls with non-const impls. 2022-11-10 12:37:06 -06:00
Ben Reeves
5c25d30f6f Allow specialized const trait impls.
Fixes #95186.
Fixes #95187.
2022-11-10 12:37:06 -06:00
Jannis Christopher Köhl
8ecb276735 Simplify creation of map 2022-11-10 19:12:10 +01:00
Guillaume Gomez
149ab45ead Add GUI test for :target 2022-11-10 18:53:31 +01:00