Commit Graph

167627 Commits

Author SHA1 Message Date
Yuki Okushi
436c0e129c
Fix an ICE on #96738 2022-05-06 07:15:35 +09:00
bors
30f3860875 Auto merge of #96735 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2022-05-05 19:28:41 +00:00
bors
50cf76c24b Auto merge of #96734 - matthiaskrgr:rollup-hng33tb, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #95359 (Update `int_roundings` methods from feedback)
 - #95843 (Improve Rc::new_cyclic and Arc::new_cyclic documentation)
 - #96507 (Suggest calling `Self::associated_function()`)
 - #96635 (Use "strict" mode in JS scripts)
 - #96673 (Report that opaque types are not allowed in impls even in the presence of other errors)
 - #96682 (Show invisible delimeters (within comments) when pretty printing.)
 - #96714 (interpret/validity: debug-check ScalarPair layout information)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-05 16:59:54 +00:00
flip1995
463c760aa1
Update Cargo.lock 2022-05-05 15:13:10 +01:00
flip1995
496384531e
Merge commit '7c21f91b15b7604f818565646b686d90f99d1baf' into clippyup 2022-05-05 15:12:52 +01:00
Matthias Krüger
68048199c9
Rollup merge of #96714 - RalfJung:scalar-pair-debug, r=oli-obk
interpret/validity: debug-check ScalarPair layout information

This would have caught https://github.com/rust-lang/rust/issues/96158.
I ran the Miri test suite and it still passes.

r? `@oli-obk`
2022-05-05 15:43:07 +02:00
Matthias Krüger
7a915dd80d
Rollup merge of #96682 - nnethercote:show-invisible-delims, r=petrochenkov
Show invisible delimeters (within comments) when pretty printing.

Because invisible syntax is really hard to work with!

r? `@petrochenkov`
2022-05-05 15:43:05 +02:00
Matthias Krüger
5f8a2f6080
Rollup merge of #96673 - oli-obk:tait_impl_diagnostic, r=petrochenkov
Report that opaque types are not allowed in impls even in the presence of other errors

fixes  #96569

before this PR those useful errors were hidden because either `unused parameter` or `only traits defined in the current crate can be implemented for arbitrary types` got emitted first.
2022-05-05 15:43:05 +02:00
Matthias Krüger
9520641e2a
Rollup merge of #96635 - GuillaumeGomez:js-script-mode, r=notriddle
Use "strict" mode in JS scripts

Part of #93058.

r? `@notriddle`
2022-05-05 15:43:04 +02:00
Matthias Krüger
34bf620ac9
Rollup merge of #96507 - TaKO8Ki:suggest-calling-associated-function, r=lcnr
Suggest calling `Self::associated_function()`

closes #96453
2022-05-05 15:43:03 +02:00
Matthias Krüger
3f07303efe
Rollup merge of #95843 - GuillaumeGomez:improve-new-cyclic-doc, r=m-ou-se
Improve Rc::new_cyclic and Arc::new_cyclic documentation

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

cc `@CAD97` (since I used your explanations)
2022-05-05 15:43:02 +02:00
Matthias Krüger
47801413d9
Rollup merge of #95359 - jhpratt:int_roundings, r=joshtriplett
Update `int_roundings` methods from feedback

This updates `#![feature(int_roundings)]` (#88581) from feedback. All methods now take `NonZeroX`. The documentation makes clear that they panic in debug mode and wrap in release mode.

r? `@joshtriplett`

`@rustbot` label +T-libs +T-libs-api +S-waiting-on-review
2022-05-05 15:43:00 +02:00
bors
7c21f91b15 Auto merge of #8788 - flip1995:rustup, r=xFrednet,flip1995
Rustup

r? `@ghost`

changelog: move trait_duplication_in_bounds and type_repetition_in_bounds to nursery temporarily. This could already be reverted before the release. Check the Clippy in the Rust repo beta branch when writing this changelog.
2022-05-05 13:12:09 +00:00
flip1995
006282964f
Fix ICE in EarlyAttribtues lints 2022-05-05 14:10:06 +01:00
flip1995
bb01aca86f
HACK: Move buggy lints to nursery
Those lints are trait_duplication_in_bounds and
type_repetition_in_bounds. I don't think those can be fixed on the
Clippy side alone, but need changes in the compiler. So let's move them
to nursery to get the sync through and then fix them on the rustc side.

Also adds a regression test that has to be fixed before they can be
moved back to pedantic.
2022-05-05 13:32:31 +01:00
flip1995
7e017dbe8d
Bump nightly version -> 2022-05-05 2022-05-05 13:32:18 +01:00
flip1995
3b0c78d283
Merge remote-tracking branch 'upstream/master' into rustup 2022-05-05 13:32:06 +01:00
bors
a7d6768e3b Auto merge of #91779 - ridwanabdillahi:natvis, r=michaelwoerister
Add a new Rust attribute to support embedding debugger visualizers

Implemented [this RFC](https://github.com/rust-lang/rfcs/pull/3191) to add support for embedding debugger visualizers into a PDB.

Added a new attribute `#[debugger_visualizer]` and updated the `CrateMetadata` to store debugger visualizers for crate dependencies.

RFC: https://github.com/rust-lang/rfcs/pull/3191
2022-05-05 12:26:38 +00:00
bors
322a14919d Auto merge of #96649 - tbu-:pr_to_ipv4_loopback_doc, r=m-ou-se
Make it clear that `to_ipv4` returns an IPv4 address for the IPv6 loopback
2022-05-05 09:45:53 +00:00
Guillaume Gomez
1e204ddb3b Use "strict" mode in JS scripts 2022-05-05 11:07:14 +02:00
Ralf Jung
e47d6c7a6b give it a scary name 2022-05-05 09:55:38 +02:00
Takayuki Maeda
df25189552 suggest calling Self::associated_function()
do not suggest when trait_ref is some

Update compiler/rustc_resolve/src/late/diagnostics.rs

Co-authored-by: lcnr <rust@lcnr.de>

use helper struct

add a test for functions with some params

refactor debug log
2022-05-05 16:44:09 +09:00
bors
3d18f945ca Auto merge of #96630 - m-ysk:fix/issue-88038, r=notriddle
Include nonexported macro_rules! macros in the doctest target

Fixes #88038

This PR aims to include nonexported `macro_rules!` macros in the doctest target. For more details, please see the above issue.
2022-05-05 07:25:18 +00:00
bors
12d3f107c1 Auto merge of #96626 - thomcc:rand-bump, r=m-ou-se
Avoid using `rand::thread_rng` in the stdlib benchmarks.

This is kind of an anti-pattern because it introduces extra nondeterminism for no real reason. In thread_rng's case this comes both from the random seed and also from the reseeding operations it does, which occasionally does syscalls (which adds additional nondeterminism). The impact of this would be pretty small in most cases, but it's a good practice to avoid (particularly because avoiding it was not hard).

Anyway, several of our benchmarks already did the right thing here anyway, so the change was pretty easy and mostly just applying it more universally. That said, the stdlib benchmarks aren't particularly stable (nor is our benchmark framework particularly great), so arguably this doesn't matter that much in practice.

~~Anyway, this also bumps the `rand` dev-dependency to 0.8, since it had fallen somewhat out of date.~~ Nevermind, too much of a headache.
2022-05-05 05:08:44 +00:00
Jacob Pratt
dde590d180
Update int_roundings methods from feedback 2022-05-04 23:20:29 -04:00
bors
7d3e03666a Auto merge of #96720 - JohnTitor:rollup-9jaaekr, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #96603 (Enable full revision in const generics ui tests)
 - #96616 (Relax memory ordering used in `min_stack`)
 - #96619 (Relax memory ordering used in SameMutexCheck)
 - #96628 (Stabilize `bool::then_some`)
 - #96658 (Move callback to the () => {} syntax.)
 - #96677 (Add more tests for label-break-value)
 - #96697 (Enable tracing for all queries)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-05 02:49:16 +00:00
Yuki Okushi
ade123275d
Rollup merge of #96697 - oli-obk:trace_queries, r=michaelwoerister
Enable tracing for all queries

This allows you to log everything within a specific query, e.g.

```
env RUSTC_LOG=[mir_borrowck]
```

dumping all borrowck queries may be a bit verbose, so you can also restrict it to just an item of your choice:

```
env RUSTC_LOG=[mir_borrowck{key=\.\*name_of_item\.\*}]
```

the regex `.*` in the key name are because the key is a debug printed DefId, so you'd get all kinds of things like hashes in there. The tracing logs will show you the key, so you can restrict it further if you want.
2022-05-05 10:20:38 +09:00
Yuki Okushi
e3ada27d7d
Rollup merge of #96677 - jyn514:label-break-value-tests, r=petrochenkov
Add more tests for label-break-value

Helps with https://github.com/rust-lang/rust/issues/48594. The tests are adapted from https://github.com/rust-lang/rust/issues/48594#issuecomment-421625182.
2022-05-05 10:20:37 +09:00
Yuki Okushi
3170321706
Rollup merge of #96658 - Folyd:es6, r=GuillaumeGomez
Move callback to the () => {} syntax.

Part of https://github.com/rust-lang/rust/issues/93058.

r? `@GuillaumeGomez`
2022-05-05 10:20:36 +09:00
Yuki Okushi
da57b3a832
Rollup merge of #96628 - joshtriplett:stabilize-then-some, r=m-ou-se
Stabilize `bool::then_some`

FCP completed in https://github.com/rust-lang/rust/issues/80967
2022-05-05 10:20:35 +09:00
Yuki Okushi
b792258b32
Rollup merge of #96619 - akiekintveld:same_mutex_check_relaxed_ordering, r=m-ou-se
Relax memory ordering used in SameMutexCheck

`SameMutexCheck` only requires atomicity for `self.addr`, but does not need ordering of other memory accesses in either the success or failure case. Using `Relaxed`, the code still correctly handles the case when two threads race to store an address.
2022-05-05 10:20:34 +09:00
Yuki Okushi
8385d1713e
Rollup merge of #96616 - akiekintveld:min_stack_relaxed_ordering, r=joshtriplett
Relax memory ordering used in `min_stack`

`min_stack` does not provide any synchronization guarantees to its callers, and only requires atomicity for `MIN` itself, so relaxed memory ordering is sufficient.
2022-05-05 10:20:33 +09:00
Yuki Okushi
1318d943a5
Rollup merge of #96603 - Alexendoo:const-generics-tests, r=Mark-Simulacrum
Enable full revision in const generics ui tests

The ICEs no longer occur since https://github.com/rust-lang/rust/pull/95776 so the revisions can be reenabled

Also adds some regression tests for issues that no longer ICE because of it

closes #77357
closes #78180
closes #83993
2022-05-05 10:20:32 +09:00
bors
bdcb6a99e8 Auto merge of #96593 - jackh726:issue-93262, r=compiler-errors
Revert "Prefer projection candidates instead of param_env candidates for Sized predicates"

Fixes #93262
Reopens #89352

This was a hack that seemed to have no negative side-effects at the time. Given that the latter has a workaround and likely less common than the former, it makes sense to revert this change.

r? `@compiler-errors`
2022-05-05 00:24:48 +00:00
ridwanabdillahi
791bef5455 Cleanup broken doc links. 2022-05-04 17:17:57 -07:00
Tobias Bucher
ed95d502c6 Make it clear that to_ipv4 returns an IPv4 address for the IPv6 loopback 2022-05-05 00:45:55 +02:00
bors
82f469f81b Auto merge of #96546 - nnethercote:overhaul-MacArgs, r=petrochenkov
Overhaul `MacArgs`

Motivation:
- Clarify some code that I found hard to understand.
- Eliminate one use of three places where `TokenKind::Interpolated` values are created.

r? `@petrochenkov`
2022-05-04 21:16:28 +00:00
bors
4c60a0ea5b Auto merge of #96546 - nnethercote:overhaul-MacArgs, r=petrochenkov
Overhaul `MacArgs`

Motivation:
- Clarify some code that I found hard to understand.
- Eliminate one use of three places where `TokenKind::Interpolated` values are created.

r? `@petrochenkov`
2022-05-04 21:16:28 +00:00
Nicholas Nethercote
baa18c027a Add a comment on TokenKind::Interpolated. 2022-05-05 07:06:57 +10:00
Nicholas Nethercote
c318cf453d Overhaul MacArgs::Eq.
The value in `MacArgs::Eq` is currently represented as a `Token`.
Because of `TokenKind::Interpolated`, `Token` can be either a token or
an arbitrary AST fragment. In practice, a `MacArgs::Eq` starts out as a
literal or macro call AST fragment, and then is later lowered to a
literal token. But this is very non-obvious. `Token` is a much more
general type than what is needed.

This commit restricts things, by introducing a new type `MacArgsEqKind`
that is either an AST expression (pre-lowering) or an AST literal
(post-lowering). The downside is that the code is a bit more verbose in
a few places. The benefit is that makes it much clearer what the
possibilities are (though also shorter in some other places). Also, it
removes one use of `TokenKind::Interpolated`, taking us a step closer to
removing that variant, which will let us make `Token` impl `Copy` and
remove many "handle Interpolated" code paths in the parser.

Things to note:
- Error messages have improved. Messages like this:
  ```
  unexpected token: `"bug" + "found"`
  ```
  now say "unexpected expression", which makes more sense. Although
  arbitrary expressions can exist within tokens thanks to
  `TokenKind::Interpolated`, that's not obvious to anyone who doesn't
  know compiler internals.
- In `parse_mac_args_common`, we no longer need to collect tokens for
  the value expression.
2022-05-05 07:06:12 +10:00
Nicholas Nethercote
99f5945f85 Overhaul MacArgs::Eq.
The value in `MacArgs::Eq` is currently represented as a `Token`.
Because of `TokenKind::Interpolated`, `Token` can be either a token or
an arbitrary AST fragment. In practice, a `MacArgs::Eq` starts out as a
literal or macro call AST fragment, and then is later lowered to a
literal token. But this is very non-obvious. `Token` is a much more
general type than what is needed.

This commit restricts things, by introducing a new type `MacArgsEqKind`
that is either an AST expression (pre-lowering) or an AST literal
(post-lowering). The downside is that the code is a bit more verbose in
a few places. The benefit is that makes it much clearer what the
possibilities are (though also shorter in some other places). Also, it
removes one use of `TokenKind::Interpolated`, taking us a step closer to
removing that variant, which will let us make `Token` impl `Copy` and
remove many "handle Interpolated" code paths in the parser.

Things to note:
- Error messages have improved. Messages like this:
  ```
  unexpected token: `"bug" + "found"`
  ```
  now say "unexpected expression", which makes more sense. Although
  arbitrary expressions can exist within tokens thanks to
  `TokenKind::Interpolated`, that's not obvious to anyone who doesn't
  know compiler internals.
- In `parse_mac_args_common`, we no longer need to collect tokens for
  the value expression.
2022-05-05 07:06:12 +10:00
Ralf Jung
5b20da8180 interpret: debug-check ScalarPair layout information 2022-05-04 22:52:02 +02:00
Oli Scherer
0d5a738b8b Enable tracing for all queryies 2022-05-04 16:15:26 +00:00
bors
343889b723 Auto merge of #96683 - nnethercote:speed-up-Token-ident-lifetime, r=petrochenkov
Speed up `Token::{ident,lifetime}`

Some speed and cleanliness improvements.

r? `@petrochenkov`
2022-05-04 15:24:02 +00:00
bors
c7a705a842 Auto merge of #8575 - FoseFx:trim_split_whitespace2, r=flip1995
add `trim_split_whitespace`

Closes #8521

changelog: [`trim_split_whitespace`]
2022-05-04 13:31:19 +00:00
Guillaume Gomez
67d1e7b8ff Improve Rc::new_cyclic and Arc::new_cyclic documentation 2022-05-04 15:20:02 +02:00
bors
751fd0d735 Auto merge of #8780 - Alexendoo:init-numbered-field-alias, r=flip1995
Ignore type aliases in `init_numbered_fields`

changelog: Ignore type aliases in [`init_numbered_fields`]

Fixes #8638
2022-05-04 13:17:35 +00:00
Max Baumann
fea177fafe
add trim_split_whitespace 2022-05-04 15:04:05 +02:00
bors
364bf39e31 Auto merge of #94775 - oli-obk:operand_order, r=davidtwco
Fix constants not getting dropped if part of a diverging expression

fixes https://github.com/rust-lang/rust/issues/90762

cc `@RalfJung`
2022-05-04 12:54:02 +00:00
Josh Triplett
0fc5c524f5 Stabilize bool::then_some 2022-05-04 13:22:08 +02:00