rust/src/test
bors 703f2e1685 Auto merge of #85041 - mibac138:suggest-generics, r=estebank
Suggest adding a type parameter for impls

Add a new suggestion upon encountering an unknown type in a `impl` that suggests adding a new type parameter. This diagnostic suggests to add a new type parameter even though it may be a const parameter, however after adding the parameter and running rustc again a follow up error steers the user to change the type parameter to a const parameter.

```rust
struct X<const C: ()>();
impl X<C> {}
```
suggests
```
error[E0412]: cannot find type `C` in this scope
 --> bar.rs:2:8
  |
1 | struct X<const C: ()>();
  | ------------------------ similarly named struct `X` defined here
2 | impl X<C> {}
  |        ^
  |
help: a struct with a similar name exists
  |
2 | impl X<X> {}
  |        ^
help: you might be missing a type parameter
  |
2 | impl<C> X<C> {}
  |     ^^^
```
After adding a type parameter the code now becomes
```rust
struct X<const C: ()>();
impl<C> X<C> {}
```
and the error now fully steers the user towards the correct code
```
error[E0747]: type provided when a constant was expected
 --> bar.rs:2:11
  |
2 | impl<C> X<C> {}
  |           ^
  |
help: consider changing this type parameter to be a `const` generic
  |
2 | impl<const C: ()> X<C> {}
  |      ^^^^^^^^^^^
```
r? `@estebank`
Somewhat related #84946
2021-05-13 08:08:20 +00:00
..
assembly Add initial asm!() support for PowerPC 2021-05-11 19:04:16 -05:00
auxiliary
codegen Auto merge of #83813 - cbeuw:remap-std, r=michaelwoerister 2021-05-12 11:05:56 +00:00
codegen-units Remove redundant ignore-tidy-linelength annotations 2021-04-03 22:30:20 +02:00
debuginfo Rollup merge of #84500 - tmandry:compiletest-run-flag, r=Mark-Simulacrum 2021-05-07 00:38:35 +02:00
incremental Move parenting info to index_hir. 2021-04-29 21:36:55 +02:00
mir-opt array-to-raw-elem cast: test that Retag covers entire array 2021-05-07 09:36:45 +02:00
pretty parser: Remove support for inner attributes on non-block expressions 2021-05-03 13:33:53 +03:00
run-make rustc: Add a new wasm ABI 2021-04-08 08:03:18 -07:00
run-make-fulldeps Auto merge of #83610 - bjorn3:driver_cleanup, r=cjgillot 2021-05-12 08:38:03 +00:00
run-pass-valgrind
rustdoc Disable layout docs for type aliases for now 2021-05-11 10:19:46 -07:00
rustdoc-gui Update toggle-docs GUI test to last version 2021-05-11 20:56:16 +02:00
rustdoc-js Add test for primitive search 2021-02-01 15:56:51 +01:00
rustdoc-js-std Add search index test for primitive types 2021-01-27 10:05:06 +01:00
rustdoc-json Rename span to source 2021-03-24 19:44:23 +00:00
rustdoc-ui Show macro name in 'this error originates in macro' message 2021-05-12 19:03:06 -04:00
rustfix
ui Auto merge of #85041 - mibac138:suggest-generics, r=estebank 2021-05-13 08:08:20 +00:00
ui-fulldeps Show macro name in 'this error originates in macro' message 2021-05-12 19:03:06 -04:00
COMPILER_TESTS.md