Commit Graph

902 Commits

Author SHA1 Message Date
bors
0631ea5d73 Auto merge of #101183 - Dylan-DPC:rollup-6kewixv, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #95376 (Add `vec::Drain{,Filter}::keep_rest`)
 - #100092 (Fall back when relating two opaques by substs in MIR typeck)
 - #101019 (Suggest returning closure as `impl Fn`)
 - #101022 (Erase late bound regions before comparing types in `suggest_dereferences`)
 - #101101 (interpret: make read-pointer-as-bytes a CTFE-only error with extra information)
 - #101123 (Remove `register_attr` feature)
 - #101175 (Don't --bless in pre-push hook)
 - #101176 (rustdoc: remove unused CSS selectors for `.table-display`)
 - #101180 (Add another MaybeUninit array test with const)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-30 08:29:42 +00:00
Dylan DPC
c18292f6a3
Rollup merge of #101123 - JohnTitor:rm-register-attr, r=TaKO8Ki
Remove `register_attr` feature

Closes #66080

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-08-30 11:26:52 +05:30
bors
a0d07093f8 Auto merge of #100812 - Nilstrieb:revert-let-chains-nightly, r=Mark-Simulacrum
Revert let_chains stabilization

This is the revert against master, the beta revert was already done in #100538.

Bumps the stage0 compiler which already has it reverted.
2022-08-30 05:48:22 +00:00
Nilstrieb
d1ef8180f9 Revert let_chains stabilization
This reverts commit 3266460749.

This is the revert against master, the beta revert was already done in #100538.
2022-08-29 19:34:11 +02:00
Dylan DPC
5555e13a6e
Rollup merge of #99821 - cjgillot:ast-lifetimes-2, r=compiler-errors
Remove separate indexing of early-bound regions

~Based on https://github.com/rust-lang/rust/pull/99728.~

This PR copies some modifications from https://github.com/rust-lang/rust/pull/97839 around object lifetime defaults.
These modifications allow to stop counting generic parameters during lifetime resolution, and rely on the indexing given by `rustc_typeck::collect`.
2022-08-29 16:49:39 +05:30
bors
ce36e88256 Auto merge of #100497 - kadiwa4:remove_clone_into_iter, r=cjgillot
Avoid cloning a collection only to iterate over it

`@rustbot` label: +C-cleanup
2022-08-28 18:31:08 +00:00
Yuki Okushi
76dd5c58a0
Remove register_attr feature
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-08-28 21:23:23 +09:00
Vadim Petrochenkov
fc3f3c304b rustc_middle: Remove Visibility::Invisible 2022-08-27 22:34:18 +03:00
Michael Goulet
54744601bf
Rollup merge of #100817 - vincenzopalazzo:macros/bool_spelling_sugg, r=davidtwco
sugg: suggest the usage of boolean value when there is a typo in the keyword

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

This adds a new suggestion when there is a well-known typo

With the following program

```rust
fn main() {
    let x = True;
}
```

Now we have the following suggestion

```
error[E0425]: cannot find value `True` in this scope
 --> test.rs:2:13
  |
2 |     let x = True;
  |             ^^^^ not found in this scope
  |
help: you may want to use a bool value instead
  |
2 |     let x = true;
  |             ~~~~

error: aborting due to previous error
```

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-08-26 15:56:26 -07:00
Matthias Krüger
1c0f60f904
Rollup merge of #100901 - TaKO8Ki:make-some-methods-private, r=sanxiyn
Make some methods private
2022-08-24 18:20:12 +02:00
Vincenzo Palazzo
69715c9033 sugg: suggest the usage of boolean value when there is a typo in the keyword
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-08-22 22:53:40 +00:00
Camille GILLOT
dff428013d Mark suggestion as MaybeIncorrect. 2022-08-23 00:09:58 +02:00
Camille GILLOT
da9ccc2c98 Remove FnItemRibKind. 2022-08-23 00:08:42 +02:00
Camille GILLOT
613dc2204d Improve local generic parameter suggestions. 2022-08-23 00:08:42 +02:00
Camille GILLOT
d7d701a9dc Create specific ConstantHasGenerics for ConstantItemRibKind. 2022-08-23 00:08:42 +02:00
Takayuki Maeda
000dc80221 make some methods private 2022-08-22 18:12:18 +09:00
Dylan DPC
769ad70129
Rollup merge of #100592 - cjgillot:debug-import-kind, r=TaKO8Ki
Manually implement Debug for ImportKind.

This avoids crashing due to an infinite loop when running with `RUSTC_LOG=rustc_resolve`.
2022-08-19 12:26:44 +05:30
Matthias Krüger
b295639f14
Rollup merge of #100643 - TaKO8Ki:point-at-type-parameter-shadowing-another-type, r=estebank
Point at a type parameter shadowing another type

This patch fixes a part of #97459.
2022-08-18 05:10:46 +02:00
Takayuki Maeda
1886aef035 point at a type parameter shadowing another type 2022-08-17 04:53:06 +09:00
Camille Gillot
611221d8ae
Update compiler/rustc_resolve/src/imports.rs 2022-08-15 20:51:32 +02:00
Camille GILLOT
4a5c46fb02 Manually implement Debug for ImportKind. 2022-08-15 18:29:43 +02:00
Michael Goulet
e248c7f9ae
Rollup merge of #100367 - fmease:fix-100365, r=compiler-errors
Suggest the path separator when a dot is used on a trait

Fixes #100365.

`@rustbot` label A-diagnostics
r? diagnostics
2022-08-13 21:06:49 -07:00
KaDiWa
4eebcb9910
avoid cloning and then iterating 2022-08-13 16:16:52 +02:00
Mark Rousskov
154a09dd91 Adjust cfgs 2022-08-12 16:28:15 -04:00
León Orell Valerian Liehr
0fb4ef6769 Suggest path separator when a dot is used on a trait 2022-08-11 23:09:39 +02:00
Matthias Krüger
8237efc52d
Rollup merge of #100392 - nnethercote:simplify-visitors, r=cjgillot
Simplify visitors

By removing some unused arguments.

r? `@cjgillot`
2022-08-11 22:53:08 +02:00
Dylan DPC
b5f5bdce87
Rollup merge of #100351 - compiler-errors:diagnostic-convention, r=fee1-dead
Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder` unless needed

This seems to be the established convention (02ff9e0) when `DiagnosticBuilder` was first added. I am guilty of introducing some of these.
2022-08-11 22:47:03 +05:30
Nicholas Nethercote
232bd80130 Simplify rustc_ast::visit::Visitor::visit_poly_trait_ref.
It is passed an argument that is never used.
2022-08-11 11:10:01 +10:00
Camille GILLOT
9701845287 Do not consider method call receiver as an argument in AST. 2022-08-10 18:34:54 +02:00
Michael Goulet
a2b6744af0 Use &mut Diagnostic instead of &mut DiagnosticBuilder unless needed 2022-08-10 03:45:42 +00:00
Dylan DPC
fac84e8bb6
Rollup merge of #100228 - luqmana:suggestion-ice, r=estebank
Don't ICE while suggesting updating item path.

When an item isn't found, we may suggest an appropriate import to `use`. Along with that, we also suggest updating the path to work with the `use`. Unfortunately, if the code in question originates from a macro, the span used to indicate which part of the path needs updating may not be suitable and cause an ICE (*). Since, such code is not adjustable directly by the user without modifying the macro, just skip the suggestion in such cases.

(*) The ICE happens because the emitter want to indicate to the user what code to delete by referencing a certain span. But in this case, said span has `lo == hi == 0` which means it thinks it's a dummy span. Adding a space before the proc macro attribute is enough to stop it from ICE'ing but even then the suggestion doesn't really make any sense:
```
help: if you import `DataStore`, refer to it directly
  |
1 -  #[dbstruct::dbstruct]
1 +  #[dbstruct::dbstruct]
```

Since suggestions are best-effort, I just gated this one on `can_be_used_for_suggestions` which catches cases like this.

Fixes #100199
2022-08-09 17:34:55 +05:30
Camille GILLOT
f6af4efec5 Use start_point instead of next_point to point to elided lifetime ampersand. 2022-08-07 14:35:11 +02:00
Luqman Aden
fc83a0cb57 Don't ICE while suggesting updating item path.
When an item isn't found, we may suggest an appropriate import to
`use`. Along with that, we also suggest updating the path to work
with the `use`. Unfortunately, if the code in question originates
from a macro, the span used to indicate which part of the path
needs updating may not be suitable and cause an ICE. Since, such
code is not adjustable directly by the user without modifying the
macro, just skip the suggestion in such cases.
2022-08-07 04:03:28 -07:00
Santiago Pastorino
c0923c8934
Add docs to generics_def_id_map 2022-08-04 11:27:03 -03:00
Santiago Pastorino
1d6cebfd6b
Implement def_id based remapping 2022-08-04 11:26:57 -03:00
bors
6f18f0a9d4 Auto merge of #99953 - cjgillot:in-path-always, r=petrochenkov
Always create elided lifetimes, even if inferred.

`PathSource` gives the context in which a path is encountered.  The same `PathSource` is used for the full path and the `QSelf` part.

Therefore, we can only rely on `PathSource` to know whether typechecking will be able to infer the lifetimes, not whether we need to insert them at all.

Fixes https://github.com/rust-lang/rust/issues/99949
2022-08-04 10:21:40 +00:00
Camille GILLOT
c95ff1d52b Assert index sanity. 2022-08-03 18:44:19 +02:00
Camille GILLOT
a424090252 Simplify debugging. 2022-08-03 18:44:19 +02:00
Camille GILLOT
48bae9360f Use DefIdTree instead of open-coding it. 2022-08-03 18:44:18 +02:00
Camille GILLOT
421bb6ac62 Remove index from Region::EarlyBound. 2022-08-03 18:44:18 +02:00
Camille GILLOT
99e2d33315 Compute object_lifetime_default per parameter. 2022-08-03 18:42:04 +02:00
Camille GILLOT
236ccce79e Create a specific ObjectLifetimeDefault enum. 2022-08-03 18:42:03 +02:00
Camille GILLOT
39bc74e8b8 Make object_lifetime_defaults a cross-crate query. 2022-08-03 18:32:21 +02:00
Camille GILLOT
ec3f3074a1 Always create elided lifetimes, even if inferred. 2022-07-30 17:58:26 +02:00
Camille GILLOT
6733bc3066 Remove guess_head_span. 2022-07-28 23:14:04 +02:00
Takayuki Maeda
089471b129 change the type of note field to Option<String> 2022-07-28 18:17:55 +09:00
Guillaume Gomez
c37ee1a7e0
Rollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkov
Clean up HIR-based lifetime resolution

Based on https://github.com/rust-lang/rust/pull/97313.

Fixes #98932.

r? `@petrochenkov`
2022-07-27 17:55:07 +02:00
Camille GILLOT
4b2f06b8a9 Pacify tidy. 2022-07-26 19:00:31 +02:00
Camille GILLOT
556b02704f Stop creating anonymous late lifetimes. 2022-07-26 19:00:31 +02:00
Camille GILLOT
ad1b1819eb Remove resolve_elided_lifetimes. 2022-07-26 19:00:31 +02:00