bors
653463731a
Auto merge of #95563 - dingxiangfei2009:dxf-rfc66-refactor, r=nikomatsakis
...
Move the extended lifetime resolution into typeck context
Related to #15023
This PR is based on the [idea](https://github.com/rust-lang/rust/issues/15023#issuecomment-1070931433 ) of #15023 by `@nikomatsakis.`
This PR specifically proposes to
- Delay the resolution of scopes of rvalues to a later stage, so that enough type information is available to refine those scopes based on relationships of lifetimes.
- Highlight relevant parts that would help future reviews on the next installments of works to fully implement a solution to RFC 66.
2022-05-22 09:00:30 +00:00
Ding Xiang Fei
6044fbe462
factor out the rvalue lifetime rule
...
remove region_scope_tree from RegionCtxt
Apply suggestions from code review
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2022-05-22 16:46:50 +08:00
bors
acfd327fd4
Auto merge of #97177 - oli-obk:const-stability, r=davidtwco
...
Implement proper stability check for const impl Trait, fall back to unstable const when undeclared
Continuation of #93960
`@jhpratt` it looks to me like the test was simply not testing for the failure you were looking for? Your checks actually do the right thing for const traits?
2022-05-22 06:47:36 +00:00
Jacob Pratt
49c82f31a8
Remove crate
visibility usage in compiler
2022-05-20 20:04:54 -04:00
bors
536020c5f9
Auto merge of #97224 - matthiaskrgr:rollup-it5nw68, r=matthiaskrgr
...
Rollup of 7 pull requests
Successful merges:
- #97109 (Fix misleading `cannot infer type for type parameter` error)
- #97187 (Reverse condition in Vec::retain_mut doctest)
- #97201 (Fix typo)
- #97203 (Minor tweaks to rustc book summary formatting.)
- #97208 (Do not emit the lint `unused_attributes` for *inherent* `#[doc(hidden)]` associated items)
- #97215 (Add complexity estimation of iterating over HashSet and HashMap)
- #97220 (Add regression test for#81827)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-20 18:21:26 +00:00
Camille GILLOT
5953c57f27
Introduce LifetimeCtxt.
2022-05-20 12:25:05 +02:00
León Orell Valerian Liehr
e7252739cd
Do not warn on inherent doc(hidden) assoc items
2022-05-20 10:19:23 +02:00
Oli Scherer
cf5a803600
Rebase fallout
2022-05-19 12:26:06 +00:00
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