Commit Graph

127577 Commits

Author SHA1 Message Date
Esteban Kuber
1db02b8a43 Change wording of missing return type suggestion 2022-03-27 02:20:17 +00:00
Esteban Kuber
1c85987274 Point (again) to more expressions with their type, even if not fully resolved 2022-03-27 02:20:17 +00:00
Esteban Kuber
474626af50 Eagerly replace {integer}/{float} with i32/f64 for suggestion 2022-03-27 02:20:16 +00:00
Vadim Petrochenkov
a7d7a268e9 resolve: Simplify some diagnostic code to avoid an ICE 2022-03-27 02:43:29 +03:00
bors
551b4fa395 Auto merge of #92472 - petrochenkov:nowrapident, r=Aaron1011
proc-macro: Stop wrapping `ident` matchers into groups

`ident` is always a single token and can be treated in the same way as `tt`.
r? `@Aaron1011`
2022-03-26 23:01:12 +00:00
bors
1d9c262eea Auto merge of #95274 - jendrikw:slice-must-use, r=Dylan-DPC
add #[must_use] to functions of slice and its iterators.

Continuation of #92853.

Tracking issue: #89692.
2022-03-26 20:17:04 +00:00
Jendrik
531080e8e5 add #[must_use] to functions of slice and its iterators. 2022-03-26 16:19:47 +01:00
Jendrik
754fdb0aa5 add #[must_use] to functions of slice and its iterators. 2022-03-26 15:37:48 +01:00
Vadim Petrochenkov
baa3ad4dc8 proc-macro: Stop wrapping ident matchers into groups 2022-03-26 12:38:46 +03:00
DrMeepster
e9f08e709d fix wrong header command 2022-03-25 23:46:37 -07:00
DrMeepster
46dadfc142 widen special case on deref to all non-zst allocators 2022-03-25 23:16:23 -07:00
bors
d4acac935b Auto merge of #95299 - mkroening:rm-hermitkernel, r=joshtriplett
Remove hermitkernel targets

RustyHermit now maintains custom json targets, which are distributed with the kernel: https://github.com/hermitcore/libhermit-rs/pull/395

See https://github.com/hermitcore/rusty-hermit/issues/197#issuecomment-1076667961
CC: `@stlankes,` `@bstrie`
2022-03-26 03:19:49 +00:00
bors
c74925438c Auto merge of #95149 - cjgillot:once-diag, r=estebank
Remove `Session::one_time_diagnostic`

This is untracked mutable state, which modified the behaviour of queries.
It was used for 2 things: some full-blown errors, but mostly for lint declaration notes ("the lint level is defined here" notes).

It is replaced by the diagnostic deduplication infra which already exists in the diagnostic emitter.
A new diagnostic level `OnceNote` is introduced specifically for lint notes, to deduplicate subdiagnostics.

As a drive-by, diagnostic emission takes a `&mut` to allow dropping the `SubDiagnostic`s.
2022-03-26 00:54:54 +00:00
Caio
9e0b7c3f44 Minor let_chains modification 2022-03-25 18:50:52 -03:00
Michael Howell
2a7837262f diagnostics: correct generic bounds with doubled colon
Fixes #95208
2022-03-25 13:57:05 -07:00
Guillaume Gomez
e0a697aad4 Replace wait-for instructions for rustdoc GUI tests with wait-for-css 2022-03-25 21:32:16 +01:00
Guillaume Gomez
98d51960c4 Update browser-ui-test version to 0.8.4 2022-03-25 21:12:31 +01:00
bors
3fe3b89cd5 Auto merge of #95282 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/95258
r? `@ghost`
2022-03-25 16:45:08 +00:00
Grisha Vartanyan
c3840c9ea1 Update clippy helper function types 2022-03-25 15:05:27 +01:00
Camille GILLOT
f7d5b7afb7 Bless rustdoc tests. 2022-03-25 12:50:48 +01:00
bors
903427b2e8 Auto merge of #95255 - petrochenkov:suggresolve, r=michaelwoerister
resolve: Do not build expensive suggestions if they are not actually used

And remove a bunch of (conditionally) unused parameters from path resolution functions.

This helps with performance issues in https://github.com/rust-lang/rust/pull/94857, and should be helpful in general even without that.
2022-03-25 11:35:19 +00:00
Martin Kröning
335d196498 Remove hermitkernel targets
RustyHermit now maintains custom json targets, which are distributed with the kernel. [1]

[1]: https://github.com/hermitcore/libhermit-rs/pull/395
2022-03-25 11:52:11 +01:00
bors
e70e211e99 Auto merge of #95082 - spastorino:overlap-inherent-impls, r=nikomatsakis
Overlap inherent impls

r? `@nikomatsakis`

Closes #94526
2022-03-25 09:09:48 +00:00
Michael Goulet
91ac9cf595 suggest wrapping single-expr blocks in square brackets 2022-03-24 21:40:20 -07:00
bors
4ce257ff19 Auto merge of #92361 - vacuus:doctest-run-test-out-lines, r=CraftSpider
Remove `collect` in `doctest::run_test`
2022-03-25 04:01:00 +00:00
bors
661e8beec1 Auto merge of #95291 - Dylan-DPC:rollup-vrb4wlw, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #94391 (Fix ice when error reporting recursion errors)
 - #94655 (Clarify which kinds of MIR are allowed during which phases.)
 - #95179 (Try to evaluate in try unify and postpone resolution of constants that contain inference variables)
 - #95270 (debuginfo: Fix debuginfo for Box<T> where T is unsized.)
 - #95276 (add diagnostic items for clippy's `trim_split_whitespace`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-25 01:20:01 +00:00
Dylan DPC
e039dc813b
Rollup merge of #95270 - michaelwoerister:fix-box-unsized-debuginfo, r=wesleywiser
debuginfo: Fix debuginfo for Box<T> where T is unsized.

Before this fix, the debuginfo for the fields was generated from the struct defintion of Box<T>, but (at least at the moment) the compiler pretends that Box<T> is just a (fat) pointer, so the fields need to be `pointer` and `vtable` instead of `__0: Unique<T>` and `__1: Allocator`.

This is meant as a temporary mitigation until we can make sure that simply treating Box as a regular struct in debuginfo does not cause too much breakage in the ecosystem.

r? ````@wesleywiser````
2022-03-25 01:34:31 +01:00
Dylan DPC
1fcb8fc3e0
Rollup merge of #95179 - b-naber:eval-in-try-unify, r=lcnr
Try to evaluate in try unify and postpone resolution of constants that contain inference variables

We want code like that in [`ui/const-generics/generic_const_exprs/eval-try-unify.rs`](https://github.com/rust-lang/rust/compare/master...b-naber:eval-in-try-unify?expand=1#diff-8027038201cf07a6c96abf3cbf0b0f4fdd8a64ce6292435f01c8ed995b87fe9b) to compile. To do that we need to try to evaluate constants in `try_unify_abstract_consts`, this requires us to be more careful about what constants we try to resolve, specifically we cannot try to resolve constants that still contain inference variables.

r? `@lcnr`
2022-03-25 01:34:30 +01:00
Dylan DPC
d1d4613ead
Rollup merge of #94391 - light4:issue-90319, r=estebank
Fix ice when error reporting recursion errors

Fixes: #90319, #92148, #93955
2022-03-25 01:34:28 +01:00
Vadim Petrochenkov
74d079d566 resolve: Stop passing unused spans and node ids to path resolution functions 2022-03-25 02:03:54 +03:00
Vadim Petrochenkov
15a8b981e0 resolve: Optimize path resolution for rustdoc
Do not construct or pass unused data
2022-03-25 02:03:54 +03:00
Vadim Petrochenkov
0749ec67bc resolve: Do not build expensive suggestions if they are not actually used
Also remove a redundant parameter from `fn resolve_path(_with_ribs)`, `crate_lint: CrateLint` is a more detailed version of `record_used: bool` with `CrateLint::No` meaning `false` and anything else meaning `true`.
2022-03-25 02:03:54 +03:00
bors
7941b3f147 Auto merge of #95273 - flip1995:clippyup, r=manishearth
Update Clippy

r? `@Manishearth`
2022-03-24 22:52:34 +00:00
Santiago Pastorino
d96faef913
Where bounds are checked on inherent impls 2022-03-24 17:47:10 -03:00
bors
63b8f01bb5 Auto merge of #94934 - Lireer:const-prop-lint, r=oli-obk
Separate const prop lints from optimizations

r? `@oli-obk`

Separates lints and optimizations during const prop by moving the lints into their own file and checking them during post borrowck cleanup.
Thanks to `@oli-obk` for mentoring me.
2022-03-24 20:22:27 +00:00
Ralf Jung
189409bea9 update Miri 2022-03-24 15:05:35 -04:00
lightning1141
85e67b9a59
Fix ice when error reporting recursion errors
Fixes: #90319, #92148, #93955
2022-03-25 02:53:30 +08:00
Jendrik
dcdde01aa3 add #[must_use] to functions of slice and its iterators. 2022-03-24 15:21:03 +01:00
flip1995
3365e9a120
Merge commit 'd0cf3481a84e3aa68c2f185c460e282af36ebc42' into clippyup 2022-03-24 14:50:04 +01:00
bors
8d8135f003 Auto merge of #94876 - b-naber:thir-abstract-const-changes, r=lcnr
Change Thir to lazily create constants

To allow `AbstractConst`s to work with the previous thir changes we made and those we want to make, i.e. to avoid problems due to `ValTree` and `ConstValue` conversions, we instead switch to a thir representation for constants that allows us to lazily create constants.

r? `@oli-obk`
2022-03-24 12:50:00 +00:00
Oli Scherer
440946af11 update clippy stderr file 2022-03-24 11:27:07 +00:00
bors
d2df372bca Auto merge of #91030 - estebank:trait-bounds-are-tricky-2, r=oli-obk
Properly track `ImplObligations`

Instead of probing for all possible `impl`s that could have caused an
`ImplObligation`, keep track of its `DefId` and obligation spans for
accurate error reporting.

Follow to #89580. Addresses #89418.
2022-03-24 10:24:54 +00:00
Michael Woerister
e169261a6f debuginfo: Fix debuginfo for Box<T> where T is unsized.
Before this fix, the debuginfo for the fields was generated from the
struct defintion of Box<T>, but (at least at the moment) the compiler
pretends that Box<T> is just a (fat) pointer, so the fields need to be
`pointer` and `vtable` instead of `__0: Unique<T>` and `__1: Allocator`.

This is meant as a temporary mitigation until we can make sure that
simply treating Box as a regular struct in debuginfo does not cause too
much breakage in the ecosystem.
2022-03-24 11:12:41 +01:00
Michael Goulet
e0c8780a5b Better suggestions for Fn trait selection errors 2022-03-23 21:46:11 -07:00
Esteban Kuber
5fd37862d9 Properly track ImplObligations
Instead of probing for all possible impls that could have caused an
`ImplObligation`, keep track of its `DefId` and obligation spans for
accurate error reporting.

Follow up to #89580. Addresses #89418.

Remove some unnecessary clones.

Tweak output for auto trait impl obligations.
2022-03-24 02:08:49 +00:00
bors
37b55c8a0c Auto merge of #95250 - matthiaskrgr:rollup-ma4zl69, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #94249 (Better errors when a Copy impl on a Struct is not self-consistent)
 - #95069 (Fix auto traits in rustdoc)
 - #95221 (interpret/memory: simplify check_and_deref_ptr)
 - #95225 (remove `[async output]` from `impl Future` pretty-printing)
 - #95238 (Stop emitting E0026 for struct enums with underscores)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-23 23:02:17 +00:00
Matthias Krüger
fab7a6a9fd
Rollup merge of #95238 - TaKO8Ki:stop-emitting-E0026-for-struct-enum-with-underscore, r=estebank
Stop emitting E0026 for struct enums with underscores

This patch resolves a part of #83263;

r? `@estebank`
2022-03-23 22:13:26 +01:00
Matthias Krüger
1f346bd6a5
Rollup merge of #95225 - compiler-errors:impl-future-generator-ty, r=oli-obk
remove `[async output]` from `impl Future` pretty-printing

self-explanatory, guess it's not as helpful as I thought when I added it 4 months ago
re https://github.com/rust-lang/rust/issues/95089#issuecomment-1075482851
2022-03-23 22:13:25 +01:00
Matthias Krüger
23ef234bf7
Rollup merge of #95221 - RalfJung:check_and_deref_ptr, r=oli-obk
interpret/memory: simplify check_and_deref_ptr

*Finally* I saw a way to make this code simpler. The odd preprocessing in `let ptr_or_addr =` has bothered me since forever, but it actually became unnecessary in the last provenance refactoring. :)

This also leads to slightly more explicit error messages as a nice side-effect. 🎉

r? `@oli-obk`
2022-03-23 22:13:24 +01:00
Matthias Krüger
0c79c862f0
Rollup merge of #95069 - GuillaumeGomez:auto-traits-rustdoc, r=oli-obk
Fix auto traits in rustdoc

Fixes #90324.

cc `@matthewjasper`
r? `@Aaron1011`
2022-03-23 22:13:23 +01:00
Matthias Krüger
af19a50a26
Rollup merge of #94249 - compiler-errors:better-copy-errors, r=davidtwco
Better errors when a Copy impl on a Struct is not self-consistent

As discovered in a Zulip thread with `@nnethercote` and `@Mark-Simulacrum,` it's not immediately obvious why a field on an ADT doesn't implement `Copy`.  This PR attempts to give slightly more detailed information by spinning up a fulfillment context to try to dig down and discover transitive fulfillment errors that cause `is_copy_modulo_regions` to fail on a ADT field.

The error message still kinda sucks, but should only show up in the case that an existing error message was totally missing... so I think it's a good compromise for now?
2022-03-23 22:13:22 +01:00
bors
9f4dc0b4db Auto merge of #95247 - cuviper:llvm14, r=nikic
Update to LLVM 14.0.0 final

This is a simple rebase of the submodule onto the `llvmorg-14.0.0` release tag.

r? `@nikic`
2022-03-23 20:18:53 +00:00
Josh Stone
cbe2216709 Update to LLVM 14.0.0 final 2022-03-23 11:42:13 -07:00
bors
547369d3d8 Auto merge of #95220 - rust-lang:notriddle/ast-validation-semicolon, r=Dylan-DPC
diagnostics: do not suggest `fn foo({ <body> }`

Instead of suggesting that the body always replace the last character on the line, presuming it must be a semicolon, the parser should instead check what the last character is, and append the body if it is anything else.

Fixes #83104
2022-03-23 16:53:47 +00:00
Oli Scherer
c7efad044c Update allocation id 2022-03-23 16:50:42 +00:00
Carl Scherer
695c2e3e53 Remove line instead of just commenting out
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2022-03-23 16:50:42 +00:00
Carl Scherer
5e4ff26618 separate const prop lint from optimizations 2022-03-23 16:50:41 +00:00
bors
9280445570 Auto merge of #94901 - fee1-dead:destructable, r=oli-obk
Rename `~const Drop` to `~const Destruct`

r? `@oli-obk`

Completely switching to `~const Destructible` would be rather complicated, so it seems best to add it for now and wait for it to be backported to beta in the next release.

The rationale is to prevent complications such as #92149 and #94803 by introducing an entirely new trait. And `~const Destructible` reads a bit better than `~const Drop`. Name Bikesheddable.
2022-03-23 14:04:38 +00:00
Takayuki Maeda
925857d8dc stop emitting E0026 for struct enums with underscores 2022-03-23 22:54:02 +09:00
b-naber
1b5fbe2076 add test for treating ExprKind::ConstParam as temp 2022-03-23 11:34:34 +01:00
Laurențiu Nicola
29ebe5c38c ⬆️ rust-analyzer 2022-03-23 08:24:14 +02:00
Michael Goulet
bdb4b1e923 remove [async output] from impl Future 2022-03-22 19:41:34 -07:00
Ralf Jung
a76e5b1882 bless 32bit 2022-03-22 22:19:50 -04:00
Dylan DPC
e1f2d354a7
Rollup merge of #95219 - ojeda:update-alloc-no-oom-handling-test, r=Dylan-DPC
Modernize `alloc-no-oom-handling` test

  - The edition should be 2021 to avoid warnings.

  - The `external_crate` feature was removed in commit 45bf1ed1a1 ("rustc: Allow changing the default allocator").

    Note that commit d620ae1070 ("Auto merge of #84266") removed the old test, but the new one introduced passed the `--cfg` like in the old one.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

---

This is intended to align this test to the new `no_rc` and `no_sync` ones being added in https://github.com/rust-lang/rust/pull/89891, but it makes sense on its own too.
2022-03-23 03:05:33 +01:00
Dylan DPC
67d6cc6ef3
Rollup merge of #91608 - workingjubilee:fold-neon-fp, r=nagisa,Amanieu
Fold aarch64 feature +fp into +neon

Arm's FEAT_FP and Feat_AdvSIMD describe the same thing on AArch64:
The Neon unit, which handles both floating point and SIMD instructions.
Moreover, a configuration for AArch64 must include both or neither.
Arm says "entirely proprietary" toolchains may omit floating point:
https://developer.arm.com/documentation/102374/0101/Data-processing---floating-point
In the Programmer's Guide for Armv8-A, Arm says AArch64 can have
both FP and Neon or neither in custom implementations:
https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON

In "Bare metal boot code for Armv8-A", enabling Neon and FP
is just disabling the same trap flag:
https://developer.arm.com/documentation/dai0527/a

In an unlikely future where "Neon and FP" become unrelated,
we can add "[+-]fp" as its own feature flag.
Until then, we can simplify programming with Rust on AArch64 by
folding both into "[+-]neon", which is valid as it supersets both.

"[+-]neon" is retained for niche uses such as firmware, kernels,
"I just hate floats", and so on.

I am... pretty sure no one is relying on this.

An argument could be made that, as we are not an "entirely proprietary" toolchain, we should not support AArch64 without floats at all. I think that's a bit excessive. However, I want to recognize the intent: programming for AArch64 should be simplified where possible. For x86-64, programmers regularly set up illegal feature configurations because it's hard to understand them, see https://github.com/rust-lang/rust/issues/89586. And per the above notes, plus the discussion in https://github.com/rust-lang/rust/issues/86941, there should be no real use cases for leaving these features split: the two should in fact always go together.

- Fixes rust-lang/rust#95002.
- Fixes rust-lang/rust#95064.
- Fixes rust-lang/rust#95122.
2022-03-23 03:05:28 +01:00
Jubilee Young
6c19dc9a86 Fixup aarch64 smoke test 2022-03-22 18:33:07 -07:00
Michael Goulet
c8cbd3d03c better errors when a Copy impl is not coherent 2022-03-22 18:15:29 -07:00
Ralf Jung
f93a146433 interpret/memory: simplify check_and_deref_ptr 2022-03-22 20:19:30 -04:00
Jubilee Young
8fa4ae8b2d Test SVE2 includes NEON and not vice versa
Required by https://github.com/rust-lang/rust/issues/95122
2022-03-22 15:31:30 -07:00
Michael Howell
3729b17b7e diagnostics: do not suggest fn foo({ <body> }
Instead of suggesting that the body always replace the last character on the
line, presuming it must be a semicolon, the parser should instead check what
the last character is, and append the body if it is anything else.

Fixes #83104
2022-03-22 15:29:07 -07:00
Jubilee Young
7d6415c291 Test NEON compiles
Required by https://github.com/rust-lang/rust/issues/95002
2022-03-22 15:20:07 -07:00
Jubilee Young
990c297ffb Filter for all features instead of any
Adds regression tests for feature logic
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
Co-authored-by: Simonas Kazlauskas <git@kazlauskas.me>
2022-03-22 15:20:01 -07:00
Jubilee Young
b807d5970b Fold aarch64 feature +fp into +neon
Arm's FEAT_FP and Feat_AdvSIMD describe the same thing on AArch64:
The Neon unit, which handles both floating point and SIMD instructions.
Moreover, a configuration for AArch64 must include both or neither.
Arm says "entirely proprietary" toolchains may omit floating point:
https://developer.arm.com/documentation/102374/0101/Data-processing---floating-point
In the Programmer's Guide for Armv8-A, Arm says AArch64 can have
both FP and Neon or neither in custom implementations:
https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON

In "Bare metal boot code for Armv8-A", enabling Neon and FP
is just disabling the same trap flag:
https://developer.arm.com/documentation/dai0527/a

In an unlikely future where "Neon and FP" become unrelated,
we can add "[+-]fp" as its own feature flag.
Until then, we can simplify programming with Rust on AArch64 by
folding both into "[+-]neon", which is valid as it supersets both.

"[+-]neon" is retained for niche uses such as firmware, kernels,
"I just hate floats", and so on.
2022-03-22 15:14:33 -07:00
Miguel Ojeda
0d12a30673 Modernize alloc-no-oom-handling test
- The edition should be 2021 to avoid warnings.

  - The `external_crate` feature was removed in commit 45bf1ed1a1
    ("rustc: Allow changing the default allocator").

    Note that commit d620ae1070 ("Auto merge of #84266") removed
    the old test, but the new one introduced passed the `--cfg` like
    in the old one.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-03-22 22:00:19 +01:00
Dylan DPC
5d3dfb446f
Rollup merge of #95200 - TaKO8Ki:cancel-not-emitted-error-when-parsing-generic-arg, r=oli-obk
Cancel a not emitted error after parsing const generic args

closes #95163
2022-03-22 19:07:36 +01:00
Dylan DPC
0e80a7ab59
Rollup merge of #95197 - frank-king:feat/unary_op_type_constrain, r=petrochenkov
Suggest constraining param for unary ops when missing trait impl

This PR adds a suggestion of constraining param for unary ops `-` and `!` when the corresponding trait implementation
is missing.

Fixs #94543.

BTW, this is my first time to touch rustc, please correct me if I did anything wrong.
2022-03-22 19:07:35 +01:00
b-naber
8ff1edbe5e fix previous failures and address review 2022-03-22 11:35:59 +01:00
Takayuki Maeda
62ded071d5 cancel a not emitted error after parsing const generic args 2022-03-22 16:06:56 +09:00
Frank King
f28d8b13df suggest constraining param for unary ops when missing trait impl 2022-03-22 12:17:30 +08:00
bors
2d15732f6e Auto merge of #95127 - notriddle:notriddle/option-content-move-from-tuple-match, r=estebank
diagnostics: do not give Option::as_ref suggestion for complex match

Fixes #82528
2022-03-22 03:08:01 +00:00
Yacin Tmimi
8984438a6f Honor #[rustfmt::skip::attributes(derive)] attribute
Fixes 5270

Previously, rustfmt only checked the `merge_derives` configuration value
to determine if it should merge_derives. This lead to derives being
merged even when annotated with the `rustfmt::skip` attribute.

Now, rustfmt also checks if derives are explicitly being skipped in the
current context via the `rustfmt::skip` attribute.
2022-03-21 16:56:34 -05:00
123vivekr
0dba01aee1 Add short_item_threshold config option
Allow custom short item threshold values via config
2022-03-21 16:56:09 -05:00
Matthias Krüger
44200a91ba
Rollup merge of #95175 - lcnr:adt_const_params-tracking-issue, r=Dylan-DPC
move `adt_const_params`  to its own tracking issue

the new tracking issue is  #95174

r? ``@rust-lang/project-const-generics``
2022-03-21 19:48:35 +01:00
Matthias Krüger
aa9077e0c9
Rollup merge of #95166 - Urgau:check-cfg-values-unstable-book, r=petrochenkov
Update the unstable book with the new `values()` form of check-cfg

Forgot to update the unstable book in https://github.com/rust-lang/rust/pull/94362

r? ``@petrochenkov``
2022-03-21 19:48:34 +01:00
Matthias Krüger
7154fa5193
Rollup merge of #95129 - GuillaumeGomez:rm-source-sidebar-animation, r=jsha
Remove animation on source sidebar

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

Didn't upload a demo considering how simple it is to test in a browser. :)

r? ``@jsha``
2022-03-21 19:48:33 +01:00
Matthias Krüger
08995e11f5
Rollup merge of #95116 - bjorn3:cg_clif_test_fixes, r=Dylan-DPC
Add needs-* directives to many tests

These are necessary to ignore tests that need features unsupported by cg_clif.
2022-03-21 19:48:32 +01:00
Matthias Krüger
e41e510c7f
Rollup merge of #95085 - ouz-a:master5, r=jackh726
Return err instead of ICE

Having `escaping_bound_vars` results in ICE when trying to create `ty::Binder::dummy`, to avoid it we return err like the line above. I think this requires a more sophisticated fix, I would love to investigate if mentorship is available 🤓

Fixes #95023 and #85350
2022-03-21 19:48:31 +01:00
Camille GILLOT
c544f108fd Deduplicate ui-fulldeps. 2022-03-21 19:43:53 +01:00
bjorn3
c542cd7740 Add needs-asm-support directive to tests where necessary 2022-03-21 18:48:24 +01:00
b-naber
6cf3409e16 add/update tests 2022-03-21 18:47:38 +01:00
ouz-a
be566f1185 Return err instead of ICE 2022-03-21 19:56:23 +03:00
lcnr
e8890aad62 move adt_const_params to its own tracking issue 2022-03-21 16:33:42 +01:00
bors
44628f7273 Auto merge of #95169 - Smittyvb:union-test-ub, r=bjorn3
Don't run UB in test suite

This splits `ui/unsafe/union.rs` to make it so only the non-UB parts are run. It also means we can do more testing of the location of error messages (which are a bit different with the THIR unsafety checker). `union-modification.rs` has no UB (according to Miri), and `union.rs` has errors (but would have UB if not for those errors).

Closes #95075.
r? `@bjorn3`
2022-03-21 15:17:08 +00:00
Smitty
9477febc49 Don't run UB in test suite
This splits ui/unsafe/union.rs to make it so only the non-UB parts are
run. It also means we can do more testing of the location of error
messages.
2022-03-21 09:32:26 -04:00
Loïc BRANSTETT
c6c14a040d Update unstable book with the new values() form for check-cfg 2022-03-21 12:59:46 +01:00
Maximilian Köhl
1c523ba772 add tests for 🔒 2022-03-21 11:40:25 +01:00
Maximilian Köhl
4df867c4a3 fix: add a space only in front of 🔒 2022-03-21 11:25:05 +01:00
Maximilian Köhl
03ddfa3087 move the 🔒 after the name 2022-03-21 11:03:02 +01:00
Deadbeef
fe5b81348f
Tidy up 2022-03-21 17:07:09 +11:00
Deadbeef
1f3ee7f32e
Rename ~const Drop to ~const Destruct 2022-03-21 17:04:03 +11:00
Yacin Tmimi
e41329ce87 Search for struct body span after any generic arguments
Fixes 5273

Previously, rustfmt searched for the start of a struct body after the
opening `{`. In most cases this works just fine, but const values can
also be defined between `{ }`, which lead to issues when rewriting the
struct body.

Now, rustfmt will search for the `{` after the generic argument list to
guarantee that the `{` it finds is the start of the struct body.
2022-03-20 21:39:12 -05:00
bors
051d1176b7 Auto merge of #95104 - compiler-errors:remove-ascription, r=davidtwco
suggest removing type ascription in bad parsing position

Not sure how to test this with the non-nightly suggestion. Didn't add a new UI test because it already manifests in an existing UI test.

Fixes #95014
2022-03-21 02:29:55 +00:00
bors
51558ccb8e Auto merge of #95148 - matthiaskrgr:rollup-jsb1ld9, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #95114 (Skip a test if symlink creation is not possible)
 - #95131 (Fix docs for default rmeta filename.)
 - #95135 (Fix a not emitted unmatched angle bracket error)
 - #95145 (Fix typo interator->iterator)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-20 21:36:57 +00:00
Matthias Krüger
63da51db93
Rollup merge of #95135 - TaKO8Ki:fix-not-emitted-unmatched-angle-bracket-error, r=Dylan-DPC
Fix a not emitted unmatched angle bracket error

closes #95128
2022-03-20 20:42:45 +01:00
Matthias Krüger
7557c08048
Rollup merge of #95131 - ehuss:fix-metadata-filename, r=bjorn3
Fix docs for default rmeta filename.

The docs for the default filename for `--emit=metadata` was wrong, it was missing the `lib` prefix.  The current implementation for that default is [here](f2661cfe34/compiler/rustc_session/src/output.rs (L140)).  Perhaps somewhat confusing, but `lib` is used for all crate types.

cc https://github.com/rust-lang/rust/issues/68839#issuecomment-1073118716
2022-03-20 20:42:44 +01:00
Camille GILLOT
0b49d05ea3 Filter OnceNote in diagnostic infra. 2022-03-20 20:36:26 +01:00
Camille GILLOT
4f89c51a5b Take &mut Diagnostic in emit_diagnostic.
Taking a Diagnostic by move would break the usual pattern
`diag.label(..).emit()`.
2022-03-20 20:36:08 +01:00
Camille GILLOT
056951d628 Take &mut Diagnostic in emit_diagnostic.
Taking a Diagnostic by move would break the usual pattern
`diag.label(..).emit()`.
2022-03-20 20:36:08 +01:00
bors
c84f39e6c0 Auto merge of #95144 - RalfJung:miri, r=RalfJung
update Miri
2022-03-20 19:10:06 +00:00
Ralf Jung
8ebc407bde update Miri 2022-03-20 14:30:40 -04:00
bjorn3
ce7f5ecad7 Add once_cell as allowed cg_clif dependency 2022-03-20 17:01:32 +01:00
Takayuki Maeda
5c8aaedef6 fix a not emitted unmatched angle bracket error 2022-03-20 22:39:15 +09:00
Matthias Krüger
db374bd440
Rollup merge of #94948 - jhpratt:rustc_deprecated, r=Dylan-DPC
Fix diagnostics for `#![feature(deprecated_suggestion)]`

Follow up from #94635, where I missed a couple things.
2022-03-20 09:14:59 +01:00
bors
499d4a5684 Auto merge of #95063 - tromey:fix-94458-gdb-char, r=Mark-Simulacrum
Fix debuginfo tests with GDB 11.2

GDB 11.2 added support for DW_ATE_UTF, which caused some test
failures.  This fixes these tests by changing the format that is used,
and adds a new test to verify that characters are emitted as something
that GDB can print in a char-like way.

Fixes #94458
2022-03-20 04:31:23 +00:00
Eric Huss
9da3c355c8 Fix docs for default rmeta filename. 2022-03-19 21:05:31 -07:00
bors
183090f775 Auto merge of #94976 - jclulow:solaris-festival, r=Mark-Simulacrum
solaris build environment should include libsendfile/liblgrp

As of version 0.2.120 of the libc crate, the solaris target now requires
some additional libraries to be present in the sysroot.  Note that the
solaris target doesn't really build against files from Solaris, but
rather against some files from DilOS (a platform similar to both Solaris
and illumos).  Pull in the extra libraries and their compilation links
from that apt repository.

This aims to assist with rust-lang/rust#94052.
2022-03-20 01:50:36 +00:00
Maximilian Köhl
1fec0fbb2c apply rustfmt 2022-03-19 23:54:42 +01:00
Michael Howell
306dcd6efa diagnostics: do not give Option::as_ref suggestion for complex match
Fixes #82528
2022-03-19 15:54:30 -07:00
Maximilian Köhl
43e4bbdaaa rustdoc: add 🔒 to indicate restricted visibility 2022-03-19 23:51:33 +01:00
bors
8d60bf427a Auto merge of #95103 - ehuss:update-cargo, r=ehuss
Update cargo

9 commits in 65c82664263feddc5fe2d424be0993c28d46377a..109bfbd055325ef87a6e7f63d67da7e838f8300b
2022-03-09 02:32:56 +0000 to 2022-03-17 21:43:09 +0000
- Refactor RegistryData::load to handle management of the index cache (rust-lang/cargo#10482)
- Separate VCS command paths with "--" (rust-lang/cargo#10483)
- Fix panic when artifact target is used for `[target.'cfg(&lt;target&gt;)'.dependencies` (rust-lang/cargo#10433)
- Bump git2@0.14.2 and libgit2-sys@0.13.2 (rust-lang/cargo#10479)
- vendor: Don't allow multiple values for --sync (rust-lang/cargo#10448)
- Use types to make clere (credential process || token) (rust-lang/cargo#10471)
- Warning on conflicting keys (rust-lang/cargo#10316)
- Registry functions return Poll to enable parallel fetching of index data (rust-lang/cargo#10064)
- Refine the contributor guide (rust-lang/cargo#10468)
2022-03-19 19:41:10 +00:00
Guillaume Gomez
237d62588d Remove animation on source sidebar 2022-03-19 16:59:56 +01:00
bjorn3
748498e79b Add needs-unwind directive to tests where necessary 2022-03-19 16:35:41 +01:00
Dylan DPC
22b4c40e38
Rollup merge of #95109 - Urgau:check-cfg-all-any, r=petrochenkov
Extend --check-cfg tests to all predicate inside all/any

Now that https://github.com/rust-lang/rust/pull/94295 is merged it's time to add more tests to check that all predicate inside `all` and `any` are always checked.

r? `@petrochenkov`
2022-03-19 14:50:27 +01:00
Dylan DPC
7de48eafa1
Rollup merge of #95072 - tromey:parallel-debug-tests, r=tmiasko
Re-enable parallel debuginfo tests

Debuginfo tests are serialized due to some older version of LLDB.
However, that comment was last touched in 2014, so presumably these
older versions are long since obsolete.

Partially fixes bug #72719.
2022-03-19 14:50:26 +01:00
Loïc BRANSTETT
a12674a052 Extend --check-cfg tests to all predicate inside all/any 2022-03-19 10:23:09 +01:00
Michael Goulet
3516a16eeb suggest removing type ascription in bad position 2022-03-18 21:22:26 -07:00
Eric Huss
5b4f92066a Update cargo 2022-03-18 20:06:56 -07:00
Matthias Krüger
0f002eb4c6
Rollup merge of #94848 - GuillaumeGomez:browser-ui-test-version, r=Mark-Simulacrum
Compare installed browser-ui-test version to the one used in CI

I happened a few times to run into (local) rustdoc GUI tests errors because I forgot to update my browser-ui-test version. I know at least two others who encountered the same problem so I think emitting a warning to let us know about this version mismatch would make it easier to figure out.

So now, I'm not too sure that this PR is the right approach because it requires to parse a Dockerfile, which feels pretty bad. I had the idea to instead store the browser-ui-test version into a docker ARG like:

```docker
ARG BROWSER_UI_TEST_VERSION=0.8.0
```

And then use it as such in the command to make the parsing more reliable.

Or we could store this version into a file and import this file into the Dockerfile and read it from the builder.

Any preference or maybe another solution?

r? ``@Mark-Simulacrum``
2022-03-18 21:50:47 +01:00
Matthias Krüger
d15006ceca
Rollup merge of #94295 - Urgau:cfg-always-eval-all-predicate, r=petrochenkov
Always evaluate all cfg predicate in all() and any()

This pull-request adjust the handling of the `all()` and `any()` to always evaluate every cfg predicate because not doing so result in accepting incorrect `cfg`:

```rust
#[cfg(any(unix, foo::bar))] // Should error on foo::bar, but does not on unix platform (but does on non unix platform)
fn foo1() {}

#[cfg(all(foo, foo::bar))] // Should error on foo::bar, but does not
fn foo2() {}

#[cfg(all(foo::bar, foo))] // Correctly error on foo::bar
fn foo3() {}

#[cfg(any(foo::bar, foo))] // Correctly error on foo::bar
fn foo4() {}
```
This pull-request take the side to directly turn it into a hard error instead of having a future incompatibility lint because the combination to get this incorrect behavior is unusual and highly probable that some code have this without noticing.

A [search](https://cs.github.com/?scopeName=All+repos&scope=&q=lang%3Arust+%2Fany%5C%28%5Ba-zA-Z%5D%2C+%5Ba-zA-Z%5D%2B%3A%3A%5Ba-zA-Z%5D%2B%2F) on Github reveal no such instance nevertheless a Crater run should probably be done before merging this.

This was discover in https://github.com/rust-lang/rust/pull/94175 when trying to lint on the second predicate. Also note that this seems to have being introduce with Rust 1.27.0: https://rust.godbolt.org/z/KnfqKv15f.

r? `@petrochenkov`
2022-03-18 21:50:46 +01:00
Santiago Pastorino
89fdb62331
Fix inherent impls on negative coherence 2022-03-18 14:11:04 -03:00
Tom Tromey
05e9fcb704 Re-enable parallel debuginfo tests
Debuginfo tests are serialized due to some older version of LLDB.
However, that comment was last touched in 2014, so presumably these
older versions are long since obsolete.

Partially fixes bug #72719.
2022-03-18 07:16:57 -06:00
Guillaume Gomez
7c53ae09a8 Add test to ensure auto-traits are respecting constraints 2022-03-18 11:27:18 +01:00
Guillaume Gomez
c8158e9f40 Run rustdoc GUI tests when browser-ui-test version is updated 2022-03-18 10:50:53 +01:00
Guillaume Gomez
1ddbae372f Compare installed browser-ui-test version to the one used in CI 2022-03-18 10:49:50 +01:00
bors
691d1c1e12 Auto merge of #95065 - matthiaskrgr:rollup-75i6oz5, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #95013 (Update browser-ui-test version to 0.8.2)
 - #95039 (Make negative coherence work when there's impl negative on super predicates)
 - #95047 (Refactor: remove an unnecessary pattern for ignoring all parts)
 - #95048 (update Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-18 05:26:14 +00:00
Matthias Krüger
d3dc65be66
Rollup merge of #95048 - RalfJung:miri, r=RalfJung
update Miri

Let's get those SIMD intrinsics out there. :)
r? `@ghost`
2022-03-18 05:21:57 +01:00
Matthias Krüger
588d389dc5
Rollup merge of #95039 - spastorino:overlap-super-predicates, r=nikomatsakis
Make negative coherence work when there's impl negative on super predicates

r? `@nikomatsakis`
2022-03-18 05:21:55 +01:00
Matthias Krüger
0e1b897d91
Rollup merge of #95013 - GuillaumeGomez:browser-ui-test-v, r=notriddle
Update browser-ui-test version to 0.8.2

It brings mostly debugging improvements: it doesn't stop at the first failing command but rather at the first "fatal error".

r? `@notriddle`
2022-03-18 05:21:54 +01:00
bors
d6f3a4ecb4 Auto merge of #88098 - Amanieu:oom_panic, r=nagisa
Implement -Z oom=panic

This PR removes the `#[rustc_allocator_nounwind]` attribute on `alloc_error_handler` which allows it to unwind with a panic instead of always aborting. This is then used to implement `-Z oom=panic` as per RFC 2116 (tracking issue #43596).

Perf and binary size tests show negligible impact.
2022-03-18 03:01:46 +00:00
Tom Tromey
789eb08147 Fix debuginfo tests with GDB 11.2
GDB 11.2 added support for DW_ATE_UTF, which caused some test
failures.  This fixes these tests by changing the format that is used,
and adds a new test to verify that characters are emitted as something
that GDB can print in a char-like way.

Fixes #94458
2022-03-17 20:19:10 -06:00
bors
cd11905716 Auto merge of #95056 - Dylan-DPC:rollup-swtuw2n, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #91133 (Improve `unsafe` diagnostic)
 - #93222 (Make ErrorReported impossible to construct outside `rustc_errors`)
 - #93745 (Stabilize ADX target feature)
 - #94309 ([generator_interior] Be more precise with scopes of borrowed places)
 - #94698 (Remove redundant code from copy-suggestions)
 - #94731 (Suggest adding `{ .. }` around a const function call with arguments)
 - #94960 (Fix many spelling mistakes)
 - #94982 (Add deprecated_safe feature gate and attribute, cc #94978)
 - #94997 (debuginfo: Fix ICE when generating name for type that produces a layout error.)
 - #95000 (Fixed wrong type name in comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-18 00:35:19 +00:00
Dylan DPC
e55400ca27
Rollup merge of #94997 - michaelwoerister:fix-enum-type-name-layout-error, r=wesleywiser
debuginfo: Fix ICE when generating name for type that produces a layout error.

Fixes https://github.com/rust-lang/rust/issues/94961.
2022-03-17 22:55:07 +01:00
Dylan DPC
0c73b252eb
Rollup merge of #94982 - skippy10110:deprecated_safe, r=Dylan-DPC
Add deprecated_safe feature gate and attribute, cc #94978
2022-03-17 22:55:06 +01:00
Dylan DPC
cce0d50bcb Rollup merge of #94960 - codehorseman:master, r=oli-obk
Fix many spelling mistakes

Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-17 22:55:05 +01:00
Dylan DPC
270a41c33e
Rollup merge of #94960 - codehorseman:master, r=oli-obk
Fix many spelling mistakes

Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-17 22:55:05 +01:00
Dylan DPC
5eb3433ed5
Rollup merge of #94731 - TaKO8Ki:const-generic-expr-recovery, r=davidtwco,oli-obk
Suggest adding `{ .. }` around a const function call with arguments

closes #91020
2022-03-17 22:55:04 +01:00
Dylan DPC
8499a8ba88
Rollup merge of #94309 - eholk:issue-57017, r=tmandry
[generator_interior] Be more precise with scopes of borrowed places

Previously the generator interior type checking analysis would use the nearest temporary scope as the scope of a borrowed value. This ends up being overly broad for cases such as:

```rust
fn status(_client_status: &Client) -> i16 {
    200
}

fn main() {
    let client = Client;
    let g = move || match status(&client) {
        _status => yield,
    };
    assert_send(g);
}
```

In this case, the borrow `&client` could be considered in scope for the entirety of the `match` expression, meaning it would be viewed as live across the `yield`, therefore making the generator not `Send`.

In most cases, we want to use the enclosing expression as the scope for a borrowed value which will be less than or equal to the nearest temporary scope. This PR changes the analysis to use the enclosing expression as the scope for most borrows, with the exception of borrowed RValues which are true temporary values that should have the temporary scope. There's one further exception where borrows of a copy such as happens in autoref cases also should be ignored despite being RValues.

Joint work with `@nikomatsakis`

Fixes #57017

r? `@tmandry`
2022-03-17 22:55:02 +01:00
Dylan DPC
7e1415ea80
Rollup merge of #93222 - mark-i-m:errorreported, r=oli-obk
Make ErrorReported impossible to construct outside `rustc_errors`

There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.

cc #69426 `@varkor` `@eddyb` `@estebank`

I actually didn't see that I was assigned to this issue until now...
2022-03-17 22:55:00 +01:00
Dylan DPC
c8133f6f5e
Rollup merge of #91133 - terrarier2111:unsafe-diagnostic, r=jackh726
Improve `unsafe` diagnostic

This fixes: https://github.com/rust-lang/rust/issues/90880
I didn't use the exact proposed messages though.
2022-03-17 22:54:59 +01:00
bors
4ca56d2b7b Auto merge of #95020 - compiler-errors:late-debuginfo, r=jackh726
erase late-bound regions in dyn projection types for debuginfo

simply skipping the binder leaves late-bound regions that will cause debug assertions to fail when checking the layout of the projection ty, so let's erase the regions instead.

sorry for taking so long to put this up, had trouble getting rustc set up on a new computer.

fixes #94998
2022-03-17 21:54:25 +00:00
Eric Huss
8322cdb1da Fix cmake build. 2022-03-17 11:43:38 -07:00
Ralf Jung
9e18721119 update Miri 2022-03-17 14:27:42 -04:00
Santiago Pastorino
91846fe12a
This test now works 2022-03-17 14:38:27 -03:00
Santiago Pastorino
64dfd3b234
Make negative coherence work when there's impl negative on super predicates 2022-03-17 12:15:11 -03:00
Caleb Cartwright
c801367ecf Merge remote-tracking branch 'upstream/master' into subtree-sync-2022-03-16 2022-03-16 21:55:15 -05:00
Guillaume Gomez
45a3075c56 Run GUI test when browser-ui-test version is updated 2022-03-16 22:22:16 +01:00
Guillaume Gomez
972ee87432 Update browser-ui-test version to 0.8.3 2022-03-16 22:21:28 +01:00
Michael Goulet
b69b3d041a erase late-bound regions in dyn projection types for debuginfo 2022-03-16 11:56:29 -07:00
Santiago Pastorino
c3797dcce6
Add double negative trait test case 2022-03-16 14:59:03 -03:00
mark
c1d351f6ee rustc_error: make ErrorReported impossible to construct
There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.
2022-03-16 10:35:24 -05:00
mark
bb8d4307eb rustc_error: make ErrorReported impossible to construct
There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.
2022-03-16 10:35:24 -05:00
Michael Woerister
243e2a698c debuginfo: Fix ICE when generating name for type that produces a layout error. 2022-03-16 15:57:33 +01:00
codehorseman
c0861d3a9d resolve the conflict in compiler/rustc_session/src/parse.rs
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-16 20:12:30 +08:00
codehorseman
01dbfb3eb2 resolve the conflict in compiler/rustc_session/src/parse.rs
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-16 20:12:30 +08:00
bors
d8e564715e Auto merge of #94990 - ehuss:update-books, r=ehuss
Update books

## reference

8 commits in 9d289c05fce7254b99c6a0d354d84abb7fd7a032..0a2fe6651fbccc6416c5110fdf5b93fb3cb29247
2022-02-23 08:58:20 -0800 to 2022-03-15 09:32:25 -0700
- Documentation PR for cfg_panic (rust-lang/reference#1157)
- Document aarch64 `target_feature` options (rust-lang/reference#1102)
- Try to clarify destructor not being run scenario. (rust-lang/reference#1107)
- Add undocumented Punctuation token Tilde `~` (rust-lang/reference#1149)
- update UB list for safe target_feature (rust-lang/reference#1050)
- Update const_eval.md for feature stabilization (rust-lang/reference#1166)
- Remove `.intel_syntax`/`.att_syntax` support entirely.
- Fix `.intel_syntax` directive

## book

3 commits in 3f255ed40b8c82a0434088568fbed270dc31bf00..036e88a4f135365de85358febe5324976a56030a
2022-02-27 21:26:12 -0500 to 2022-03-04 21:53:33 -0500
- Fix some links and small wordings
- Snapshot of chapter 19 for nostarch
- Clarify fully-qualified syntax explanation

## rust-by-example

2 commits in 2a928483a20bb306a7399c0468234db90d89afb5..d504324f1e7dc7edb918ac39baae69f1f1513b8e
2022-02-28 11:36:59 -0300 to 2022-03-07 09:26:32 -0300
- Fixed extra indentation at line 43 in Phantom Testcase example. (rust-lang/rust-by-example#1515)
- Typo fixed in description of inline ASM cpuid function (rust-lang/rust-by-example#1514)

## rustc-dev-guide

3 commits in 32f2a5b4e7545318846185198542230170dd8a42..0e4b961a9c708647bca231430ce1b199993e0196
2022-03-01 10:45:24 -0600 to 2022-03-14 08:40:37 -0700
- update winget install instructions to ensure proper packages are installed (-e for --exact, and full package names to ensure arbitrary packages from
the msstore source aren't installed)
- Add missing rustdoc tests explanations
- Fix incorrectly escaped backtick
2022-03-16 06:19:54 +00:00
bors
a2af9cf1cf Auto merge of #94987 - Dylan-DPC:rollup-5tssuhi, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #94868 (Format core and std macro rules, removing needless surrounding blocks)
 - #94951 (Extend the irrefutable_let_patterns lint to let chains)
 - #94955 (Refactor: Use `format_args_capture` in some parts of `rustc_parse`)
 - #94957 (Improve the explanation about the behaviour of read_line)
 - #94974 (Ensure that `let_else` does not interact with `let_chains`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-16 04:05:35 +00:00
Eric Huss
154da67472 Update books 2022-03-15 20:42:35 -07:00
Caleb Cartwright
1bb85bdf6b chore: add utility function for relative span positions 2022-03-15 22:11:16 -05:00
Yacin Tmimi
5696e38597 Add test to verify tracking issue links
Now, tracking issue links are checked against the reference number
listed in the link text to ensure they match.
2022-03-15 21:40:20 -05:00
Dylan DPC
aaf2255379
Rollup merge of #94974 - c410-f3r:let-chain-dashufwrqwemkf-let-else, r=joshtriplett
Ensure that `let_else` does not interact with `let_chains`

As requested on https://github.com/rust-lang/rust/pull/94927.

cc `@joshtriplett` `@estebank`
2022-03-16 03:34:35 +01:00
Dylan DPC
2bd5c44e93
Rollup merge of #94951 - est31:irrefutable_let_chain_patterns, r=estebank
Extend the irrefutable_let_patterns lint to let chains

Implements the suggestion from https://github.com/rust-lang/rust/pull/94927#issuecomment-1067078300

We only look for complete suffixes or prefixes of irrefutable let patterns, so
that an irrefutable let pattern in a chain surrounded by refutable ones is
not linted, as it is an useful pattern that has no low-cost replacement (unlike suffixes or prefixes which can just be copied outside of the `if`: either into the `if`'s block, or the block surrounding the `if`).
If all patterns in a let chain are irrefutable, we lint as well.

Depends on #94958 ~~so I included it into the PR for now~~ *which has been merged since*.

r? `@estebank`

cc `@joshtriplett` `@c410-f3r`
2022-03-16 03:34:32 +01:00
Dylan DPC
f986c7434a
Rollup merge of #94868 - dtolnay:noblock, r=Dylan-DPC
Format core and std macro rules, removing needless surrounding blocks

Many of the asserting and printing macros in `core` and `std` are written with prehistoric-looking formatting, like this:

335ffbfa54/library/std/src/macros.rs (L96-L101)

In modern Rust style this would conventionally be written as follows instead, always using braces and a trailing semicolon on the macro arms:

af53809c87/library/std/src/macros.rs (L98-L105)

Getting rid of the unneeded braces inside the expansion reduces extraneous indentation in macro-expanded code. For example:

```rust
println!("repro {}", true);
```

```rust
// before:

{
    ::std::io::_print(
        ::core::fmt::Arguments::new_v1(
            &["repro ", "\n"],
            &[::core::fmt::ArgumentV1::new_display(&true)],
        ),
    );
};
```

```rust
// after:

::std::io::_print(
    ::core::fmt::Arguments::new_v1(
        &["repro ", "\n"],
        &[::core::fmt::ArgumentV1::new_display(&true)],
    ),
);
```
2022-03-16 03:34:32 +01:00
bors
af446e1d70 Auto merge of #94861 - aDotInTheVoid:rdj-trait-tests, r=CraftSpider
rustdoc-json: More tests, and better jsondocck errors

Helps with #81359

r? `@CraftSpider`

`@rustbot` modify labels: +A-rustdoc-json +T-rustdoc +A-testsuite
2022-03-16 01:24:37 +00:00
David Tolnay
ac5c657a08
Bless coverage-reports after core macro blocks change 2022-03-15 18:10:44 -07:00
Jacob Pratt
08fbe3dafa
Include tracking issue in diagnostic 2022-03-15 19:38:57 -04:00
est31
0f4c81a1a9 Extend the irrefutable_let_patterns lint to let chains
Only look for complete suffixes or prefixes of irrefutable let patterns, so
that an irrefutable let pattern in a chain surrounded by refutable ones is
not linted, as it is an useful pattern.
2022-03-16 00:28:07 +01:00
bors
f21488a12c Auto merge of #94925 - lcnr:relax-sus-auto-impls, r=estebank
relax `suspicious_auto_trait_impls` lint wrt lifetimes

fixes the warning for https://github.com/rust-lang/rust/issues/93367#issuecomment-1063993489.
2022-03-15 22:54:35 +00:00
skippy10110
e4f1179fa6 Add deprecated_safe feature gate and attribute, cc #94978 2022-03-15 19:48:52 -03:00
Joshua M. Clulow
0dcb1754b6 solaris build environment should include libsendfile/liblgrp
As of version 0.2.120 of the libc crate, the solaris target now requires
some additional libraries to be present in the sysroot.  Note that the
solaris target doesn't really build against files from Solaris, but
rather against some files from DilOS (a platform similar to both Solaris
and illumos).  Pull in the extra libraries and their compilation links
from that apt repository.
2022-03-15 13:46:02 -07:00
bors
52b34550ac Auto merge of #94973 - GuillaumeGomez:more-gui-tests, r=notriddle
Add GUI test to check URLs

The first commit merges both file doing kinda the same thing. Didn't make much sense to keep them separated.

The second commit add checks to ensure the URL has the expected value depending if the search is displayed or not.

r? `@notriddle`
2022-03-15 20:13:35 +00:00
Caio
261d5fc95b Ensure that let_else does not interact with let_chains 2022-03-15 17:00:16 -03:00
Guillaume Gomez
372271e3dd Add URL GUI tests 2022-03-15 20:56:14 +01:00
Guillaume Gomez
8a7b83a24a Merge both "search-result-color" GUI tests 2022-03-15 20:41:24 +01:00
Nixon Enraght-Moony
26829c03b0 rustdoc-json: Lifetime tests 2022-03-15 18:34:16 +00:00
Nixon Enraght-Moony
dc6b5cb9f3 jsondocck: Better error for invalid @count number 2022-03-15 18:34:16 +00:00
Nixon Enraght-Moony
42b548cf9d rustdoc-json: Add tests for generic fn args and returns 2022-03-15 18:34:16 +00:00
Nixon Enraght-Moony
ccef93fb89 jsondocck: better error for when @set matches multiple items 2022-03-15 18:23:07 +00:00
Nixon Enraght-Moony
4a57399ab0 rustdoc-json: Add test for supertraits 2022-03-15 18:23:07 +00:00
Matthias Krüger
277802e99a
Rollup merge of #94947 - Dylan-DPC:fix/typos, r=oli-obk
fix typos

Rework of #94603 which got closed as I was trying to unmerge and repush.  This is a subset of changes from the original pr as I sed'd whatever typos I remembered from the original PR

thanks to `@cuishuang` for the original PR
2022-03-15 17:15:53 +01:00
Matthias Krüger
e755f2c7cd
Rollup merge of #94810 - michaelwoerister:fix-trait-pointer-debuginfo-names, r=wesleywiser
debuginfo: Fix bug in type name generation for dyn types with associated types but no other generic arguments.

For types like `&dyn Future<Output=bool>` the compiler currently emits invalid types names in debuginfo. This PR fixes this.

Before:
```txt
// DWARF
&dyn core::future::future::Future, Output=bool>

// CodeView
ref$<dyn$<core::future::future::Future,assoc$<Output,bool> > > >
```

After:
```txt
// DWARF
&dyn core::future::future::Future<Output=bool>

// CodeView
ref$<dyn$<core::future::future::Future<assoc$<Output,bool> > > >
```

These syntactically incorrect type names can cause downstream tools (e.g. debugger extensions) crash when trying to parse them.

r? `@wesleywiser`
2022-03-15 17:15:52 +01:00
bors
040703018c Auto merge of #94261 - michaelwoerister:debuginfo-types-refactor, r=wesleywiser
debuginfo: Refactor debuginfo generation for types

This PR implements the refactoring of the `rustc_codegen_llvm::debuginfo::metadata` module as described in MCP https://github.com/rust-lang/compiler-team/issues/482.

In particular it
- changes names to use `di_node` instead of `metadata`
- uniformly names all functions that build new debuginfo nodes `build_xyz_di_node`
- renames `CrateDebugContext` to `CodegenUnitDebugContext` (which is more accurate)
- removes outdated parts from `compiler/rustc_codegen_llvm/src/debuginfo/doc.md`
- moves `TypeMap` and functions that work directly work with it to a new `type_map` module
- moves enum related builder functions to a new `enums` module
- splits enum debuginfo building for the native and cpp-like cases, since they are mostly separate
- uses `SmallVec` instead of `Vec` in many places
- removes the old infrastructure for dealing with recursion cycles (`create_and_register_recursive_type_forward_declaration()`, `RecursiveTypeDescription`, `set_members_of_composite_type()`, `MemberDescription`, `MemberDescriptionFactory`, `prepare_xyz_metadata()`, etc)
- adds `type_map::build_type_with_children()` as a replacement for dealing with recursion cycles
- adds many (doc-)comments explaining what's going on
- changes cpp-like naming for C-Style enums so they don't get a `enum$<...>` name (because the NatVis visualizer does not apply to them)
- fixes detection of what is a C-style enum because some enums where classified as C-style even though they have fields
- changes cpp-like naming for generator enums so that NatVis works for them
- changes the position of discriminant debuginfo node so it is consistently nested inside the top-level union instead of, sometimes, next to it

The following could be done in subsequent PRs:
- add caching for `closure_saved_names_of_captured_variables`
- add caching for `generator_layout_and_saved_local_names`
- fix inconsistent handling of what is considered a C-style enum wrt to debuginfo
- rename `metadata` module to `types`
- move common generator fields to front instead of appending them

This PR is based on https://github.com/rust-lang/rust/pull/93644 which is not merged yet.

Right now, the changes are all done in one big commit. They could be split into smaller commits but hopefully the list of changes above makes it tractable to review them as a single commit too.

For now: r? `@ghost` (let's see if this affects compile times)
2022-03-15 10:52:32 +00:00
Michael Woerister
aa2408aa84 debuginfo: Refactor debuginfo generation for types -- Make generator-objects test case architecture independent. 2022-03-15 11:45:51 +01:00
bors
3ba1ebea12 Auto merge of #94938 - lnicola:rust-analyzer-2022-03-14, r=lnicola
⬆️ rust-analyzer

r? `@ghost`
2022-03-15 07:23:50 +00:00
bors
a918d8b55b Auto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuber
More robust fallback for `use` suggestion

Our old way to suggest where to add `use`s would first look for pre-existing `use`s in the relevant crate/module, and if there are *no* uses, it would fallback on trying to use another item as the basis for the suggestion.

But this was fragile, as illustrated in issue #87613

This PR instead identifies span of the first token after any inner attributes, and uses *that* as the fallback for the `use` suggestion.

Fix #87613
2022-03-15 03:56:33 +00:00
bors
95561b336c Auto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuber
More robust fallback for `use` suggestion

Our old way to suggest where to add `use`s would first look for pre-existing `use`s in the relevant crate/module, and if there are *no* uses, it would fallback on trying to use another item as the basis for the suggestion.

But this was fragile, as illustrated in issue #87613

This PR instead identifies span of the first token after any inner attributes, and uses *that* as the fallback for the `use` suggestion.

Fix #87613
2022-03-15 03:56:33 +00:00
bors
984204814e Auto merge of #92285 - compiler-errors:dyn-proj-bounds, r=nikomatsakis
check ~Projection~ all supertrait bounds when confirming dyn candidate

I'm pretty sure Projection is the only other PredicateKind that we care about enforcing here.

Fixes #80800
2022-03-15 01:31:42 +00:00
Dylan DPC
13e889986d fix typos 2022-03-15 02:00:08 +01:00
Michael Goulet
67ef11dc2a check all dyn obligations, actually 2022-03-14 17:59:31 -07:00
Michael Goulet
f14a5fd712 check Projection supertrait bounds when confirming dyn candidate 2022-03-14 15:35:06 -07:00
bors
2184c7c568 Auto merge of #94935 - matthiaskrgr:rollup-2o2kyz6, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #90621 (Stabilise `aarch64_target_feature`)
 - #93977 (Type params and assoc types have unit metadata if they are sized)
 - #94670 (Improve `expect` impl and handle `#[expect(unfulfilled_lint_expectations)]` (RFC 2383))
 - #94884 (Fix remaining meta-variable expression TODOs)
 - #94931 (update miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-14 21:51:31 +00:00