about summary refs log tree commit diff
path: root/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-02-01 23:05:28 +0000
committerGitHub <noreply@github.com>2022-02-01 23:05:28 +0000
commit34138379b5945616e51b3822769628b252c7a4f5 (patch)
treecf8dfaef80cf25fd7e3cbdb09f7ea3a270979454 /tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff
parent498224af18ab68a2c646e6f036946d678bd1752d (diff)
parent493642ab3a28fc575f699ae381123e6e4f3cec39 (diff)
downloadrust-34138379b5945616e51b3822769628b252c7a4f5.tar.gz
rust-34138379b5945616e51b3822769628b252c7a4f5.zip
Merge #11322
11322: Extract function also extracts comments r=Vannevelj a=Vannevelj

Fixes #9011

The difficulty I came across is that the original assist works from the concept of a `ast::StmtList`, a node, but that does not allow me to (easily) represent comments, which are tokens. To combat this, I do a whole bunch of roundtrips: from the `ast::StmtList` I retrieve the `NodeOrToken`s it encompasses. 

I then cast all `Node` ones back to a `Stmt` so I can apply indentation to it, after which it is again parsed as a `NodeOrToken`.

Lastly, I add a new `make::` api that accepts `NodeOrToken` rather than `StmtList` so we can write the comment tokens.

Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff')
0 files changed, 0 insertions, 0 deletions