Skip to content
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

feat(LSP): auto-import trait reexport if trait is not visible #7079

Merged
merged 2 commits into from
Jan 16, 2025

Conversation

asterite
Copy link
Collaborator

Description

Problem

Part of #6956

Summary

A trait might be private in a module but publicly reexported from a parent module. That trait can be used but referring to it via the module it's in, rather than the module it's reexported from, is an error.

This PR makes LSP suggest a visible reexport if a trait is not visible where it's defined. For example, there's std::ops::arith::Add in the standard library, which is actually hidden but reexported as std::ops::Add. Here's how it works now when autocompleting add:

lsp-auto-import-trait-via-reexport

And the same thing is done in the code action that suggests importing a trait:

lsp-code-action-import-trait-via-reexport

Additional Context

Rust Analyzer works the same way. I initially thought we could hardcode it just for the stdlib ops, but Rust Analyzer managed to do it with any traits I defined so I figured they track reexports and suggest those.

Documentation

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

Copy link
Contributor

Execution Report

Program Execution Time %
sha256_regression 0.050s -4%
regression_4709 0.001s 0%
ram_blowup_regression 0.598s -5%
rollup-root 0.104s 0%
rollup-merge 0.007s 16%
rollup-block-root 37.000s 1%
rollup-block-merge 0.105s 0%
rollup-base-public 1.226s -1%
rollup-base-private 0.452s 0%
private-kernel-tail 0.019s 0%
private-kernel-reset 0.311s -1%
private-kernel-inner 0.067s -2%

Copy link
Contributor

Compilation Report

Program Compilation Time %
sha256_regression 1.100s 7%
regression_4709 0.795s 0%
ram_blowup_regression 16.200s -2%
rollup-root 3.302s -7%
rollup-merge 1.968s 4%
rollup-block-root-single-tx 136.000s -1%
rollup-block-root-empty 1.846s -6%
rollup-block-root 142.000s 2%
rollup-block-merge 3.608s 0%
rollup-base-public 30.360s 6%
rollup-base-private 10.040s -1%
private-kernel-tail 1.005s 5%
private-kernel-reset 6.194s 3%
private-kernel-inner 1.964s -5%

Copy link
Contributor

Execution Memory Report

Program Peak Memory
keccak256 74.69M
workspace 123.84M
regression_4709 316.01M
ram_blowup_regression 512.61M
rollup-root 231.07M
rollup-merge 205.81M
rollup-block-root 1.03G
rollup-block-merge 231.08M
rollup-base-public 479.09M
rollup-base-private 324.93M
private-kernel-tail 180.75M
private-kernel-reset 245.36M
private-kernel-inner 208.75M

Copy link
Contributor

Compilation Memory Report

Program Peak Memory
keccak256 77.63M
workspace 123.80M
regression_4709 424.14M
ram_blowup_regression 1.46G
rollup-root 336.83M
rollup-merge 229.80M
rollup-block-root-single-tx 15.97G
rollup-block-root-empty 223.97M
rollup-block-root 15.97G
rollup-block-merge 336.82M
rollup-base-public 2.12G
rollup-base-private 874.57M
private-kernel-tail 207.30M
private-kernel-reset 584.32M
private-kernel-inner 294.51M

@asterite asterite requested a review from a team January 15, 2025 18:34
Copy link
Member

@TomAFrench TomAFrench left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TomAFrench TomAFrench added this pull request to the merge queue Jan 16, 2025
Merged via the queue into master with commit 197b02a Jan 16, 2025
99 checks passed
@TomAFrench TomAFrench deleted the ab/lsp-suggest-trait-reexport branch January 16, 2025 10:22
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 16, 2025
feat: add `ConstrainNotEqual` instruction (noir-lang/noir#7032)
feat!: `loop` statements (only frontend) (noir-lang/noir#7092)
fix!: Include kind in `StructDefinition::generics` and fix derivation of Eq in structs with numeric generics (noir-lang/noir#7076)
chore: add test for isuee #7090 (noir-lang/noir#7091)
chore: mark `noir-edwards` as expected to compile (noir-lang/noir#7085)
chore: allow passing custom conditions to inlining pass (noir-lang/noir#7083)
feat(LSP): auto-import trait reexport if trait is not visible (noir-lang/noir#7079)
fix: Allow implicit associated types on integer type kinds (noir-lang/noir#7078)
feat(ssa): Treat globals as constant in a function's DFG (noir-lang/noir#7040)
chore: Do not make new instruction if it hasn't changed (noir-lang/noir#7069)
fix: do not remove memory blocks used as brillig input (noir-lang/noir#7073)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 16, 2025
feat: add `ConstrainNotEqual` instruction (noir-lang/noir#7032)
feat!: `loop` statements (only frontend) (noir-lang/noir#7092)
fix!: Include kind in `StructDefinition::generics` and fix derivation of Eq in structs with numeric generics (noir-lang/noir#7076)
chore: add test for isuee #7090 (noir-lang/noir#7091)
chore: mark `noir-edwards` as expected to compile (noir-lang/noir#7085)
chore: allow passing custom conditions to inlining pass (noir-lang/noir#7083)
feat(LSP): auto-import trait reexport if trait is not visible (noir-lang/noir#7079)
fix: Allow implicit associated types on integer type kinds (noir-lang/noir#7078)
feat(ssa): Treat globals as constant in a function's DFG (noir-lang/noir#7040)
chore: Do not make new instruction if it hasn't changed (noir-lang/noir#7069)
fix: do not remove memory blocks used as brillig input (noir-lang/noir#7073)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 16, 2025
feat: add `ConstrainNotEqual` instruction (noir-lang/noir#7032)
feat!: `loop` statements (only frontend) (noir-lang/noir#7092)
fix!: Include kind in `StructDefinition::generics` and fix derivation of Eq in structs with numeric generics (noir-lang/noir#7076)
chore: add test for isuee #7090 (noir-lang/noir#7091)
chore: mark `noir-edwards` as expected to compile (noir-lang/noir#7085)
chore: allow passing custom conditions to inlining pass (noir-lang/noir#7083)
feat(LSP): auto-import trait reexport if trait is not visible (noir-lang/noir#7079)
fix: Allow implicit associated types on integer type kinds (noir-lang/noir#7078)
feat(ssa): Treat globals as constant in a function's DFG (noir-lang/noir#7040)
chore: Do not make new instruction if it hasn't changed (noir-lang/noir#7069)
fix: do not remove memory blocks used as brillig input (noir-lang/noir#7073)
TomAFrench added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 17, 2025
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: add regression test for #6530
(noir-lang/noir#7089)
feat: add `ConstrainNotEqual` instruction
(noir-lang/noir#7032)
feat!: `loop` statements (only frontend)
(noir-lang/noir#7092)
fix!: Include kind in `StructDefinition::generics` and fix derivation of
Eq in structs with numeric generics
(noir-lang/noir#7076)
chore: add test for isuee #7090
(noir-lang/noir#7091)
chore: mark `noir-edwards` as expected to compile
(noir-lang/noir#7085)
chore: allow passing custom conditions to inlining pass
(noir-lang/noir#7083)
feat(LSP): auto-import trait reexport if trait is not visible
(noir-lang/noir#7079)
fix: Allow implicit associated types on integer type kinds
(noir-lang/noir#7078)
feat(ssa): Treat globals as constant in a function's DFG
(noir-lang/noir#7040)
chore: Do not make new instruction if it hasn't changed
(noir-lang/noir#7069)
fix: do not remove memory blocks used as brillig input
(noir-lang/noir#7073)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Tom French <[email protected]>
rahul-kothari pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 17, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.71.0</summary>

##
[0.71.0](aztec-package-v0.70.0...aztec-package-v0.71.0)
(2025-01-17)


### Features

* Track block building helpers
([#11190](#11190))
([a749dc1](a749dc1)),
closes
[#11184](#11184)
</details>

<details><summary>barretenberg.js: 0.71.0</summary>

##
[0.71.0](barretenberg.js-v0.70.0...barretenberg.js-v0.71.0)
(2025-01-17)


### Miscellaneous

* **barretenberg.js:** Synchronize aztec-packages versions
</details>

<details><summary>aztec-packages: 0.71.0</summary>

##
[0.71.0](aztec-packages-v0.70.0...aztec-packages-v0.71.0)
(2025-01-17)


### ⚠ BREAKING CHANGES

* `loop` statements (only frontend)
(noir-lang/noir#7092)
* Include kind in `StructDefinition::generics` and fix derivation of Eq
in structs with numeric generics
(noir-lang/noir#7076)
* Attestation collection times out based on sequencer timetable
([#11248](#11248))

### Features

* `loop` statements (only frontend)
(noir-lang/noir#7092)
([a964cd0](a964cd0))
* Add `ConstrainNotEqual` instruction
(noir-lang/noir#7032)
([a964cd0](a964cd0))
* Archive public testnet tx data
([#11192](#11192))
([66f2014](66f2014))
* Backup proof failures to google cloud storage
([#11255](#11255))
([b4775fd](b4775fd)),
closes
[#11062](#11062)
* **docs:** Algolia-&gt;typesense
([#11034](#11034))
([d254f49](d254f49))
* Improve PXE contract DB capabilities
([#11303](#11303))
([fab5570](fab5570))
* **LSP:** Auto-import trait reexport if trait is not visible
(noir-lang/noir#7079)
([a964cd0](a964cd0))
* Process note logs in aztec-nr
([#10651](#10651))
([708139d](708139d))
* Reenable constrained config for roots
([#10605](#10605))
([a6ebc2e](a6ebc2e))
* **spartan:** Add extra accounts
([#11300](#11300))
([7782836](7782836))
* **ssa:** Treat globals as constant in a function's DFG
(noir-lang/noir#7040)
([a964cd0](a964cd0))
* Track block building helpers
([#11190](#11190))
([a749dc1](a749dc1)),
closes
[#11184](#11184)


### Bug Fixes

* Allow implicit associated types on integer type kinds
(noir-lang/noir#7078)
([a964cd0](a964cd0))
* Do not remove memory blocks used as brillig input
(noir-lang/noir#7073)
([a964cd0](a964cd0))
* Ensure 'docker info' works before preceding
([#11286](#11286))
([0b0e81a](0b0e81a))
* Fail in proxy deployment should fail the step
([#11308](#11308))
([b780d75](b780d75))
* Faster polling times for archiver and sequencer
([#11262](#11262))
([d70511e](d70511e))
* Https://github.com/AztecProtocol/aztec-packages/issues/8939
([66f2014](66f2014))
* Idempotent deploy-l1-contracts with initial validators
([#11284](#11284))
([3a3f9c0](3a3f9c0)),
closes
[#11283](#11283)
* Include kind in `StructDefinition::generics` and fix derivation of Eq
in structs with numeric generics
(noir-lang/noir#7076)
([a964cd0](a964cd0))
* Legacy runner start
([#11291](#11291))
([0b2a619](0b2a619))
* Reallocate commitment key to avoid pippenger error
([#11249](#11249))
([8fc2011](8fc2011))
* References to a3 in docs
([#11256](#11256))
([caf88fa](caf88fa))
* Remove bb path override in cli-wallet
([#11280](#11280))
([a6a226e](a6a226e))
* Resolve misc bugs handling phases in avm witgen
([#11218](#11218))
([29bc4bd](29bc4bd))
* Sequencer timetable accounts for spare time
([#11221](#11221))
([f1b9211](f1b9211))
* Validator ignores block limits during reexec
([#11288](#11288))
([920a521](920a521))


### Miscellaneous

* Add circuit input checks to bootstrap.sh
([#11261](#11261))
([a718b15](a718b15))
* Add regression test for
[#6530](#6530)
(noir-lang/noir#7089)
([a964cd0](a964cd0))
* Add test for isuee
[#7090](#7090)
(noir-lang/noir#7091)
([a964cd0](a964cd0))
* Allow passing custom conditions to inlining pass
(noir-lang/noir#7083)
([a964cd0](a964cd0))
* Attestation collection times out based on sequencer timetable
([#11248](#11248))
([946a418](946a418))
* **avm:** Calldata, returndata slices out of range padded with zeros
([#11265](#11265))
([a469c94](a469c94)),
closes
[#10933](#10933)
* Delete external-ci-approved.yml
([#11258](#11258))
([642bce6](642bce6))
* Demote error closing forks to warn
([#11263](#11263))
([a5b7a6a](a5b7a6a))
* Do not make new instruction if it hasn't changed
(noir-lang/noir#7069)
([a964cd0](a964cd0))
* Ensure devnet has unproven config
([#11302](#11302))
([085f782](085f782))
* Fixing `[@safety](https://github.com/safety)` warnings
([#11094](#11094))
([5de24e0](5de24e0))
* Log correlation in traces in google cloud
([#11276](#11276))
([fbcc8ef](fbcc8ef)),
closes
[#11019](#11019)
[#10937](#10937)
* Mark `noir-edwards` as expected to compile
(noir-lang/noir#7085)
([a964cd0](a964cd0))
* Move shared pcs functionality to internal library in solidity and
small refactorings in sumcheck
([#11230](#11230))
([507ae9d](507ae9d))
* Reduce the number of provers in rc-1
([#11296](#11296))
([92e40ff](92e40ff))
* Remove references to padding txs
([#11264](#11264))
([32408f6](32408f6))
* Remove warnings from types and rollup lib crates
([#11269](#11269))
([9f389a7](9f389a7))
* Replace relative paths to noir-protocol-circuits
([8ece166](8ece166))
* Replace relative paths to noir-protocol-circuits
([be42305](be42305))
* Retry deploys
([#11252](#11252))
([23cfbb4](23cfbb4))
* Set failed proof store for spartan deployments
([#11282](#11282))
([f787a52](f787a52))
* Silence "Updated proven chain" log
([#11250](#11250))
([44bd79b](44bd79b))
* Silence circuit return values in CI
([#11259](#11259))
([db3d860](db3d860))
* Stable masternet images
([#11289](#11289))
([07fabe8](07fabe8))
</details>

<details><summary>barretenberg: 0.71.0</summary>

##
[0.71.0](barretenberg-v0.70.0...barretenberg-v0.71.0)
(2025-01-17)


### Bug Fixes

* Reallocate commitment key to avoid pippenger error
([#11249](#11249))
([8fc2011](8fc2011))
* Resolve misc bugs handling phases in avm witgen
([#11218](#11218))
([29bc4bd](29bc4bd))


### Miscellaneous

* **avm:** Calldata, returndata slices out of range padded with zeros
([#11265](#11265))
([a469c94](a469c94)),
closes
[#10933](#10933)
* Move shared pcs functionality to internal library in solidity and
small refactorings in sumcheck
([#11230](#11230))
([507ae9d](507ae9d))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants