Skip to content

Fix panic in split_imports assist #4057

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

Merged
merged 1 commit into from
Apr 20, 2020
Merged

Fix panic in split_imports assist #4057

merged 1 commit into from
Apr 20, 2020

Conversation

matklad
Copy link
Member

@matklad matklad commented Apr 20, 2020

The fix is admittedly quit literally just papering over.

Long-term, I see two more principled approaches:

  • we switch to a fully tree-based impl, without parse . to_string
    step; with this approach, there shouldn't be any panics. The results
    might be nonsensical, but so was the original input.

  • we preserve the invariant that re-parsing constructed node is an
    identity, and make all the make_xxx method return an Option.

closes #4044

bors r+
🤖

The fix is admittedly quit literally just papering over.

Long-term, I see two more principled approaches:

* we switch to a fully tree-based impl, without parse . to_string
  step; with this approach, there shouldn't be any panics. The results
  might be nonsensical, but so was the original input.

* we preserve the invariant that re-parsing constructed node is an
  identity, and make all the `make_xxx` method return an `Option`.

closes rust-lang#4044
@bors
Copy link
Contributor

bors bot commented Apr 20, 2020

@bors bors bot merged commit 2e0b7b0 into rust-lang:master Apr 20, 2020
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Jan 7, 2025
Fix weak memory emulation to avoid generating behaviors that are forbidden under C++ 20
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.

Frequent error when working in lib.rs
1 participant