Commit Graph

199273 Commits

Author SHA1 Message Date
bors
78a891d364 Auto merge of #101485 - GuillaumeGomez:rollup-68p9di4, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #101357 (Include enum path in variant suggestion)
 - #101434 (Update `SessionDiagnostic::into_diagnostic` to take `Handler` instead of `ParseSess`)
 - #101445 (Suggest introducing an explicit lifetime if it does not exist)
 - #101457 (Recover from using `;` as separator between fields)
 - #101462 (Rustdoc-Json: Store Variant Fields as their own item.)
 - #101471 (Report number of delayed bugs properly with `-Ztreat-err-as-bug`)
 - #101473 (Add more size assertions for MIR types.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-06 18:10:14 +00:00
Guillaume Gomez
f21b6129a0
Rollup merge of #101473 - nnethercote:mir-size-assertions, r=lqd
Add more size assertions for MIR types.

And move them into a module, as has been done previously for AST, HIR,
etc.

r? `@lqd`
2022-09-06 17:00:30 +02:00
Guillaume Gomez
7d2e150e92
Rollup merge of #101471 - compiler-errors:delay-bug-are-count-too, r=oli-obk
Report number of delayed bugs properly with `-Ztreat-err-as-bug`

Report the number of delayed bugs that went into the `-Ztreat-errr-as-bug=N` being triggered, even if we don't count it in the err_count in regular diagnostic output.

Sometimes we have a session that creates a few diagnostics, perhaps: Error, Delay bug, Error, then Delay bug.
If I ran `-Ztreat-err-as-bug=3`, then I will now see "aborting after 2 errors and 1 delayed bugs" instead of just "after 2 errors" which is confusing since I passed `3`.
2022-09-06 17:00:29 +02:00
Guillaume Gomez
b59c1aa298
Rollup merge of #101462 - aDotInTheVoid:rdj-enum-field-2, r=GuillaumeGomez
Rustdoc-Json: Store Variant Fields as their own item.

Closes #100587
Closes #92945

Successor to #100762

Unlike that one, we don't have merge `StructType` and `Variant`, as after #101386 `Variant` stores enum specific information (discriminant).

Resolves the naming discussion (https://github.com/rust-lang/rust/pull/100762#discussion_r950690526) by having seperate enums for struct and enum kinds

Resolves `#[doc(hidden)]` on tuple structs (https://github.com/rust-lang/rust/pull/100762#discussion_r950833884) by storing as a `Vec<Option<Id>>`

r? `@GuillaumeGomez`
2022-09-06 17:00:28 +02:00
Guillaume Gomez
78968e5959
Rollup merge of #101457 - ChayimFriedman2:struct-field-semi, r=fee1-dead
Recover from using `;` as separator between fields

Partially fixes #101440 (only for record structs).

Doing that for tuple structs is harder as their parsing passes through a bunch of helper functions. I don't know how to do that. But [their error message is better anyway](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=cc6ee8bb2593596c0cea89d49e79bcb4) and suggests using a comma, even if it doesn't suggest replacing the semicolon with it.
2022-09-06 17:00:28 +02:00
Guillaume Gomez
7c7548cd37
Rollup merge of #101445 - TaKO8Ki:suggest-introducing-explicit-lifetime, r=oli-obk
Suggest introducing an explicit lifetime if it does not exist

Fixes #101027
2022-09-06 17:00:27 +02:00
Guillaume Gomez
4d830b7775
Rollup merge of #101434 - JhonnyBillM:replace-session-for-handler-in-into-diagnostic, r=davidtwco
Update `SessionDiagnostic::into_diagnostic` to take `Handler` instead of `ParseSess`

Suggested by the team in [this Zulip Topic](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler).

`Handler` already has almost all the capabilities of `ParseSess` when it comes to diagnostic emission, in this migration we only needed to add the ability to access `source_map` from the emitter in order to get a `Snippet` and the `start_point`. Not sure if adding these two methods [`span_to_snippet_from_emitter` and  `span_start_point_from_emitter`] is the best way to address this gap.

P.S. If this goes in the right direction, then we probably may want to move `SessionDiagnostic` to `rustc_errors` and rename it to `DiagnosticHandler` or something similar.

r? `@davidtwco`
r? `@compiler-errors`
2022-09-06 17:00:26 +02:00
Guillaume Gomez
d13aefdc65
Rollup merge of #101357 - compiler-errors:variant-sugg-tweak, r=oli-obk
Include enum path in variant suggestion

(except for `Result` and `Option`, which we should have via the prelude)

Fixes #101356
2022-09-06 17:00:25 +02:00
bors
380addd7d2 Auto merge of #100733 - scottmcm:inline-from-from-identity, r=m-ou-se
Inline `<T as From<T>>::from`

I noticed (in https://github.com/rust-lang/rust/pull/100693#issuecomment-1218520141) that the MIR for <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=67097e0494363ee27421a4e3bdfaf513> has inlined most stuff
```
scope 5 (inlined <Result<i32, u32> as Try>::branch)
```
```
scope 8 (inlined <Result<i32, u32> as Try>::from_output)
```

But yet the do-nothing `from` call was still there:
```
_17 = <u32 as From<u32>>::from(move _18) -> bb9;
```

So let's give this a try and see what perf has to say.
2022-09-06 14:33:31 +00:00
bors
3c72788461 Auto merge of #101479 - Dylan-DPC:rollup-v8ite0y, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #100658 (TyCtxt::get_attr should check that no duplicates are allowed)
 - #101021 (Migrate ``rustc_middle`` diagnostic)
 - #101287 (Document eager evaluation of `bool::then_some` argument)
 - #101412 (Some more cleanup in `core`)
 - #101427 (Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-06 11:16:02 +00:00
Dylan DPC
8936211661
Rollup merge of #101427 - compiler-errors:issue-101421, r=cjgillot
Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments

Fixes #101421
cc #100838
2022-09-06 16:34:45 +05:30
Dylan DPC
00db13fcc9
Rollup merge of #101412 - WaffleLapkin:improve_std_ptr_code_leftovers, r=scottmcm
Some more cleanup in `core`

- remove some integer casts from slice iter (proposed in https://github.com/rust-lang/rust/pull/100819#discussion_r951113196)
- replace `as usize` casts with `usize::from` in slice sort (proposed in https://github.com/rust-lang/rust/pull/100822#discussion_r950768698)

r? `@scottmcm`
2022-09-06 16:34:44 +05:30
Dylan DPC
24f998932e
Rollup merge of #101287 - Adam-Gleave:doc_bool_then_some, r=scottmcm
Document eager evaluation of `bool::then_some` argument

I encountered this earlier today and thought maybe `bool::then_some` could use a little addition to the documentation.

It's pretty obvious with familiarity and from looking at the implementation, but the argument for `then_some` is eagerly evaluated, which means if you do the following (as I did), you can have a problem:

```rust
// Oops!
let _ = something
    .has_another_thing()
    .then_some(something.another_thing_or_panic());
```

A note, similar to other methods with eagerly-evaluated arguments and a lazy alternative (`Option::or`, for example), could help point this out to people who forget (like me)!
2022-09-06 16:34:43 +05:30
Dylan DPC
36144f2b3d
Rollup merge of #101021 - MingyuChen1:diagnostic, r=davidtwco
Migrate ``rustc_middle`` diagnostic

Part of #100717
2022-09-06 16:34:42 +05:30
Dylan DPC
3f22020006
Rollup merge of #100658 - chenyukang:100631-check-get-attr, r=lcnr
TyCtxt::get_attr should check that no duplicates are allowed

Fixes #100631
2022-09-06 16:34:41 +05:30
bors
a594044533 Auto merge of #101362 - compiler-errors:unnecessary-let, r=cjgillot
Suggest removing unnecessary prefix let in patterns

Helps with #101291, though I think `@estebank` probably wants this:

> Finally, I think it'd be nice if we could detect that we don't know for sure and "just" swallow the rest of the expression (find the next ; accounting for nested braces) or the end of the item (easier).

... to be implemented before we close that issue out completely.
2022-09-06 08:49:54 +00:00
Michael Goulet
38935bbe6a Report number of delayed bugs properly with -Ztreat-err-as-bug 2022-09-06 07:12:52 +00:00
yukang
00b10a5552 get_attr should check that no duplicates are allowed 2022-09-06 14:16:54 +08:00
bors
098cf88022 Auto merge of #101359 - compiler-errors:cannot-call-trait-object-with-unsized-return, r=lcnr
Point out when a callable is not actually callable because its return is not sized

Fixes #100755

I didn't add a UI test for that one because it's equivalent to the UI test that already exists in the suite.
2022-09-06 05:57:39 +00:00
Nicholas Nethercote
246d126edd Add more size assertions for MIR types.
And move them into a module, as has been done previously for AST, HIR,
etc.
2022-09-06 15:25:54 +10:00
bors
6c358c67d4 Auto merge of #101241 - camsteffen:refactor-binding-annotations, r=cjgillot
`BindingAnnotation` refactor

* `ast::BindingMode` is deleted and replaced with `hir::BindingAnnotation` (which is moved to `ast`)
* `BindingAnnotation` is changed from an enum to a tuple struct e.g. `BindingAnnotation(ByRef::No, Mutability::Mut)`
* Associated constants added for convenience `BindingAnnotation::{NONE, REF, MUT, REF_MUT}`

One goal is to make it more clear that `BindingAnnotation` merely represents syntax `ref mut` and not the actual binding mode. This was especially confusing since we had `ast::BindingMode`->`hir::BindingAnnotation`->`thir::BindingMode`.

I wish there were more symmetry between `ByRef` and `Mutability` (variant) naming (maybe `Mutable::Yes`?), and I also don't love how long the name `BindingAnnotation` is, but this seems like the best compromise. Ideas welcome.
2022-09-06 03:16:29 +00:00
bors
56b27110e7 Auto merge of #101464 - JohnTitor:rollup-unsjgm6, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #99291 (Add let else drop order tests)
 - #101402 (Add a Machine hook for inline assembly)
 - #101404 (Fix cleanup for uninitialized stdout)
 - #101418 (Revert "Mention rust-analyzer maintainers when `proc_macro` bridge is changed")
 - #101425 (Point at type parameter in plain path expr)
 - #101426 (Don't duplicate file descriptors into stdio fds)
 - #101447 (Remove generics_def_id_map from the resolver.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-06 00:23:01 +00:00
Yuki Okushi
0d8a1f4cbf
Rollup merge of #101447 - cjgillot:no-remap-resolver, r=spastorino
Remove generics_def_id_map from the resolver.

This is internal state for lowering.  This does not belong in the resolver.

r? ``@spastorino``
2022-09-06 08:36:10 +09:00
Yuki Okushi
c6f6b1821d
Rollup merge of #101426 - beetrees:dup-no-stdio, r=thomcc
Don't duplicate file descriptors into stdio fds

Ensures that file descriptors are never duplicated into the stdio fds even if a stdio fd has been closed.
2022-09-06 08:36:09 +09:00
Yuki Okushi
c3faa2250c
Rollup merge of #101425 - compiler-errors:point-at-ty-param, r=spastorino
Point at type parameter in plain path expr

Slightly better error message for a kinda unique use case.
2022-09-06 08:36:08 +09:00
Yuki Okushi
c633b0a72c
Rollup merge of #101418 - rust-lang:revert-99183-proc_macro-mention-r-a, r=Mark-Simulacrum
Revert "Mention rust-analyzer maintainers when `proc_macro` bridge is changed"

Reverts rust-lang/rust#99183

rust-analyzer is now a subtree, and CI fails when the `proc_macro` bridge changes break our tests, so these notifications aren't needed anymore.
2022-09-06 08:36:06 +09:00
Yuki Okushi
ff124c6ae8
Rollup merge of #101404 - joboet:always_cleanup_stdout, r=joshtriplett
Fix cleanup for uninitialized stdout

Fixes #101375 by disabling buffering even if the buffer was not initialized yet.
2022-09-06 08:36:05 +09:00
Yuki Okushi
957b44a13c
Rollup merge of #101402 - saethlin:inline-asm-hook, r=oli-obk
Add a Machine hook for inline assembly

I'm sketching out some support in Miri to "execute" inline assembly. I want this because there are codebases which have very simple inline assembly like hand-written syscall wrappers, and it would be nice to test such code without modification.

r? ``@oli-obk``
2022-09-06 08:36:04 +09:00
Yuki Okushi
0e6747fb25
Rollup merge of #99291 - est31:let_else_tests, r=joshtriplett
Add let else drop order tests

Add a systematic matrix based test that checks temporary drop order in various settings, `let-else-drop-order.rs`, as requested [here](https://github.com/rust-lang/rust/pull/93628#issuecomment-1055738523).

The drop order of let and let else is supposed to be the and in order to ensure this, the test checks that this holds for a number of cases.

The test also ensures that we drop the temporaries of the condition before executing the else block.

cc #87335 tracking issue for `let else`
2022-09-06 08:36:03 +09:00
Nixon Enraght-Moony
065e0b9c9c Rustdoc-Json: Store Variant Fields as their own item.
Closes #100587
Closes #92945
2022-09-05 23:59:33 +01:00
bors
676afc5149 Auto merge of #101460 - rust-lang:update-cargo, r=ehuss
Update cargo

8 commits in 4ed54cecce3ce9ab6ff058781f4c8a500ee6b8b5..646e9a0b9ea8354cc409d05f10e8dc752c5de78e
2022-08-27 18:41:39 +0000 to 2022-09-02 14:29:28 +0000
- Support inheriting jobserver fd for external subcommands (rust-lang/cargo#10511)
- refactor(cli): Lazy load config (rust-lang/cargo#11029)
- chore: Don't show genned docs in ripgrep (rust-lang/cargo#11040)
- Document private items for Cargo and publish under contributor guide (rust-lang/cargo#11019)
- Add names to CI jobs (rust-lang/cargo#11039)
- Rework test error handling (rust-lang/cargo#11028)
- Very slight `cargo add` documentation improvements (rust-lang/cargo#11033)
- Update compiling requirements. (rust-lang/cargo#11030)
2022-09-05 21:55:48 +00:00
Jhonny Bill Mena
46ba27d5b5 [Gardening] UPDATE - use let chain to unwrap snippet and evaluate flag 2022-09-05 17:32:23 -04:00
Jhonny Bill Mena
dd5850b8fa UPDATE - accept start_point and snippet instead of SourceMap 2022-09-05 17:26:57 -04:00
Michael Goulet
1254b32479 Point out when a callable is not actually callable because its return is not sized 2022-09-05 20:55:43 +00:00
Michael Goulet
bee48e3fdc Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments 2022-09-05 20:47:20 +00:00
Chayim Refael Friedman
fbf11cfc13 Recover from using ; as separator between fields 2022-09-05 19:15:23 +00:00
Weihang Lo
11e66e155d Update cargo
8 commits in 4ed54cecce3ce9ab6ff058781f4c8a500ee6b8b5..646e9a0b9ea8354cc409d05f10e8dc752c5de78e
2022-08-27 18:41:39 +0000 to 2022-09-02 14:29:28 +0000
- Support inheriting jobserver fd for external subcommands (rust-lang/cargo#10511)
- refactor(cli): Lazy load config (rust-lang/cargo#11029)
- chore: Don't show genned docs in ripgrep (rust-lang/cargo#11040)
- Document private items for Cargo and publish under contributor guide (rust-lang/cargo#11019)
- Add names to CI jobs (rust-lang/cargo#11039)
- Rework test error handling (rust-lang/cargo#11028)
- Very slight `cargo add` documentation improvements (rust-lang/cargo#11033)
- Update compiling requirements. (rust-lang/cargo#11030)
2022-09-05 18:34:53 +01:00
Jhonny Bill Mena
31e9f40bcf FIX - broken translatable diagnostics tests 2022-09-05 12:59:56 -04:00
bors
b44197abb0 Auto merge of #101261 - TaKO8Ki:separate-receiver-from-arguments-in-hir, r=cjgillot
Separate the receiver from arguments in HIR

Related to #100232

cc `@cjgillot`
2022-09-05 16:21:40 +00:00
Jhonny Bill Mena
d14b3af6db [Gardening] UPDATE - tidy fixes 2022-09-05 12:09:10 -04:00
Jhonny Bill Mena
72f766ae71 FIX - broken translatable diagnostics tests 2022-09-05 12:07:48 -04:00
Jhonny Bill Mena
1524b59444 UPDATE - avoid exposing source_map methods from Handler 2022-09-05 11:42:48 -04:00
111
a42c0d79da fix comment 2022-09-05 23:18:18 +08:00
Takayuki Maeda
9cde34e180 use propagate_through_exprs instead of propagate_through_expr
fix `ExprKind` static_assert_size

fix hir-stats
2022-09-05 23:11:34 +09:00
bors
2dc703fd6e Auto merge of #101228 - nnethercote:simplify-hir-PathSegment, r=petrochenkov
Simplify `hir::PathSegment`

r? `@petrochenkov`
2022-09-05 13:36:54 +00:00
Takayuki Maeda
fea1c5f5c8 refactor: remove unnecessary variables 2022-09-05 22:31:02 +09:00
Takayuki Maeda
3955dc3480 separate the receiver from arguments in HIR under /clippy 2022-09-05 22:25:57 +09:00
Takayuki Maeda
87c6da363f separate the receiver from arguments in HIR 2022-09-05 22:25:49 +09:00
Camille GILLOT
037ab1d183 Remove generics_def_id_map from the resolver. 2022-09-05 13:32:13 +02:00
est31
2d8460ef43 Add matrix based test for documenting the let / let else temporary drop order
The drop order of let and let else is supposed to be the same,
and in order to ensure this, the test checks that this holds for
the given list of cases.

The test also ensures that we drop the temporaries of the
condition before executing the else block.

We made the test matrix based so it can check all the possible
combinations and find out possible edge cases.
2022-09-05 13:06:23 +02:00