215115 Commits

Author SHA1 Message Date
bors
fb9dfa8cef Auto merge of #84762 - cjgillot:resolve-span-opt, r=petrochenkov
Encode spans relative to the enclosing item -- enable on nightly

Follow-up to #84373 with the flag `-Zincremental-relative-spans` set by default.

This PR seeks to remove one of the main shortcomings of incremental: the handling of spans.
Changing the contents of a function may require redoing part of the compilation process for another function in another file because of span information is changed.
Within one file: all the spans in HIR change, so typechecking had to be re-done.
Between files: spans of associated types/consts/functions change, so type-based resolution needs to be re-done (hygiene information is stored in the span).

The flag `-Zincremental-relative-spans` encodes local spans relative to the span of an item, stored inside the `source_span` query.

Trap: stashed diagnostics are referenced by the "raw" span, so stealing them requires to remove the span's parent.

In order to avoid too much traffic in the span interner, span encoding uses the `ctxt_or_tag` field to encode:
- the parent when the `SyntaxContext` is 0;
- the `SyntaxContext` when the parent is `None`.
Even with this, the PR creates a lot of traffic to the Span interner, when a Span has both a LocalDefId parent and a non-root SyntaxContext. They appear in lowering, when we add a parent to all spans, including those which come from macros, and during inlining when we mark inlined spans.

The last commit changes how queries of `LocalDefId` manage their cache. I can put this in a separate PR if required.

Possible future directions:
- validate that all spans are marked in HIR validation;
- mark macro-expanded spans relative to the def-site and not the use-site.
2023-01-02 13:10:16 +00:00
bors
790759fb11 Auto merge of #13854 - lowr:fix/mbe-glue-punct, r=Veykril
Support multi-character punct tokens in MBE

Fixes #11497

In the context of MBE, consecutive puncts are parsed as multi-character punct tokens whenever possible. For example, `:::` is parsed as ``[Punct(`::`), Punct(`:`)]`` and shouldn't get matched to patterns like `: : :` or `: ::`.

We have implemented this behavior only for when we match puncts against `tt` fragments, but not when we match puncts literally. This PR extracts the multi-character punct handling procedure into a separate method and extends its support for literal matching.

For good measure, this PR adds support for `<-` token, which is still [considered as one token in rustc](e396186407/compiler/rustc_ast/src/token.rs (L249)) despite the placement syntax having been removed.
2023-01-02 13:07:42 +00:00
bors
e986de0b28 Auto merge of #13877 - lowr:fix/find-path-prefix-shadowed-prelude, r=Veykril
fix: prefix prelude items whose name collides in current scope

Fixes #13873

When we assemble path for prelude items whose name collides with other item in scope, we should always prefix it with module paths.
2023-01-02 12:11:30 +00:00
Ryo Yoshida
cf2fa14db5
fix: prefix prelude items whose name collides in current scope 2023-01-02 20:50:45 +09:00
clubby789
537c7f4fa9 Print correct base for too-large literals
Also update tests
2023-01-02 11:43:07 +00:00
gimbles
f8755ab864 maybe 2023-01-02 16:53:43 +05:30
Guillaume Gomez
3919b71b48 Fix rustdoc ICE on bad typedef with mismatching types 2023-01-02 11:47:36 +01:00
Gimbles
32ab2d95f1
Update format.rs 2023-01-02 15:51:54 +05:30
bors
f89003eda8 Auto merge of #106301 - notriddle:notriddle/dir-entry, r=GuillaumeGomez
rustdoc: use the regular arrow indicator for dir-entry CSS

This mostly reverts 468acca108e65101b802821bded17149dc1d86c9, while still fixing the problem it fixed by using an internal list-style-position. It results in a slight change in the hover indicator, but nothing misleading.

Preview: http://notriddle.com/notriddle-rustdoc-demos/dir-entry/src/std/lib.rs.html

## Before

![image](https://user-images.githubusercontent.com/1593513/210104247-642e6df0-07d3-452a-a2ab-4c700bc22e0e.png)

## After

![image](https://user-images.githubusercontent.com/1593513/210104271-a3832784-1e4d-4516-983e-6ecb9051857b.png)
2023-01-02 10:21:53 +00:00
bors
d5a7ddd99f Auto merge of #106284 - estebank:merge-mut-errors, r=jyn514
Merge multiple mutable borrows of immutable binding errors

Fix #53466.
2023-01-02 07:30:23 +00:00
Jakob Degen
ee6503a706 Reenable limited top-down MIR inlining 2023-01-01 22:01:29 -08:00
Esteban Küber
545406528a Verbose suggestions 2023-01-01 21:33:23 -08:00
bors
c5cb156caa Auto merge of #106358 - TroyNeubauer:improve-foreign-orphan-error, r=estebank
Implement fix for #67535

Implements a fix for #67535
r? `@estebank`
2023-01-02 04:32:39 +00:00
Ben Kimock
82f0973dd5 Always take advantage of arithmetic identities 2023-01-01 23:12:29 -05:00
clubby789
cafdd2f7bb Note maximum integer literal for IntLiteralTooLarge 2023-01-02 03:52:29 +00:00
Eric Wu
01a2a9df43 [drop_ref]: don't lint idiomatic in match arm 2023-01-01 22:33:18 -05:00
Ezra Shaw
b7341db5d8
fix CI 2023-01-02 16:22:18 +13:00
Ezra Shaw
1f1dd5f3cc
pattern destructure has_test
Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
2023-01-02 16:14:21 +13:00
Michael Howell
399fe5d0cd rustdoc: add test case for dir entry summary position 2023-01-01 19:52:30 -07:00
Eric Wu
8de011fdf7 don't lint field_reassign when field in closure
This commit makes the ContainsName struct visit all interior
expressions, which means that ContainsName will return true
even if `name` is used in a closure within `expr`.
2023-01-01 21:41:46 -05:00
Troy Neubauer
4cb9030a66
Implement fix for #67535 2023-01-01 18:26:28 -08:00
bors
ee11bfd8a1 Auto merge of #106352 - kornelski:read_line-doc, r=scottmcm
Document read_line gotchas

1. The "You do not need to clear the buffer before appending" advice is ambiguous, because it depends what you use this function for. For a rather common case of reading individual lines in a loop, it _is_ necessary to clear the buffer.

2. The docs warn about a DoS risk. I've added a hint how to mitigate unbounded memory growth.
2023-01-02 01:15:25 +00:00
yukang
93e62a4bf6 resolve merge conflict 2023-01-02 09:14:18 +08:00
yukang
74cdf93307 code refactor report_method_error 2023-01-02 09:14:15 +08:00
Joshua Nelson
beefcf8854 Cleanup mingw-tidy docker job
- Avoid `/checkout/src/ci/run.sh: line 187: [: =: unary operator expected`: https://github.com/rust-lang/rust/actions/runs/3809902408/jobs/6481611301#step:26:1701
- Avoid running `x check` in the tidy test, to get faster feedback. It's
  already run on the normal `mingw-check` job.
2023-01-01 21:44:18 +00:00
bors
e11cb36c75 Auto merge of #106349 - LeSeulArtichaut:dyn-star-tracking-issue, r=jackh726
Use the correct tracking issue for `dyn_star`

`#![feature(dyn_star)]` now has its own tracking issue, #102425.
2023-01-01 21:41:35 +00:00
J Haigh
9aebb1e099
improve error message
Co-authored-by: Joshua Nelson <github@jyn.dev>
2023-01-01 14:36:51 -07:00
J Haigh
e62258ebf4
fix typo
Co-authored-by: Joshua Nelson <github@jyn.dev>
2023-01-01 14:36:11 -07:00
DebugSteven
d7cac976dc combine error branches 2023-01-01 14:34:40 -07:00
Ezra Shaw
fafb18e0c4
fixup warnings 2023-01-02 09:44:10 +13:00
DebugSteven
e94354e363 fix formatting 2023-01-01 13:41:47 -07:00
Ezra Shaw
def1b7cb9a
fix CI error 2023-01-02 09:20:41 +13:00
DebugSteven
5e67ce6803 handle error case where --wrapper-version argument doesn't exist 2023-01-01 13:20:32 -07:00
Ezra Shaw
24671b7fd5
use more paths in error codes 2023-01-02 09:15:36 +13:00
Ezra Shaw
9618f646b3
docs: revert removal of E0729 2023-01-02 09:11:36 +13:00
Nixon Enraght-Moony
cca5d219e6 Rustdoc-Json: Report discriminant on all kinds of enum variant.
Closes #106299
2023-01-01 19:48:26 +00:00
Léo Lanteri Thauvin
6289fe2cf1 Use the correct tracking issue for dyn_star 2023-01-01 19:56:10 +01:00
LegionMammal978
ce28b4d408 Deallocate ThinBox even if the value unwinds on drop 2023-01-01 13:48:18 -05:00
Laurențiu Nicola
34bc240e94 Package release artifacts as ZIP 2023-01-01 20:45:08 +02:00
bors
77429957a0 Auto merge of #106350 - GuillaumeGomez:gui-test-explanation-2, r=notriddle
Add comment explaining what docblock-table GUI test is about

r? `@notriddle`
2023-01-01 18:35:04 +00:00
Nixon Enraght-Moony
b7b252a4f4 clean: Always store enum disriminant. 2023-01-01 18:11:53 +00:00
Esteban Küber
5bfcfeee2a Merge multiple mutable borrows of immutable binding errors
Fix #53466.
2023-01-01 10:09:26 -08:00
Kornel
3a6ceeb18f Document a way to limit read_line length 2023-01-01 18:04:26 +00:00
Kornel
1a983536f3 Document read_line gotcha 2023-01-01 17:49:05 +00:00
Lukas Markeffsky
035d854947 reduce spans for unsafe impl errors 2023-01-01 18:48:57 +01:00
Guillaume Gomez
d14e63665e Add comment explaining what docblock-table GUI test is about 2023-01-01 17:21:59 +01:00
chansuke
6145194b68 chore: add simple comment for get_enclosing_block 2023-01-02 00:18:03 +09:00
chansuke
5b46f2db59 chore: fix identation of if_chain in filter_map 2023-01-02 00:17:52 +09:00
bors
a85e480dd1 Auto merge of #10110 - Niki4tap:needless_anyhow_return, r=Alexendoo
Fix FN in `needless_return`

Fixes #10051

changelog: Enhancement: [`needless_return`]: Now detects more cases for returns of owned values
[#10110](https://github.com/rust-lang/rust-clippy/pull/10110)
<!-- changelog_checked -->
2023-01-01 13:55:29 +00:00
bors
643bc02ded Auto merge of #13875 - Veykril:private-field-diag, r=Veykril
Diagnose private assoc item accesses
2023-01-01 12:25:27 +00:00