-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Provide an extended framework for type visit, for use in rust-analyzer #149856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Some changes occurred in src/tools/cargo cc @ehuss |
This comment has been minimized.
This comment has been minimized.
dcbc91b to
8ed8db8
Compare
|
I'm going to nominate this. I have to catch up with all the discussion here, but this is tiny compared to everything I've seen and overall something I think we should land if it all works out. bikeshed, but I think a better name is |
|
Not hearing any concerns in the zulip thread #t-types/nominated > #149856: Provide an extended framework for type visit, for …. r=me for this after rename I suggested above r? me |
8ed8db8 to
5e263ba
Compare
|
@bors r=jackh726 |
|
@bors r- Forgot to rename the method. |
5e263ba to
fbbf06f
Compare
|
@bors r=jackh726 |
|
@bors r- |
rust-analyzer needs to be able to visit types when treating not only `Ty`, `Const`, `Region` and `Predicate` specifically, but *all* rust-analyzer-made types specifically (excluding e.g. `TraitRef`, that is declared in rustc_type_ir). This is needed to implement garbage collection. To support this, we introduce a second, rust-analyzer-only visit trait, named `GenericTypeVisitable`. It's simpler than `TypeVisitable` (for example, it does not have a trait for the visitor, and does not support early-returning) because this is what rust-analyzer needs, but its most distinguished feature is that the visitor is a generic of the *trait* instead of the *method*. This way, specific types can treat specific visitor types specifically and call their methods. In rustc_type_ir we implement it for a bunch of basic types, and using a derive macro for the rest. The macro and trait are completely disabled when compiling for rustc (`feature = "nightly"`), so not even a compile time penalty will be paid.
fbbf06f to
bb6d936
Compare
|
@bors r=jackh726 |
… r=jackh726 Provide an extended framework for type visit, for use in rust-analyzer rust-analyzer needs to be able to visit types when treating not only `Ty`, `Const`, `Region` and `Predicate` specifically, but *all* rust-analyzer-made types specifically (excluding e.g. `TraitRef`, that is declared in rustc_type_ir). This is needed to implement garbage collection. To support this, we introduce a second, rust-analyzer-only visit trait, named, without much thought, `CustomizableTypeVisitable`. It's simpler than `TypeVisitable` (for example, it does not have a trait for the visitor, and does not support early-returning) because this is what rust-analyzer needs, but its most distinguished feature is that the visitor is a generic of the *trait* instead of the *method*. This way, specific types can treat specific visitor types specifically and call their methods. In rustc_type_ir we implement it for a bunch of basic types, and using a derive macro for the rest. The macro and trait are completely disabled when compiling for rustc (`feature = "nightly"`), so not even a compile time penalty will be paid. r? types This is a replacement to other efforts to support non-`Copy` type in the solver, replacing them with a GC in r-a, as decided by `@rust-lang/rust-analyzer.` The code is tiny in comparison, and I believe T-types will have no problem maintaining it, which mostly means adding the derive on new things when they are added and things break on the r-a side.
Rollup of 14 pull requests Successful merges: - #148756 (Warn on codegen attributes on required trait methods) - #148790 (Add new Tier-3 target: riscv64im-unknown-none-elf) - #149271 (feat: dlopen Enzyme) - #149459 (std: sys: fs: uefi: Implement set_times and set_perm) - #149771 (bootstrap readme: make easy to read when editor wrapping is not enabled) - #149856 (Provide an extended framework for type visit, for use in rust-analyzer) - #149950 (Simplify how inline asm handles `MaybeUninit`) - #150014 (Metadata loader cleanups) - #150021 (document that mpmc channels deliver an item to (at most) one receiver) - #150022 (Generate macro expansion for rust compiler crates docs) - #150029 (Update books) - #150031 (assert impossible branch is impossible) - #150034 (do not add `I-prioritize` when `F-*` labels are present) - #150036 (Use the embeddable filename for coverage artifacts) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 13 pull requests Successful merges: - #148756 (Warn on codegen attributes on required trait methods) - #148790 (Add new Tier-3 target: riscv64im-unknown-none-elf) - #149271 (feat: dlopen Enzyme) - #149459 (std: sys: fs: uefi: Implement set_times and set_perm) - #149771 (bootstrap readme: make easy to read when editor wrapping is not enabled) - #149856 (Provide an extended framework for type visit, for use in rust-analyzer) - #149950 (Simplify how inline asm handles `MaybeUninit`) - #150014 (Metadata loader cleanups) - #150021 (document that mpmc channels deliver an item to (at most) one receiver) - #150029 (Update books) - #150031 (assert impossible branch is impossible) - #150034 (do not add `I-prioritize` when `F-*` labels are present) - #150036 (Use the embeddable filename for coverage artifacts) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #149856 - ChayimFriedman2:no-copy-solver-v3, r=jackh726 Provide an extended framework for type visit, for use in rust-analyzer rust-analyzer needs to be able to visit types when treating not only `Ty`, `Const`, `Region` and `Predicate` specifically, but *all* rust-analyzer-made types specifically (excluding e.g. `TraitRef`, that is declared in rustc_type_ir). This is needed to implement garbage collection. To support this, we introduce a second, rust-analyzer-only visit trait, named, without much thought, `CustomizableTypeVisitable`. It's simpler than `TypeVisitable` (for example, it does not have a trait for the visitor, and does not support early-returning) because this is what rust-analyzer needs, but its most distinguished feature is that the visitor is a generic of the *trait* instead of the *method*. This way, specific types can treat specific visitor types specifically and call their methods. In rustc_type_ir we implement it for a bunch of basic types, and using a derive macro for the rest. The macro and trait are completely disabled when compiling for rustc (`feature = "nightly"`), so not even a compile time penalty will be paid. r? types This is a replacement to other efforts to support non-`Copy` type in the solver, replacing them with a GC in r-a, as decided by ``@rust-lang/rust-analyzer.`` The code is tiny in comparison, and I believe T-types will have no problem maintaining it, which mostly means adding the derive on new things when they are added and things break on the r-a side.
rust-analyzer needs to be able to visit types when treating not only
Ty,Const,RegionandPredicatespecifically, but all rust-analyzer-made types specifically (excluding e.g.TraitRef, that is declared in rustc_type_ir). This is needed to implement garbage collection.To support this, we introduce a second, rust-analyzer-only visit trait, named, without much thought,
CustomizableTypeVisitable. It's simpler thanTypeVisitable(for example, it does not have a trait for the visitor, and does not support early-returning) because this is what rust-analyzer needs, but its most distinguished feature is that the visitor is a generic of the trait instead of the method. This way, specific types can treat specific visitor types specifically and call their methods.In rustc_type_ir we implement it for a bunch of basic types, and using a derive macro for the rest. The macro and trait are completely disabled when compiling for rustc (
feature = "nightly"), so not even a compile time penalty will be paid.r? types
This is a replacement to other efforts to support non-
Copytype in the solver, replacing them with a GC in r-a, as decided by @rust-lang/rust-analyzer. The code is tiny in comparison, and I believe T-types will have no problem maintaining it, which mostly means adding the derive on new things when they are added and things break on the r-a side.