Commit Graph

592 Commits

Author SHA1 Message Date
Jacob Pratt
5ff331142e Move check to existing pass
This alters the diagnostics a bit, as the trait method is still stable.
The only thing this check does is ensure that compilation fails if a
trait implementation is declared const-stable.
2022-05-19 12:21:45 +00:00
Jacob Pratt
f0620c9503 Proper const stability check, default to unstable
Rather than deferring to const eval for checking if a trait is const, we
now check up-front. This allows the error to be emitted earlier, notably
at the same time as other stability checks.

Also included in this commit is a change of the default const stability
level to UNstable. Previously, an item that was `const` but did not
explicitly state it was unstable was implicitly stable.
2022-05-19 12:21:45 +00:00
Jacob Pratt
a9dd4cfa6b Add and use stability helper methods
This avoids an ambiguity (when reading) where `.level.is_stable()` is
not immediately clear whether it is general stability or const
stability.
2022-05-19 12:21:45 +00:00
bors
07ae142d77 Auto merge of #96863 - SparrowLii:let, r=michaelwoerister
use `hir::Let` in `hir::Guard::IfLet`

This PR fixes the FIXME about using `hir::Let` in `hir::Guard::IfLet`
2022-05-18 17:48:46 +00:00
bors
735efc0c70 Auto merge of #97012 - oli-obk:🦀_intrinsics, r=davidtwco
Add a query for checking whether a function is an intrinsic.

work towards #93145

This will reduce churn when we add more ways to declare intrinsics

r? `@scottmcm`
2022-05-17 09:39:26 +00:00
bors
7355d971a9 Auto merge of #96825 - kckeiks:remove-item-like-visitor-trait, r=cjgillot
Retire `ItemLikeVisitor` trait

Issue #95004
cc `@cjgillot`
2022-05-17 06:51:45 +00:00
Oli Scherer
0a6b69106e Add a query for checking whether a function is an intrinsic. 2022-05-16 07:07:44 +00:00
Vadim Petrochenkov
4fa24bcb54 rustc: Stricter checking for #[link] attributes 2022-05-15 02:45:47 +03:00
Miguel Guarniz
48fd66613b allocate string only when error will be emitted
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-14 12:23:23 -04:00
Miguel Guarniz
f77658b470 use opt_item_name to pattern match items with names
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-14 11:02:14 -04:00
Miguel Guarniz
959636d531 avoid fetching HIR when handling Impl assoc items
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-14 11:01:33 -04:00
Miguel Guarniz
f1c256d168 remove redundant branch
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:06 -04:00
Miguel Guarniz
17e86d9ff9 remove unnecessary methods from HirIdValidator
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:06 -04:00
Miguel Guarniz
433a5f1144 avoid converting to DefId from LocalDefId when using query
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:06 -04:00
Miguel Guarniz
91223acde3 use for_each_module instead of iterating over Item's
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:06 -04:00
Miguel Guarniz
2e98879403 change back to using tcx.hir() visit-item method
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:06 -04:00
Miguel Guarniz
f975d05116 rename visit item-like methods
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:06 -04:00
Miguel Guarniz
93616dd539 remove ItemLikeVisitor and DeepVisitor
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:06 -04:00
Miguel Guarniz
0b7dd95475 remove HirVisitor
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:06 -04:00
Miguel Guarniz
885b90bb34 remove DebuggerVisualizerCollector
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:06 -04:00
Miguel Guarniz
eea16de9f7 replace hir().def_kind for def_kind query in rustc_passes
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:05 -04:00
Miguel Guarniz
90685c6333 check def_kind before fetching item
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:05 -04:00
Miguel Guarniz
0a029e2ed0 remove CollectPrivateImplItemsVisitor
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:05 -04:00
Miguel Guarniz
45c37da0f7 remove LayoutTest
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:05 -04:00
Miguel Guarniz
0ef16feb72 remove OuterVisitor
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:05 -04:00
Miguel Guarniz
b1f0209cd1 optimize find_item to fetch Item only when needed
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:05 -04:00
Miguel Guarniz
fb73ae2c8a remove ItemLikeVisitor impl for EntryContext
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:05 -04:00
Miguel Guarniz
dab0e75911 remove DiagnosticItemCollector
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:05 -04:00
Miguel Guarniz
52f833a254 remove LifeSeeder
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:05 -04:00
Miguel Guarniz
00260347e3 replace usage of visit_item_likes_in_modules with hir_module_items query
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:05 -04:00
Miguel Guarniz
bd2b210c59 Remove CheckConstTraitVisitor
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13 11:46:05 -04:00
lcnr
ebf95836e3 fix typo 2022-05-10 12:07:36 +02:00
lcnr
6c8265dc56 only_local: always check for misuse 2022-05-10 12:07:35 +02:00
bors
88860d5474 Auto merge of #96473 - lcnr:querify-codegen-fn-attrs, r=cjgillot
store `codegen_fn_attrs` in crate metadata

extracted from #95562 because the change isn't trivial.
2022-05-09 19:52:59 +00:00
lcnr
32b13ac928 review 2022-05-09 18:40:18 +02:00
lcnr
d371ebe117 only compute codegen_fn_attrs where needed 2022-05-09 18:40:18 +02:00
SparrowLii
5251a80c0a use hir::Let in hir::Guard 2022-05-09 20:35:58 +08:00
León Orell Valerian Liehr
9d157ada35 Warn on unused doc(hidden) on trait impl items 2022-05-08 22:53:14 +02:00
Miguel Guarniz
3afc5ea201 use def_span and def_kind queries instead of calling tcx.hir() methods
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-06 12:11:05 -04:00
bors
74cea9fdb9 Auto merge of #96520 - lcnr:general-incoherent-impls, r=petrochenkov
generalize "incoherent impls" impl for user defined types

To allow the move of `trait Error` into core.

continues the work from #94963, finishes https://github.com/rust-lang/compiler-team/issues/487

r? `@petrochenkov` cc `@yaahc`
2022-05-05 23:24:36 +00:00
lcnr
209dd2cb0a generalize "incoherent impls" impl for custom types 2022-05-05 10:53:00 +02:00
ridwanabdillahi
791bef5455 Cleanup broken doc links. 2022-05-04 17:17:57 -07:00
ridwanabdillahi
175a4eab84 Add support for a new attribute #[debugger_visualizer] to support embedding debugger visualizers into a generated PDB.
Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries.

Merge the queries for debugger visualizers into a single query.

Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`.

Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate.

Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature.

Respond to PR comments and minor cleanups.
2022-05-03 10:53:54 -07:00
Vadim Petrochenkov
5b5964f569 rustc: Panic by default in DefIdTree::parent
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root.
So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root.

Same applies to `local_parent`/`opt_local_parent`.
2022-05-02 01:56:50 +03:00
Camille GILLOT
71b4e2d852 Box HIR Generics and Impl. 2022-04-30 13:51:49 +02:00
bors
18b53cefdf Auto merge of #95604 - nbdd0121:used2, r=petrochenkov
Generate synthetic object file to ensure all exported and used symbols participate in the linking

Fix #50007 and #47384

This is the synthetic object file approach that I described in https://github.com/rust-lang/rust/pull/95363#issuecomment-1079932354, allowing all exported and used symbols to be linked while still allowing them to be GCed.

Related #93791, #95363

r? `@petrochenkov`
cc `@carbotaniuman`
2022-04-25 16:14:54 +00:00
bors
7417110cef Auto merge of #96246 - SparrowLii:bound_contxet, r=compiler-errors
Add `BoundKind` in `visit_param_bounds` to check questions in bounds

From the FIXME in the impl of `AstValidator`. Better bound checks by adding `BoundCtxt` type parameter to `visit_param_bound`

cc `@ecstatic-morse`
2022-04-25 10:46:58 +00:00
Camille GILLOT
423a712a16 Fix lints. 2022-04-23 23:01:19 +02:00
Camille GILLOT
4bbe078d92 Drop vis in Item. 2022-04-23 09:59:24 +02:00
Camille GILLOT
a62680d108 Drop vis in FieldDef. 2022-04-23 09:56:15 +02:00