Skip to content

Commit 4e08bb5

Browse files
committed
Fix typo and improve documentation for E0632
1 parent a435b49 commit 4e08bb5

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ E0626: include_str!("./error_codes/E0626.md"),
361361
E0627: include_str!("./error_codes/E0627.md"),
362362
E0628: include_str!("./error_codes/E0628.md"),
363363
E0631: include_str!("./error_codes/E0631.md"),
364+
E0632: include_str!("./error_codes/E0632.md"),
364365
E0633: include_str!("./error_codes/E0633.md"),
365366
E0634: include_str!("./error_codes/E0634.md"),
366367
E0635: include_str!("./error_codes/E0635.md"),
@@ -623,8 +624,6 @@ E0783: include_str!("./error_codes/E0783.md"),
623624
// E0629, // missing 'feature' (rustc_const_unstable)
624625
// E0630, // rustc_const_unstable attribute must be paired with stable/unstable
625626
// attribute
626-
E0632, // cannot provide explicit generic arguments when `impl Trait` is
627-
// used in argument position
628627
E0640, // infer outlives requirements
629628
// E0645, // trait aliases not finished
630629
E0667, // `impl Trait` in projections
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
An explicit generic argument was provided when calling a function that
2+
uses `impl Trait` in argument position.
3+
4+
Erroneous code example:
5+
6+
```compile_fail,E0632
7+
fn foo<T: Copy>(a: T, b: impl Clone) {}
8+
9+
foo::<i32>(0i32, "abc".to_string());
10+
```
11+
12+
Either all generic arguments should be inferred at the call site, or
13+
the function definition should use an explicit generic type parameter
14+
instead of `impl Trait`. Example:
15+
16+
```
17+
fn foo<T: Copy>(a: T, b: impl Clone) {}
18+
fn bar<T: Copy, U: Clone>(a: T, b: U) {}
19+
20+
foo(0i32, "abc".to_string());
21+
22+
bar::<i32, String>(0i32, "abc".to_string());
23+
bar::<_, _>(0i32, "abc".to_string());
24+
bar(0i32, "abc".to_string());
25+
```

compiler/rustc_lint/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ declare_lint! {
10841084
///
10851085
/// ### Explanation
10861086
///
1087-
/// An function with generics must have its symbol mangled to accommodate
1087+
/// A function with generics must have its symbol mangled to accommodate
10881088
/// the generic parameter. The [`no_mangle` attribute] has no effect in
10891089
/// this situation, and should be removed.
10901090
///

0 commit comments

Comments
 (0)