Commit Graph

998 Commits

Author SHA1 Message Date
bors
53728ff751 Auto merge of #103185 - chenyukang:yukang/fix-span-next-point, r=davidtwco
Fix the bug of next_point in source_map

There is a bug in `next_point`, the new span won't move to next position when be called in the first time.

For this reason, our current code is working like this:
1. When we really want to move to the next position, we called two times of `next_point`
2. Some code which use `next_point` actually done the same thing with `shrink_to_hi`

This fix make sure when `next_point` is called, span will move with the width at least 1, and also work correctly in the scenario of multiple bytes.

Ref: https://github.com/rust-lang/rust/pull/103140#discussion_r997710998

r? `@davidtwco`
2022-10-20 10:40:09 +00:00
Dylan DPC
32159e3fa4
Rollup merge of #103216 - cjgillot:issue-103210, r=jackh726
Consider patterns in fn params in an `Elided(Infer)` lifetime rib.

Fixes https://github.com/rust-lang/rust/issues/103210
2022-10-19 14:05:54 +05:30
Camille GILLOT
9c3bf4de55 Consider patterns in fn params in an Elided(Infer) lifetime rib. 2022-10-18 21:25:38 +00:00
yukang
0af255a5aa Fix the bug of next_point in span 2022-10-18 02:59:38 +08:00
bors
1536ab1b38 Auto merge of #103096 - petrochenkov:indresdoc, r=cjgillot
resolve: Shadow erroneous glob imports with erroneous single imports

If such shadowing doesn't happen we end up in a weird state that may cause ICEs.
(In non-erroneous cases single imports always shadow glob imports too.)

Fixes https://github.com/rust-lang/rust/issues/100047
Fixes https://github.com/rust-lang/rust/issues/100241
2022-10-17 02:06:25 +00:00
bors
b8b5caee04 Auto merge of #102026 - Bryanskiy:resolve_update, r=petrochenkov
Populate effective visibilities in 'rustc_resolve'

Next part of RFC https://github.com/rust-lang/rust/issues/48054.
previous: https://github.com/rust-lang/rust/pull/101713

`@rustbot` author
r? `@petrochenkov`
2022-10-16 20:34:38 +00:00
Bryanskiy
496ccd982c Populate effective visibilities in 'rustc_resolve' 2022-10-16 21:47:14 +03:00
Vadim Petrochenkov
f767f2297d resolve: Shadow erroneous glob imports with erroneous single imports 2022-10-16 00:10:16 +04:00
Dylan DPC
39ff2a60d6
Rollup merge of #102884 - petrochenkov:liferib, r=cjgillot
resolve: Some cleanup, asserts and tests for lifetime ribs

Follow up to https://github.com/rust-lang/rust/pull/98279 and friends.
r? ``@cjgillot``
2022-10-15 15:45:31 +05:30
Dylan DPC
77064b7f0a
Rollup merge of #103018 - Rageking8:more-dupe-word-typos, r=TaKO8Ki
More dupe word typos

I only picked those changes (from the regex search) that I am pretty certain doesn't change meaning and is just a typo fix. Do correct me if any fix is undesirable and I can revert those. Thanks.
2022-10-14 16:19:15 +05:30
Rageking8
7122abaddf more dupe word typos 2022-10-14 12:57:56 +08:00
Dylan DPC
48f950c527
Rollup merge of #102956 - TaKO8Ki:fix-102946, r=fee1-dead
Use `full_res` instead of `expect_full_res`

Fixes #102946
Fixes #102978
2022-10-13 18:19:21 +05:30
Vadim Petrochenkov
f634106591 resolve: Regroup lifetime rib kinds to account for their purpose 2022-10-13 13:32:24 +04:00
Vadim Petrochenkov
e94ec30dc4 resolve: Remove redundant item lifetime ribs
and cleanup lifetime rib walking loops
2022-10-13 13:32:24 +04:00
Vadim Petrochenkov
e8a6e60c5d resolve: Add some asserts for unexpected lifetime rib combinations 2022-10-13 13:32:24 +04:00
Takayuki Maeda
b11dddd1c1 fix #102946 2022-10-12 19:03:46 +09:00
Dylan DPC
252ce10bb0
Rollup merge of #102913 - SparrowLii:import-candidate, r=compiler-errors
unify `IsPattern` and `IsImport` enum in `show_candidates`

Follow-up of #102876
A binding cannot appear in both pattern and import at the same time, so it makes sense to unify them
r? `@compiler-errors`
2022-10-12 11:11:26 +05:30
SparrowLii
a7f58af9fe unify IsPattern and IsImport enum 2022-10-12 08:46:52 +08:00
Matthias Krüger
cb67283392
Rollup merge of #102889 - petrochenkov:partres, r=cjgillot
rustc_hir: Less error-prone methods for accessing `PartialRes` resolution
2022-10-11 18:59:50 +02:00
Matthias Krüger
6d58ff7fe6
Rollup merge of #100387 - cjgillot:hygiene-trait-impl, r=petrochenkov
Check uniqueness of impl items by trait item when applicable.

When checking uniqueness of item names in impl blocks, we currently use the same definition of hygiene as for toplevel items.  This means that a plain item and one generated by a macro 2.0 do not collide.

This hygiene rule does not match with how impl items resolve to associated trait items. As a consequence, we misdiagnose the trait impls.

This PR proposes to consider that trait impl items are uses of the corresponding trait items during resolution, instead of checking for duplicates later. An error is emitted when a trait impl item is used twice.

There should be no stable breakage, since macros 2.0 are still unstable.

r? ``@petrochenkov``
cc ``@RalfJung``

Fixes https://github.com/rust-lang/rust/issues/71614.
2022-10-11 18:59:45 +02:00
Yuki Okushi
98764c0c72
Rollup merge of #102859 - cjgillot:collect-lifetimes, r=oli-obk
Move lifetime resolution module to rustc_hir_analysis.

Now that lifetime resolution has been removed from it, this file has nothing to do in `rustc_resolve`.  It's purpose is to compute Debruijn indices for lifetimes, so let's put it in type collection.
2022-10-11 18:37:55 +09:00
Camille GILLOT
152cd63226 Report duplicate definitions in trait impls during resolution. 2022-10-11 06:24:51 +00:00
Vadim Petrochenkov
1a8f177772 rustc_hir: Less error-prone methods for accessing PartialRes resolution 2022-10-11 09:04:52 +04:00
Matthias Krüger
0bd1cba98b
Rollup merge of #102876 - SparrowLii:import-candidate, r=fee1-dead
suggest candidates for unresolved import

Currently we prompt suggestion of candidates(help notes of `use xxx::yyy`) for names which cannot be resolved, but we don't do that for import statements themselves that couldn't be resolved. It seems reasonable to add candidate help information for these statements as well.
Fixes #102711
2022-10-10 20:47:34 +02:00
Camille GILLOT
a474ec50b7 Move lifetime resolution module to rustc_hir_analysis. 2022-10-10 17:40:52 +00:00
Dylan DPC
81b9d0b1d1
Rollup merge of #102868 - compiler-errors:rename-assoc-tyalias-to-ty, r=TaKO8Ki
Rename `AssocItemKind::TyAlias` to `AssocItemKind::Type`

Thanks `@camsteffen` for catching this in ast too, cc https://github.com/rust-lang/rust/pull/102829#issuecomment-1272649247
2022-10-10 13:43:43 +05:30
SparrowLii
0571b0af65 suggest candidates for unresolved import 2022-10-10 11:14:32 +08:00
Michael Goulet
d3bd6beb97 Rename AssocItemKind::TyAlias to AssocItemKind::Type 2022-10-10 02:31:37 +00:00
Yuki Okushi
0db05f16c8
Rollup merge of #102323 - Stoozy:master, r=cjgillot
Trying to suggest additional lifetime parameter

``@cjgillot`` This is what I have so far for #100615
2022-10-10 10:23:04 +09:00
Yuki Okushi
24424d0acb
Rollup merge of #102829 - compiler-errors:rename-impl-item-kind, r=TaKO8Ki
rename `ImplItemKind::TyAlias` to `ImplItemKind::Type`

The naming of this variant seems inconsistent given that this is not really a "type alias", and the associated type variant for `TraitItemKind` is just called `Type`.
2022-10-10 00:09:42 +09:00
Michael Goulet
70f3c79c50 ImplItemKind::TyAlias => ImplItemKind::Type 2022-10-09 07:09:57 +00:00
bors
4bd30785eb Auto merge of #102726 - matthiaskrgr:rollup-2ghn38b, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #102672 (rustdoc: remove unused CSS class `in-band`)
 - #102693 (Revert "Use getentropy when possible on all Apple platforms")
 - #102694 (Suggest calling method if fn does not exist)
 - #102708 (Suggest `==` to wrong assign expr)
 - #102710 (Add test for issue 82633)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-06 05:58:27 +00:00
bors
0152393048 Auto merge of #99324 - reez12g:issue-99144, r=jyn514
Enable doctests in compiler/ crates

Helps with https://github.com/rust-lang/rust/issues/99144
2022-10-06 03:01:57 +00:00
Michael Goulet
66c8c5ad1d Delay function resolution error until typeck 2022-10-05 06:42:35 +00:00
stoozy
2657f9d5da Removed unnecessary for loop 2022-10-01 13:55:26 -04:00
Matthias Krüger
05b9f0e360
Rollup merge of #102483 - spastorino:create-defs-on-lowering, r=cjgillot
create def ids for impl traits during ast lowering

r? `@cjgillot`
2022-09-30 23:38:25 +02:00
Santiago Pastorino
b2bef02bcd
create def ids for impl traits during ast lowering 2022-09-30 15:12:01 -03:00
bors
1bb8d276c9 Auto merge of #101887 - nnethercote:shrink-Res, r=spastorino
Shrink `hir::def::Res`

r? `@spastorino`
2022-09-29 22:45:24 +00:00
stoozy
ef930a2200 Emitting error regardless of new param suggestion 2022-09-29 04:06:02 -04:00
reez12g
9a4c5abe45 Remove from compiler/ crates 2022-09-29 16:49:04 +09:00
Yuki Okushi
852a152206
Rollup merge of #102085 - chenyukang:code-refactor, r=cjgillot
Code refactoring smart_resolve_report_errors

`smart_resolve_report_errors` 4ecfdfac51/compiler/rustc_resolve/src/late/diagnostics.rs (L143)
is almost 600 lines of code, we should do some code refactoring.
2022-09-29 11:42:03 +09:00
Nicholas Nethercote
f07d4efc45 Shrink hir::def::Res.
`Res::SelfTy` currently has two `Option`s. When the second one is `Some`
the first one is never consulted. So we can split it into two variants,
`Res::SelfTyParam` and `Res::SelfTyAlias`, reducing the size of `Res`
from 24 bytes to 12. This then shrinks `hir::Path` and
`hir::PathSegment`, which are the HIR types that take up the most space.
2022-09-29 08:44:52 +10:00
Nicholas Nethercote
5f29a13a5b Change the "dummy self type".
Because this is the only occurrence of a `Res::SelfTy` with `None` and
`None` fields, and the next commit will rely on those not being present.
2022-09-29 06:57:53 +10:00
stoozy
e7cb6ad8ce Proper span for new generic param suggestion 2022-09-28 00:33:52 -04:00
Camille GILLOT
337a73da6e Do not overwrite binders for another HirId. 2022-09-27 18:58:37 +02:00
stoozy
24c8e27a1d Properly formatting the multipart suggestion 2022-09-27 11:06:51 -04:00
lcnr
1fc86a63f4 rustc_typeck to rustc_hir_analysis 2022-09-27 10:37:23 +02:00
stoozy
365457bd25 Using multipart suggestion 2022-09-26 22:17:47 -04:00
stoozy
887515af33 Trying to suggest additional lifetime parameter 2022-09-26 13:10:24 -04:00
Pietro Albini
3975d55d98
remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00