Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error code explanation for E0224 #67944

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes.rs
Expand Up @@ -118,6 +118,7 @@ E0220: include_str!("./error_codes/E0220.md"),
E0221: include_str!("./error_codes/E0221.md"),
E0222: include_str!("./error_codes/E0222.md"),
E0223: include_str!("./error_codes/E0223.md"),
E0224: include_str!("./error_codes/E0224.md"),
E0225: include_str!("./error_codes/E0225.md"),
E0229: include_str!("./error_codes/E0229.md"),
E0230: include_str!("./error_codes/E0230.md"),
Expand Down Expand Up @@ -459,7 +460,6 @@ E0745: include_str!("./error_codes/E0745.md"),
// E0217, // ambiguous associated type, defined in multiple supertraits
// E0218, // no associated type defined
// E0219, // associated type defined in higher-ranked supertrait
E0224, // at least one non-builtin train is required for an object type
E0226, // only a single explicit lifetime bound is permitted
E0227, // ambiguous lifetime bound, explicit lifetime bound required
E0228, // explicit lifetime bound required
Expand Down
17 changes: 17 additions & 0 deletions src/librustc_error_codes/error_codes/E0224.md
@@ -0,0 +1,17 @@
This fails because you are using dynamically sized trait objects without Trait

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This fails because you are using dynamically sized trait objects without Trait
This fails because you are using dynamically sized trait objects without specifying a trait

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd reword it to (integrating @Dylan-DPC suggestion): "A dynamically sized trait was used without specifying a trait".


Erroneous code example:

```compile_fail,E0224
fn main() {
let _x: &dyn = &0;
}
```

To solve the error please add at least one trait for `&dyn`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To solve the error please add at least one trait for `&dyn`
To solve this error, please add at least one trait for `&dyn`


```
fn main() {
let _x: &dyn ToString = &0;
}
```
Expand Up @@ -12,3 +12,4 @@ LL | type _T1 = dyn _2;

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0224`.
3 changes: 2 additions & 1 deletion src/test/ui/traits/trait-object-macro-matcher.stderr
Expand Up @@ -14,4 +14,5 @@ LL | m!(dyn Copy + Send + 'static);

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0038`.
Some errors have detailed explanations: E0038, E0224.
For more information about an error, try `rustc --explain E0038`.
1 change: 1 addition & 0 deletions src/test/ui/traits/trait-object-vs-lifetime-2.stderr
Expand Up @@ -6,3 +6,4 @@ LL | dyn 'static +: 'static + Copy,

error: aborting due to previous error

For more information about this error, try `rustc --explain E0224`.
3 changes: 2 additions & 1 deletion src/test/ui/traits/trait-object-vs-lifetime.stderr
Expand Up @@ -30,4 +30,5 @@ LL | let _: S<dyn 'static +, 'static>;

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0107`.
Some errors have detailed explanations: E0107, E0224.
For more information about an error, try `rustc --explain E0107`.
1 change: 1 addition & 0 deletions src/test/ui/traits/wf-trait-object-only-maybe-bound.stderr
Expand Up @@ -12,3 +12,4 @@ LL | type _0 = dyn ?Sized;

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0224`.