Niko Matsakis
    • 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
    • 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
    • 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 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
  • 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
    # 2019.11.18: RLS + rust-analyzer integration See the [main discussion document](https://hackmd.io/9qrJYdSLTK2MWG4-pbmpWw) ## Prep work for next meeting * See what features RLS has over Rust Analyzer and vice versa * Understand other save-analysis consumers' needs (when RLS is deprecated) * Mozilla's searchfox? * @est31 * nrc's [cargo-src](https://github.com/rust-dev-tools/cargo-src) * [Issues labeled A-save-analysis](https://github.com/rust-lang/rust/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3AA-save-analysis) * Proposed architectural alternatives (not necessarily mutually exclusive) * freeze RLS, focus all energy on rust-analyzer * extend rust-analyzer with ability to consume save-analysis data in some form * integrate rust-analyzer into RLS as a "racer alternative" (even worth discussing? unclear) * What are some "quality metrics" we could use to judge when rust-analyzer is "ready"? * Feature set * Precision * Niko proposed identify a set of crates and requiring >90% (or some threshold) precision from type-checker on those crates * Requires ability to check type-checker against rustc (another possible role for save-analysis) * Set of crates where features must work? * Parts of the language that must be covered? * In our discussion on [2019.11.06], we also covered this some * Matklad suggested that any "uncovered language features" should be well known and generally require "just work" (no architectural rewrites) * But procedural macros might be an exception -- and perhaps there are others? ## Notes from meeting * matklad attempted an experiment to integrate save-analysis into a simple tool * short script that implements "find all refs" (targeting "rename symbol") * using save-analysis library * have to pass `-Zsave-analysis`, which requires "BOOTSTRAP" but... * takes a line/col. number ## * First topic: how "ready" is rust-analyzer, how should we advertise it * Want to avoid calling r-a "beta quality" * Didn't like the messaging around RLS 1.0 / 2.0 * trying to say that this is ready, but folks would respond not really * rust-analyzer is not really ready * can't be ready in a year, maybe two years * "two years" is effectively infinity * Igor -- situation is sort of the same with RLS * What would it take to feel more comfortable? * matklad: shared code-base for the core analysis with rustc * I would feel ok if it were separate but complete (no major missing features) * how conservative will we have to be to avoid breakage etc? * some kind of release process would be needed * bug triaging * See what features RLS has over Rust Analyzer and vice versa ``` |feature |rust-analyzer | rls | rename | incomplete | ✓ | error reporting | X | ✓ | completion | ✓ | provided by racer, not precise | goto definition | ✓ | ✓ | goto type definition | ✓ | ? | find references | incomplete | ✓ | assists | ✓, can add more | X | typing handlers | PoC, can add more | X | complex refactorings | incomplete | X | running tests | ✓ | exists, but imprecise (regex-based) and incomplete | type hints | ✓ | X | syntax highlighting | ✓ | X | structural search replace | X | X | interactive macro expansion | X | X | lifetime visualization| X | X | symbol search | ✓ | ✓ | single file analysis | somewhat | ? | extend selection | ✓ | ? | foldnig | ✓ | ? |=== ``` Core differentiator at present: * RLS has precise find-all-references and rename (based on save-analysis) * rust-analyzer has incomplete, imprecise support * https://github.com/rust-analyzer/renamer * error reporting * rust-analyzer uses `cargo watch` * RLS does "sort of the same thing" # Architecture possibility * Invoke compiler to get save-analysis, errors * build up native compatibility * One route that matklad is elaborating on * build a command-line tool * rust-analyzer invokes this tool as a subprocess (other consumers could do so as well) * we can also pack things like `cargo src` into that * save-analysis is getting re-generated by running `cargo check` with some argument * preference in rust-analyzer UI ("which rename algorithm to use") * when checked, rust-analyzer will run this process etc on a regular basis * also requires user to actually save all documents to disk * today `cargo watch` is not requiring saving files, giving strange feedback * If we wanted to avoid saving files, there are alternatives * But what other problems do we have * reusing data between invocations * second rename has to run cargo check from scratch? * incremental? * limitation: if there are errors, data is not great * limitation: custom build plans etc * but we can permit people to supply their own command ## proposed consensus * we will integrate "rustc generating save-analysis" code into rust-analyzer to handle * error reporting * find all references * precise rename * but offer preference(s) to switch to "native" implementations of those 3 features * (Observation: this also enables us to compare between the two automatically) ## unresolved questions * will we be using a separate process that is invoked (`cargo rename`) etc? * or do we want something resident? * can we migrate save-analysis to LSIF and how should we do that? # overall plan * library-ification proceeds * build a version of rust-analyzer that incorporates save-analysis as above * ("RLS 2.0") * advertise it as a "pre-alpha" or "alpha" software * given sufficient caveats * "useful" # what happens to RLS 1.0 then? * delivered via rustup today * does RLS 1.0 just remain, frozen, but stable? * improve "user-first" installation for cargo? * so you don't have to build from source * first thing we should strive for: user parity (save-analysis basically does that) * does this let us gauge how many projects that worked will stop working * also true, need for a internal format for formal structure? * but save-analysis is sort of high level * stage 1: * existing RLS is in maintenance * we extract and build up this "command-line tools" or whatever for rust-analyzer * stage 2, entering a triage/trial period: * we compare against some set of crates and project * stage 3: * ship rust-analyzer as the "new RLS" with rustup * this *should* work with other editors out of the box * though RA does have a bit of "extra features" (extensions to the underlying LSP)

    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