Lukas Wirth
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # rust-analyzer in 2021 > In case this post piques your interest in contributing, consider checking out the [Explaining rust-analyzer](https://www.youtube.com/playlist?list=PLhb66M_x9UmrqXhQuIpWC5VgTdrGxMx3y) series on YouTube, the development docs [on GitHub](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/dev) or visit our [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer). A lot has happened this year, so we want to take a brief look back at what we have achieved and what has yet to come. Unfortunately, we did not manage to make rust-analyzer an official Rust project in 2021. But if all goes well this should change at the start of the coming year. We started the year out by trying out a different meeting style from our usual weekly syncs on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/weekly.20sync-up). We now have six-weeks sprints, with a steering meeting between them, where the working group gets together and discusses what topics and issues to focus on next. ## (Proc-)Macros and Attributes Probably one of the biggest improvements that landed this year was attribute proc-macro support, implemented in [#9128](https://github.com/rust-analyzer/rust-analyzer/pull/9128). Attributes are used pervasively in some Rust codebases, usually expanding to enough new items (functions, `impl` blocks etc.), and are essential in making the IDE work without significantly degrading the user experience. It took us roughly four months until we felt comfortable enough to enable their expansion [by default](https://github.com/rust-analyzer/rust-analyzer/pull/10366), the main reason being the amount of code that had to be adapted to properly support them. While this feature mostly works nowadays, there is still one big problem we are facing, that of how attributes can interact with incomplete code. This is described in issue [#11014](https://github.com/rust-analyzer/rust-analyzer/issues/11014) in more detail, but attribute proc macros fail to expand when they encounter syntax errors, as is often the case when the user is typing. Of course, function-like proc macros are affected in a similar way. We are still unsure about how to address this problem, so if you have any thoughts on the matter please comment on the linked issue. Attributes aside, a lot of improvements landed for proc-macros in general. We enabled [proc-macros by default](https://github.com/rust-analyzer/rust-analyzer/pull/8032), [started loading proc-macros asynchronously](https://github.com/rust-analyzer/rust-analyzer/pull/7412) and added support for [multiple proc-macro ABIs](https://github.com/rust-analyzer/rust-analyzer/pull/9550), a finicky feature. The Rust proc-macro ABI is deliberately outside of usual stability guarantees. It constantly evolves, but with every change it breaks our proc-macro server. To counteract this we now try to at least support ~3 ABI versions which nominally correspond to the latest stable, beta and nightly toolchains. In practice, we support much older versions: 1.47 and later, at this moment. It's worth pointing out that parts of our proc macro infrastructure are used by [IntelliJ Rust](https://intellij-rust.github.io). It's a great example of cross-polination of ideas between the two projects -- our `proc_macro_srv` is based on a design originally implemented in IntelliJ Rust! Finally, declarative macros also saw some love. We switched to an [NFA parser](https://github.com/rust-analyzer/rust-analyzer/pull/7513) which brings us closer to how rustc handles them, added basic support for [macro 2.0](https://github.com/rust-analyzer/rust-analyzer/pull/8212) and [type position macros](https://github.com/rust-analyzer/rust-analyzer/pull/8462). ## Local Item Resolution Rust offers the ability to define new items inside of functions, consts and statics, making them effectively unnameable outside of these items. This idiom is seldom seen but is still useful at times. This is another piece of the language that is tricky to support, as an IDE wants to be lazy and only look at the big picture to understand a file's structure. Unfortunately, local items require us to look inside function bodies and the like. As such, finding a compromise took some work: [#7336](https://github.com/rust-analyzer/rust-analyzer/pull/7336), [#7359](https://github.com/rust-analyzer/rust-analyzer/pull/7359), [#7366](https://github.com/rust-analyzer/rust-analyzer/pull/7366), [#7375](https://github.com/rust-analyzer/rust-analyzer/pull/7375), [#7426](https://github.com/rust-analyzer/rust-analyzer/pull/7426), [#7431](https://github.com/rust-analyzer/rust-analyzer/pull/7431), [#7466](https://github.com/rust-analyzer/rust-analyzer/pull/7466), [#7480](https://github.com/rust-analyzer/rust-analyzer/pull/7480), [#7481](https://github.com/rust-analyzer/rust-analyzer/pull/7481), [#7482](https://github.com/rust-analyzer/rust-analyzer/pull/7482), [#7485](https://github.com/rust-analyzer/rust-analyzer/pull/7485), [#7518](https://github.com/rust-analyzer/rust-analyzer/pull/7518), [#7525](https://github.com/rust-analyzer/rust-analyzer/pull/7525), [#7541](https://github.com/rust-analyzer/rust-analyzer/pull/7541), [#7544](https://github.com/rust-analyzer/rust-analyzer/pull/7544), [#7554](https://github.com/rust-analyzer/rust-analyzer/pull/7554), [#7555](https://github.com/rust-analyzer/rust-analyzer/pull/7555), [#7557](https://github.com/rust-analyzer/rust-analyzer/pull/7557), [#7559](https://github.com/rust-analyzer/rust-analyzer/pull/7559), [#7561](https://github.com/rust-analyzer/rust-analyzer/pull/7561), [#7568](https://github.com/rust-analyzer/rust-analyzer/pull/7568), [#7575](https://github.com/rust-analyzer/rust-analyzer/pull/7575), [#7627](https://github.com/rust-analyzer/rust-analyzer/pull/7627), [#9244](https://github.com/rust-analyzer/rust-analyzer/pull/9244). The final piece, enabling it all, landed in [#7614](https://github.com/rust-analyzer/rust-analyzer/pull/7614) ## Chalk integration We managed to switch our type representation to the one used by [chalk](https://github.com/rust-lang/chalk), avoiding the need to convert between them every time we invoke the trait solver. This work was done over a bunch of different pull requests: [#7804](https://github.com/rust-analyzer/rust-analyzer/pull/7804), [#7813](https://github.com/rust-analyzer/rust-analyzer/pull/7813), [#7814](https://github.com/rust-analyzer/rust-analyzer/pull/7814), [#7816](https://github.com/rust-analyzer/rust-analyzer/pull/7816), [#7823](https://github.com/rust-analyzer/rust-analyzer/pull/7823), [#7826](https://github.com/rust-analyzer/rust-analyzer/pull/7826), [#7833](https://github.com/rust-analyzer/rust-analyzer/pull/7833), [#7870](https://github.com/rust-analyzer/rust-analyzer/pull/7870), [#8016](https://github.com/rust-analyzer/rust-analyzer/pull/8016), [#7998](https://github.com/rust-analyzer/rust-analyzer/pull/7998), [#8001](https://github.com/rust-analyzer/rust-analyzer/pull/8001), [#8018](https://github.com/rust-analyzer/rust-analyzer/pull/8018), [#8038](https://github.com/rust-analyzer/rust-analyzer/pull/8038), [#8136](https://github.com/rust-analyzer/rust-analyzer/pull/8136), [#8190](https://github.com/rust-analyzer/rust-analyzer/pull/8190), [#8139](https://github.com/rust-analyzer/rust-analyzer/pull/8139), [#8309](https://github.com/rust-analyzer/rust-analyzer/pull/8309), [#8327](https://github.com/rust-analyzer/rust-analyzer/pull/8327), [#8856](https://github.com/rust-analyzer/rust-analyzer/pull/8856), [#8921](https://github.com/rust-analyzer/rust-analyzer/pull/8921), [#8938](https://github.com/rust-analyzer/rust-analyzer/pull/8938), [#8856](https://github.com/rust-analyzer/rust-analyzer/pull/8856), and we were finally able to fully move over in [#8419](https://github.com/rust-analyzer/rust-analyzer/pull/8419). ## Const Generic Params We started working on basic const generics support, tracking issue [#8655](https://github.com/rust-analyzer/rust-analyzer/issues/8655). This is one of the major pieces left for us to properly support, but also one of the more difficult ones. This problem becomes more and more apparent as libraries are switching over to using them. A notable example being `nalgebra`, which rust-analyzer is completely confused by. For an ideal experience we would need to evaluate expressions in const generic position like rustc does. Unlike rustc though, we are unable to use [`miri`](https://github.com/rust-lang/miri/). The reason for that is the fact that we do not share the internal data structures that the compiler and miri make use of, nor do we plan to do so in the near future. Because of this, we are required to build our own basic evaluator. This isn't the only problem we have. As it currently stands, the majority of rust-analyzer's type checking codebase doesn't even know about const generics (or lifetimes), and just assumes that only type parameters exist. ## Mutable Immutable Syntax Trees [Rowan](https://github.com/rust-analyzer/rowan), our concrete syntax tree crate has been adjusted to allow creating mutable copies of the immutable syntax trees. For more in-depth information behind this, check out [this issue](https://github.com/rust-analyzer/rust-analyzer/issues/6857). To put it short, the assists like to take existing syntax in a file, modify it slightly, then paste back the result, changing only a few parts of the code. What most assists did before was to reconstruct the output syntax trees out of the original tree nodes, with the changes inserted or left out. This is unfortunately a tedious process depending on the type of syntax node that has to be edited. These mutable immutable trees now allow us to instead mutably clone a tree, modify it in-place and paste this modified tree back as is. This does not come without its own problems of course, with the main one being that iterating while mutating, which is now possible, will now panic or produce an incorrect tree. ## The Code extension and server downloads The final releases of the year brought two important changes to the way the language server binary is acquired. Until now, the extension called the GitHub API to find a matching release, and downloaded the server from there. In addition, if you opted in to the nightly channel, every day the extension would search for an updated VSIX. While this suited us well for a long time, it had some downsides: - edge cases like MITM HTTPS proxies with untrusted certificates never worked - not being able to replace running executable on Windows (in case you had two running instances) has been a major source of complaints - Code checks for extension updates automatically, but the server was downloaded on activation. Many users had an unpleasant surprise when opening a Rust project without a working Internet connection. - GitHub Actions has been increasingly unreliable lately causing the nightly builds to fail very often. This broke the extension for users running the nightlies. - the download and update code brought a lot of non-essential complexity and even exposed a Node.js bug - the required client-side dependencies increased the surface for supply chain attacks So when the Marketplace added support for platform-specific and pre-release extensions, we starting using it with [#11053](https://github.com/rust-analyzer/rust-analyzer/pull/11053), [#11071](https://github.com/rust-analyzer/rust-analyzer/pull/11071) and [#11106](https://github.com/rust-analyzer/rust-analyzer/pull/11071). On a related note, we also [replaced](https://github.com/rust-analyzer/rust-analyzer/pull/10903) the client-side unit testing framework with a bit of custom code, dropping our transitive dependencies by the dozens. Unfortunately, the update changes exposed some issues with both the Code Marketplace and Open VSX (used by open-source builds of Code). This is discussed in detail [here](https://rust-analyzer.github.io/thisweek/2021/12/27/changelog-109.html#known-issues), the gist being that you currently need to take manual action when installing or updating the extension. The two issues have been reported upstream, so we hope they will be fixed soon. ## General IDE Experience Improvements We now support standalone Rust files ([#8955](https://github.com/rust-analyzer/rust-analyzer/pull/8955)), so just opening a single file should allow you to use most of rust-analyzer's functionality that is not reliant on cargo. We also improved and added a bunch of smaller features, some noteworthy ones are: - [Flyimport Completions for Trait Associated Items](https://github.com/rust-analyzer/rust-analyzer/pull/7297) - [Custom User Snippet Completions](https://github.com/rust-analyzer/rust-analyzer/pull/10458) - [Region Folding](https://github.com/rust-analyzer/rust-analyzer/pull/7335) - [Related Test Peeking](https://github.com/rust-analyzer/rust-analyzer/pull/7799) - [Move Item Command](https://github.com/rust-analyzer/rust-analyzer/pull/8054) - [Crate Graph View](https://github.com/rust-analyzer/rust-analyzer/pull/8801) - [Import Granularity Guessing](https://github.com/rust-analyzer/rust-analyzer/pull/8873) - Highlighting [Function Exit and Yield Points](https://github.com/rust-analyzer/rust-analyzer/pull/9375) and [Loop Break Points](https://github.com/rust-analyzer/rust-analyzer/pull/9396) - [Respect `.cargo/config.toml`](https://github.com/rust-analyzer/rust-analyzer/pull/8774) An impressive ~37 new assists have been implemented, some by the main contributors, but most by newcomers: - [Add Lifetime to Type](https://github.com/rust-analyzer/rust-analyzer/pull/7310) - [Add Type Ascription](https://github.com/rust-analyzer/rust-analyzer/pull/7824) - [Convert `a/mod.rs` into `a.rs`](https://github.com/rust-analyzer/pull/10362) - [Convert `bool::then` to `if`](https://github.com/rust-analyzer/pull/9837) - [Convert `for` Loop to `Iterator::for_each`](https://github.com/rust-analyzer/rust-analyzer/pull/7741) - [Convert `if` to `bool::then`](https://github.com/rust-analyzer/pull/9816) - [Convert `Into` Impl to `From` Impl](https://github.com/rust-analyzer/rust-analyzer/pull/8295) - [Convert `Iterator::for_each` to `for` Loop](https://github.com/rust-analyzer/rust-analyzer/pull/7956) - [Convert Between Line and Block Comments](https://github.com/rust-analyzer/rust-analyzer/pull/7777) - [Convert File Module to Directory](https://github.com/rust-analyzer/pull/10211) - [Convert Number Representation](https://github.com/rust-analyzer/pull/10998) - [Convert Tuple Struct to Named Struct](https://github.com/rust-analyzer/rust-analyzer/pull/8317) - [Destructure Pattern into Tuple Pattern](https://github.com/rust-analyzer/pull/9855) - [Extract Assignment](https://github.com/rust-analyzer/rust-analyzer/pull/7130) - [Extract Function](https://github.com/rust-analyzer/rust-analyzer/pull/7535) - [Extract module](https://github.com/rust-analyzer/pull/9939) - [Extract Type Alias](https://github.com/rust-analyzer/rust-analyzer/pull/8210) - [Generate `fn is_empty`](https://github.com/rust-analyzer/rust-analyzer/pull/8037) - [Generate Constant](https://github.com/rust-analyzer/pull/10459) - [Generate Default Impl](https://github.com/rust-analyzer/rust-analyzer/pull/7800) - [Generate Delegate Methods](https://github.com/rust-analyzer/pull/10539) - [Generate Deref Impl](https://github.com/rust-analyzer/rust-analyzer/pull/8467) - [Generate Documentation Templates](https://github.com/rust-analyzer/pull/10951) - [Generate Enum Match](https://github.com/rust-analyzer/rust-analyzer/pull/7562) - [Generate Enum Match 2](https://github.com/rust-analyzer/rust-analyzer/pull/7677) - [Generate Getter and Setter](https://github.com/rust-analyzer/rust-analyzer/pull/7617) - [Generate Method](https://github.com/rust-analyzer/pull/9804) - [Inline Function](https://github.com/rust-analyzer/rust-analyzer/pull/7131) - [Inline into Callers](https://github.com/rust-analyzer/pull/10352) - [Promote Local to Const](https://github.com/rust-analyzer/pull/10546) - [Qualify method call](https://github.com/rust-analyzer/pull/10602) - [Replace `?` with `match`](https://github.com/rust-analyzer/pull/10476) - [Replace Turbofish with Explicit Type](https://github.com/rust-analyzer/pull/10629) - [Sort Impl Functions by Trait definition](https://github.com/rust-analyzer/rust-analyzer/pull/6809) - [Sort Members Lexicographically](https://github.com/rust-analyzer/pull/9735) - [Unmerge Use](https://github.com/rust-analyzer/rust-analyzer/pull/7289) - [Unwrap `Result` Return Type](https://github.com/rust-analyzer/pull/10417) ## Conclusion We made a bunch of progress this year, finishing up work on important functionality pieces as well as quality of life changes. But there is still a lot more to be done, as a quick look at the [issue tracker](https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3AArchitecture) may tell. A big thanks to everyone supporting the project, be it through donations, contributions or cheers. We wish you a fortunate next year :tada:.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully