Vadim Petrochenkov
aca1b1e0b3
rustc_interface: Add a new query pre_configure
...
It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early.
Crate-level cfg attributes are then expanded normally during the main expansion pass, like attributes on any other nodes.
2023-03-23 14:22:48 +04:00
bors
84dd6dfd9d
Auto merge of #109503 - matthiaskrgr:rollup-cnp7kdd, r=matthiaskrgr
...
Rollup of 9 pull requests
Successful merges:
- #108954 (rustdoc: handle generics better when matching notable traits)
- #109203 (refactor/feat: refactor identifier parsing a bit)
- #109213 (Eagerly intern and check CrateNum/StableCrateId collisions)
- #109358 (rustc: Remove unused `Session` argument from some attribute functions)
- #109359 (Update stdarch)
- #109378 (Remove Ty::is_region_ptr)
- #109423 (Use region-erased self type during IAT selection)
- #109447 (new solver cleanup + implement coherence)
- #109501 (make link clickable)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-23 07:01:03 +00:00
est31
edd7d4a9f7
More general captures
...
This avoids repetition
2023-03-22 15:39:24 +01:00
Vadim Petrochenkov
67a2c5bec8
rustc: Remove unused Session
argument from some attribute functions
2023-03-22 13:55:55 +04:00
Camille GILLOT
b7e2b049f3
Querify registered_tools.
2023-03-06 10:56:23 +00:00
Vadim Petrochenkov
d275114bda
resolve: Remove ImportResolver
...
It's a trivial wrapper over `Resolver` that doesn't bring any benefits
2023-02-22 21:29:38 +04:00
Oli Scherer
9fb91b8742
Remove a redundant function argument
2023-02-20 15:28:58 +00:00
Oli Scherer
d191de63f0
Prepare for adding a TyCtxt
to Resolver
2023-02-20 10:38:48 +00:00
Oli Scherer
43a5cc383d
Separate the lifetime of the session and the arena in the resolver
2023-02-14 10:01:25 +00:00
Vadim Petrochenkov
9080b79f2b
rustdoc: Eliminate remaining uses of resolver
2023-02-13 00:10:15 +04:00
Vadim Petrochenkov
b62b82aef4
Resolve documentation links in rustc and store the results in metadata
...
This commit implements MCP https://github.com/rust-lang/compiler-team/issues/584
It also removes code that is no longer used, and that includes code cloning resolver, so issue #83761 is fixed.
2023-02-10 09:34:13 +04:00
Oli Scherer
1c1d3570ee
Move the untracked cstore and source_span into a struct
2022-12-09 14:53:24 +00:00
Oli Scherer
2cd36f2c89
Generate crate loaders on the fly
2022-12-09 14:53:23 +00:00
Dylan DPC
4b0b89827d
Rollup merge of #102049 - fee1-dead-contrib:derive_const, r=oli-obk
...
Add the `#[derive_const]` attribute
Closes #102371 . This is a minimal patchset for the attribute to work. There are no restrictions on what traits this attribute applies to.
r? `````@oli-obk`````
2022-11-12 12:02:50 +05:30
yukang
f90bf50d47
fix span for suggestion
2022-10-20 11:55:30 +08:00
yukang
1225c3f6b8
fix #103112 , add diagnostic for calling a function with the same name when a Macro is not found
2022-10-20 11:55:30 +08:00
Vadim Petrochenkov
1a8f177772
rustc_hir: Less error-prone methods for accessing PartialRes
resolution
2022-10-11 09:04:52 +04:00
Deadbeef
a052f2cce1
Add the #[derive_const]
attribute
2022-09-20 11:57:58 +00:00
Dezhi Wu
b1430fb7ca
Fix a bunch of typo
...
This PR will fix some typos detected by [typos].
I only picked the ones I was sure were spelling errors to fix, mostly in
the comments.
[typos]: https://github.com/crate-ci/typos
2022-08-31 18:24:55 +08:00
Yuki Okushi
76dd5c58a0
Remove register_attr
feature
...
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-08-28 21:23:23 +09:00
klensy
b38c94857d
avoid embedding StabilityLevel::Unstable reason string into metadata multiple times
2022-07-21 22:53:02 +03:00
David Wood
224aec213d
middle: add implies_by
to #[unstable]
...
If part of a feature is stabilized and a new feature is added for the
remaining parts, then the `implied_by` attribute can be used to indicate
which now-stable feature previously contained a item. If the now-stable
feature is still active (if the user has only just updated rustc, for
example) then there will not be an stability error for uses of the item
from the implied feature.
Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-20 14:53:01 +01:00
Takayuki Maeda
a22934bea1
avoid Symbol
to &str
conversions
2022-07-18 14:25:34 +09:00
bors
3a8b0144c8
Auto merge of #98106 - cjgillot:split-definitions, r=michaelwoerister
...
Split up `Definitions` and `ResolverAstLowering`.
Split off https://github.com/rust-lang/rust/pull/95573
r? `@michaelwoerister`
2022-06-17 10:00:11 +00:00
Camille GILLOT
603746a35e
Make ResolverAstLowering a struct.
2022-06-14 22:44:27 +02:00
Takayuki Maeda
0d24405211
implement MacroData
2022-06-15 00:31:21 +09:00
est31
eb3c611e1d
Never regard macro rules with compile_error! invocations as unused
...
The very point of compile_error! is to never be reached, and one of
the use cases of the macro, currently also listed as examples in the
documentation of compile_error, is to create nicer errors for wrong
macro invocations. Thus, we shuuld never warn about unused macro arms
that contain invocations of compile_error.
2022-06-09 23:21:06 +02:00
Urgau
b76d1125d4
Conservatively report "not sure" in cfg_accessible
2022-06-03 11:31:11 +02:00
Urgau
163374644b
Handle more cases in cfg_accessible
2022-05-30 16:51:38 +02:00
Jacob Pratt
49c82f31a8
Remove crate
visibility usage in compiler
2022-05-20 20:04:54 -04:00
est31
0bd2232fe4
Implement the unused_macro_rules lint
2022-05-05 19:13:00 +02:00
Vadim Petrochenkov
f0e0434feb
resolve: Merge last_import_segment
into Finalize
2022-05-01 18:02:35 +03:00
Vadim Petrochenkov
ffedcec4e8
resolve: Pass full Finalize
in nearly all cases
2022-05-01 18:02:01 +03:00
Vadim Petrochenkov
900607f49a
resolve: Turn enum Finalize
into an optional struct
2022-05-01 17:42:22 +03:00
Camille GILLOT
24b37a7374
Pass last_import_segment and unusable_binding as parameters.
2022-04-12 19:51:46 +02:00
Camille GILLOT
e9a52c27d2
Move ident resolution to a dedicated module.
2022-04-12 19:49:02 +02:00
Yuri Astrakhan
5160f8f843
Spellchecking compiler comments
...
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30 15:14:15 -04:00
Vadim Petrochenkov
1ad64a23d4
resolve: Rename CrateLint
to Finalize
...
And `crate_lint`/`record_used` to `finalize`
2022-03-25 02:03:54 +03:00
Vadim Petrochenkov
74d079d566
resolve: Stop passing unused spans and node ids to path resolution functions
2022-03-25 02:03:54 +03:00
Vadim Petrochenkov
0749ec67bc
resolve: Do not build expensive suggestions if they are not actually used
...
Also remove a redundant parameter from `fn resolve_path(_with_ribs)`, `crate_lint: CrateLint` is a more detailed version of `record_used: bool` with `CrateLint::No` meaning `false` and anything else meaning `true`.
2022-03-25 02:03:54 +03:00
Vadim Petrochenkov
17b1afdbb2
resolve: Fix incorrect results of opt_def_kind
query for some built-in macros
...
Previously it always returned `MacroKind::Bang` while some of those macros are actually attributes and derives
2022-02-24 22:54:36 +03:00
Nicholas Nethercote
0c2ebbd412
Rename PtrKey
as Interned
and improve it.
...
In particular, there's now more protection against incorrect usage,
because you can only create one via `Interned::new_unchecked`, which
makes it more obvious that you must be careful.
There are also some tests.
2022-02-15 15:50:29 +11:00
Vadim Petrochenkov
51b2338611
rustc_lint: Reuse the set of registered tools from resolver
2022-01-23 18:51:51 +08:00
Nicholas Nethercote
b1c934ebb8
Remove unnecessary sigils around Ident::as_str()
calls.
2021-12-15 17:32:42 +11:00
Ken Matsui
57494f7c75
Suggestion to wrap inner types using allocator_api
in tuple
2021-11-24 00:24:13 +09:00
Marcel Hellwig
9f6ca7482c
Shorten Span of unused macro lints
...
The span has been recuded to the actual ident, instead of linting the
*whole* macro.
2021-11-11 08:04:02 +01:00
Alik Aslanyan
d98ac573a4
Remove visible path calculation from allowed deprecation lint
2021-09-30 15:15:10 +04:00
bors
60fe8b3a65
Auto merge of #87220 - petrochenkov:derivecfglimit2, r=Aaron1011
...
Make `#[derive(A, B, ...)]` cfg-eval its input only for `A, B, ...` and stabilize `feature(macro_attributes_in_derive_output)`
Stabilization report: https://github.com/rust-lang/rust/pull/87220#issuecomment-881923657
Closes #81119
r? `@Aaron1011`
2021-09-25 04:35:59 +00:00
Vadim Petrochenkov
85f02901a3
Stabilize feature(macro_attributes_in_derive_output)
2021-09-24 21:48:30 +03:00
Vadim Petrochenkov
ab834e5ea9
resolve: Refactor obtaining Module
from its DefId
...
The `Option<Module>` version is supported for the case where we don't know whether the `DefId` refers to a module or not.
Non-local traits and enums are also correctly found now.
2021-09-24 18:57:15 +03:00