Commit Graph

12072 Commits

Author SHA1 Message Date
Aria Beingessner
28576e9c51 mark FIXMES for all the places found that are probably offset_from 2022-03-29 20:18:28 -04:00
Aria Beingessner
68643603ad Make some rustc code conform to strict provenance.
There's some really bad stuff around `ty` and pointer tagging stuff that
was too much work to handle here.
2022-03-29 20:18:27 -04:00
Dylan DPC
a0d2862ca4
Rollup merge of #95386 - compiler-errors:try-wrapping, r=oli-obk
Suggest wrapping patterns in enum variants

Structured suggestion to wrap a pattern in a single-field enum or struct:

```diff
 struct A;

 enum B {
   A(A),
 }

 fn main(b: B) {
   match b {
-    A => {}
+    B::A(A) => {}
   }
 }
```

Half of #94942, the other half I'm not exactly sure how to fix.

Also includes two drive-by changes (that I am open to splitting out into another PR, but thought they could be rolled up into this one):
- 07776c111f: Makes sure not to suggest wrapping if it doesn't have tuple field constructor (i.e. has named fields)
- 8f2bbb18fd53e5008bb488302dbd354577698ede: Also suggest wrapping expressions in a tuple struct (not just enum variants)
2022-03-29 22:46:34 +02:00
Dylan DPC
564c583162
Rollup merge of #95422 - TaKO8Ki:use-format-args-capture-and-remove-unnecessary-nesting-in-rustc-typeck, r=petrochenkov
Refactor: Use `format-args-capture` and remove an unnecessary nested block
2022-03-29 17:11:54 +02:00
Dylan DPC
eceb173de9
Rollup merge of #95415 - notriddle:notriddle/issue-82081, r=Dylan-DPC
diagnostics: regression test for HashMap iter_mut suggestion

Closes #82081
2022-03-29 17:11:52 +02:00
Michael Goulet
ac95e80186 Suggest function borrow ignoring needs_note
`needs_note` is false if we've already suggested why the type is Copy...
but that has nothing to do with the diagnostic.
2022-03-28 22:27:07 -07:00
Michael Goulet
a9b02e13a6 drive-by: move Copy bound suggestion to its own function 2022-03-28 22:27:07 -07:00
Michael Goulet
0f3c2933e0 Add suggestion to borrow opaque Fn and FnMut instead of move 2022-03-28 22:27:06 -07:00
Takayuki Maeda
f2506c911b use format-args-capture and remove an unnecessary nested block 2022-03-29 12:18:22 +09:00
Michael Howell
a063b3a4b6 diagnostics: do not suggest map.iter_mut()() 2022-03-28 11:48:14 -07:00
Dylan DPC
ce319ac1a2
Rollup merge of #95328 - DrMeepster:box_gep_err, r=oli-obk
Fix yet another Box<T, A> ICE

Fixes #95036.

This widens the special case from #94414 to make sure that boxes with a custom allocator are never directly dereferenced.
2022-03-28 20:41:51 +02:00
Dylan DPC
e10d5039bc
Rollup merge of #95318 - rust-lang:notriddle/issue-95208, r=wesleywiser
diagnostics: correct generic bounds with doubled colon

Fixes #95208
2022-03-28 20:41:50 +02:00
Dylan DPC
72770efcb0
Rollup merge of #93787 - klensy:really-not-a-features, r=wesleywiser
parallel_compiler: hide dependencies behind feature

Separate dependencies for `parallel_compiler` feature, so they will not be compiled if feature not selected, reducing number of compiled crates from 238 to 224.
2022-03-28 20:41:49 +02:00
Dylan DPC
1c8b7412d4
Rollup merge of #95390 - nnethercote:allow-doc-comments-in-macros, r=petrochenkov
Ignore doc comments in a declarative macro matcher.

Fixes #95267. Reverts to the old behaviour before #95159 introduced a
regression.

r? `@petrochenkov`
2022-03-28 16:08:11 +02:00
Dylan DPC
4dd9567cf6
Rollup merge of #95350 - petrochenkov:qpathregr, r=cjgillot
resolve: Simplify some diagnostic code to avoid an ICE

No need to resolve those paths, they are already resolved, we just need to take the results from `partial_res_map`.

Fixes https://github.com/rust-lang/rust/issues/95327
2022-03-28 16:08:09 +02:00
Dylan DPC
4651c8df02
Rollup merge of #95314 - c410-f3r:aqui-vamos-nos, r=lcnr
Tell users that `||` operators are not currently supported in let chain expressions

Tells that `||` operators are not currently supported instead of not allowed. See https://github.com/rust-lang/rust/issues/53667#issuecomment-1066075876

In other words, this PR is pretty much trivial.
2022-03-28 16:08:08 +02:00
Dylan DPC
ae037a86f9
Rollup merge of #95301 - nnethercote:rm-NtTT, r=petrochenkov
Remove `Nonterminal::NtTT`.

It's only needed for macro expansion, not as a general element in the
AST. This commit removes it, adds `NtOrTt` for the parser and macro
expansion cases, and renames the variants in `NamedMatch` to better
match the new type.

r? `@petrochenkov`
2022-03-28 16:08:07 +02:00
bors
0e4524e5b4 Auto merge of #94789 - compiler-errors:fatal-never, r=eddyb
Make fatal DiagnosticBuilder yield `!`

Fatal errors should really be fatal, so emitting them should cause us to exit at the same time.

Fine with just throwing away these changes if they're not worthwhile. Also, maybe we want to use an uninhabited enum instead of `!`.

r? `@eddyb` who has been working on `DiagnosticBuilder` stuff, feel free to reassign.
2022-03-28 11:08:23 +00:00
bors
b3e46a9763 Auto merge of #95396 - TaKO8Ki:suggest-replacing-field-when-using-the-same-type, r=compiler-errors
Suggest replacing a field when using the same type

closes #89166
2022-03-28 08:40:25 +00:00
bors
13c9fc38c9 Auto merge of #95300 - workingjubilee:less-bitsets, r=eddyb
Skip needless bitset for debuginfo

Found this while digging around looking at the inlining logic.
Seemed obvious enough so I decided to try to take care of it.
Is this what you had in mind, `@eddyb?`
2022-03-28 05:48:25 +00:00
klensy
008fc79dcd Propagate parallel_compiler feature through rustc crates. Turned off feature gives change of builded crates: 238 -> 224. 2022-03-28 08:41:12 +03:00
klensy
78fbcca3e1 use cfg attribute instead of macro 2022-03-28 08:37:32 +03:00
Michael Goulet
928388bad2 Make fatal DiagnosticBuilder yield never 2022-03-27 22:25:32 -07:00
Takayuki Maeda
c26cfd1c53 use can_coerce instead of same_type_modulo_infer 2022-03-28 13:43:33 +09:00
Takayuki Maeda
9e4d019fee suggest replacing field when using the same type 2022-03-28 12:38:10 +09:00
bors
3badf5c51c Auto merge of #95333 - GuillaumeGomez:auto-trait-perf-issue, r=oli-obk
Fix perf issue for auto trait selection

Follow-up of https://github.com/rust-lang/rust/pull/95069 which fixes the perf issue introduced by it.

r? `@oli-obk`
2022-03-28 00:01:01 +00:00
Nicholas Nethercote
9967594346 Ignore doc comments in a declarative macro matcher.
Fixes #95267. Reverts to the old behaviour before #95159 introduced a
regression.
2022-03-28 10:45:24 +11:00
Michael Goulet
fc289a0796 suggest wrapping in struct tuples as well 2022-03-27 16:44:55 -07:00
Michael Goulet
07776c111f do not suggest enum tuple variant for named field variant 2022-03-27 16:10:02 -07:00
Michael Goulet
dd6683fcda suggest wrapping patterns with compatible enum variants 2022-03-27 16:10:02 -07:00
Nicholas Nethercote
364b908d57 Remove Nonterminal::NtTT.
It's only needed for macro expansion, not as a general element in the
AST. This commit removes it, adds `NtOrTt` for the parser and macro
expansion cases, and renames the variants in `NamedMatch` to better
match the new type.
2022-03-28 10:03:02 +11:00
bors
62523045ec Auto merge of #95382 - Dylan-DPC:rollup-bebyfd1, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #94939 (diagnostics: suggest missing comma in bad FRU syntax)
 - #95120 (Implement `apply_switch_int_edge_effects` for backward analyses)
 - #95364 (Add long error explanation for E0667)
 - #95366 (Remove test files with duplicated checksums)
 - #95368 (Fix typo in `String::try_reserve_exact` docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-27 21:36:42 +00:00
Dylan DPC
dafc29dd72
Rollup merge of #95364 - GuillaumeGomez:long-error-explanation-e0667, r=Dylan-DPC
Add long error explanation for E0667

Part of #61137.
2022-03-27 22:51:40 +02:00
Dylan DPC
a8be562bdf
Rollup merge of #95120 - smoelius:backward-switch-int, r=ecstatic-morse
Implement `apply_switch_int_edge_effects` for backward analyses

See #94576 for some discussion.

r? `@ecstatic-morse`
2022-03-27 22:51:39 +02:00
DrMeepster
09ccc63624 fix other source of box deref 2022-03-27 13:35:29 -07:00
bors
ab0c2e18dc Auto merge of #94495 - estebank:missing-closing-gt, r=jackh726
Provide suggestion for missing `>` in a type parameter list

When encountering an inproperly terminated type parameter list, provide
a suggestion to close it after the last non-constraint type parameter
that was successfully parsed.

Fix #94058.
2022-03-27 18:55:58 +00:00
Dylan MacKenzie
241ec5b3b3
Nit 2022-03-27 10:58:55 -07:00
Michael Howell
301fc070ff diagnostics: suggest missing comma in bad FRU syntax
Fixes #51103
2022-03-27 10:01:29 -07:00
Guillaume Gomez
eae2903150 Add long error explanation for E0667 2022-03-27 14:09:52 +02:00
Esteban Kuber
157c67b7a8 Handle , to ; substitution in arg params 2022-03-27 06:05:18 +00:00
bors
185a3f0a11 Auto merge of #95351 - Dylan-DPC:rollup-o1il7tx, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #91981 (Recover suggestions and useful information lost in previous PR)
 - #93469 (Skip pointing out ambiguous impls in alloc/std crates too in inference errors)
 - #95335 (Move resolve_path to rustc_builtin_macros and make it private)
 - #95340 (interpret: with enforce_number_validity, ensure integers are truly Scalar::Int (i.e., no pointers))
 - #95341 (ARMv6K Horizon OS has_thread_local support)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-27 04:20:07 +00:00
Dylan DPC
2ab4ad5f26
Rollup merge of #95341 - Meziu:armv6k-3ds-target, r=nagisa
ARMv6K Horizon OS has_thread_local support

cc. ```@ian-h-chamberlain```
cc. ```@AzureMarker```

Being an ARM target, it has always had built-in support for `#[thread_local]`. This PR comes in just now because we were testing `std::thread` support with `thread_local_dtor`s. This will hopefully be the last PR for the target specification, unless anymore features will be needed as time goes on.
2022-03-27 05:36:11 +02:00
Dylan DPC
178a09e672
Rollup merge of #95340 - RalfJung:pnvi, r=oli-obk
interpret: with enforce_number_validity, ensure integers are truly Scalar::Int (i.e., no pointers)

This is required for https://github.com/rust-lang/miri/pull/2040

r? ```@oli-obk```
2022-03-27 05:36:10 +02:00
Dylan DPC
979c8e885e
Rollup merge of #95335 - Badel2:resolve-path, r=Dylan-DPC
Move resolve_path to rustc_builtin_macros and make it private

Fixing a FIXME introduced by `@jyn514` in #85457
2022-03-27 05:36:09 +02:00
Dylan DPC
c6bb219fc4
Rollup merge of #93469 - compiler-errors:issue-93450, r=estebank
Skip pointing out ambiguous impls in alloc/std crates too in inference errors

This generalizes the logic in `annotate_source_of_ambiguity` to skip printing ambiguity errors traits in `alloc` and `std` as well, not just `core`.

While this does spot-fix the issue mentioned below, it would be nicer to generalize this logic, for example to detect when the trait predicate's `self_ty` has any numerical inference variables. Is it worthwhile to scrap this solution for one like that?

Fixes #93450

r? `@estebank`
feel free to reassign
2022-03-27 05:36:08 +02:00
Dylan DPC
4435bb0704
Rollup merge of #91981 - estebank:tweakaroo, r=lcnr
Recover suggestions and useful information lost in previous PR

Follow up to #91898.
2022-03-27 05:36:08 +02:00
Esteban Kuber
6874bd27f5 Provide suggestion for missing > in a type parameter list
When encountering an inproperly terminated type parameter list, provide
a suggestion to close it after the last non-constraint type parameter
that was successfully parsed.

Fix #94058.
2022-03-27 02:50:04 +00:00
Esteban Kuber
f479e262d6 review comments and rebase 2022-03-27 02:40:07 +00:00
Esteban Kuber
1db02b8a43 Change wording of missing return type suggestion 2022-03-27 02:20:17 +00:00
Esteban Kuber
b09420f95a Drive by: handle references in same_type_modulo_infer 2022-03-27 02:20:17 +00:00