Files
rust/tests
Jacob Pratt 9237f14282 Rollup merge of #155132 - jakedrew:fix/suggest-similar-target-on-unrecognized-155085, r=Kivooeo
Suggest similar target names on unrecognized `--target`

When an unrecognized `--target` is passed check the list of available targets and suggest the closest matching built-in target as a help message.

### Before

```
    error: error loading target specification: could not find specification for target "x86_64-linux-gnu"
      = help: run `rustc --print target-list` for a list of built-in targets
```

### After

```
    error: error loading target specification: could not find specification for target "x86_64-linux-gnu"
      = help: run `rustc --print target-list` for a list of built-in targets
      = help: did you mean `x86_64-unknown-linux-gnu`?
```

Regarding the expected test case in https://github.com/rust-lang/rust/issues/155085#issuecomment-4222050023 the `edit_distance_with_substrings` was used over `edit_distance` because in the case of `x86_64-linux-gnu` the `edit_distance` would return `x86_64-linux-android` instead of `x86_64-unknown-linux-gnu`

rust-lang/rust#155085
2026-04-11 01:49:13 -04:00
..
2026-04-10 15:10:04 +02:00