about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-12 08:21:37 +0000
committerbors <bors@rust-lang.org>2024-09-12 08:21:37 +0000
commit3831b72b7d2a0ad8329b2a7f430468f6a0a81607 (patch)
tree28b15637dbcb63375fa31480cd20e3f914bc7d2e /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent4fcad5a1ffecd6f1fd9bd92946ca8a08b8c41311 (diff)
parentb304701b670e45d4d1a43691f0b3083423d41e31 (diff)
downloadrust-3831b72b7d2a0ad8329b2a7f430468f6a0a81607.tar.gz
rust-3831b72b7d2a0ad8329b2a7f430468f6a0a81607.zip
Auto merge of #18038 - roife:fix-issue-18034, r=Veykril
feat: generate names for tuple-struct in add-missing-match-arms

fix #18034.

This PR includes the following enhancement:

- Introduced a `NameGenerator` in `suggest_name`, which implements an automatic renaming algorithm to avoid name conflicts. Here are a few examples:

```rust
let mut generator = NameGenerator::new();
assert_eq!(generator.suggest_name("a"), "a");
assert_eq!(generator.suggest_name("a"), "a1");
assert_eq!(generator.suggest_name("a"), "a2");

assert_eq!(generator.suggest_name("b"), "b");
assert_eq!(generator.suggest_name("b"), "b1");
assert_eq!(generator.suggest_name("b2"), "b2");
assert_eq!(generator.suggest_name("b"), "b3");
assert_eq!(generator.suggest_name("b"), "b4");
assert_eq!(generator.suggest_name("b3"), "b5");
```

- Updated existing testcases in ide-assists for the new `NameGenerator` (only modified generated names).
- Generate names for tuple structs instead of using wildcard patterns in `add-missing-match-arms`.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions