From f8fb24f18fcdea9b5ae7dcdb90fa68d618eb1e0b Mon Sep 17 00:00:00 2001 From: Nixon Date: Fri, 29 Nov 2019 22:16:26 +0000 Subject: [PATCH 1/2] Add explanation message for E0203 --- src/librustc_error_codes/error_codes.rs | 3 +-- src/librustc_error_codes/error_codes/E0203.md | 12 ++++++++++++ src/test/ui/maybe-bounds-where.stderr | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/librustc_error_codes/error_codes/E0203.md diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index 709ccce517a36..7f111b42403b5 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -107,6 +107,7 @@ E0199: include_str!("./error_codes/E0199.md"), E0200: include_str!("./error_codes/E0200.md"), E0201: include_str!("./error_codes/E0201.md"), E0202: include_str!("./error_codes/E0202.md"), +E0203: include_str!("./error_codes/E0203.md"), E0204: include_str!("./error_codes/E0204.md"), E0205: include_str!("./error_codes/E0205.md"), E0206: include_str!("./error_codes/E0206.md"), @@ -446,8 +447,6 @@ E0745: include_str!("./error_codes/E0745.md"), // E0190, // deprecated: can only cast a &-pointer to an &-object // E0194, // merged into E0403 // E0196, // cannot determine a type for this closure - E0203, // type parameter has more than one relaxed default bound, - // and only one is supported E0208, // E0209, // builtin traits can only be implemented on structs or enums E0212, // cannot extract an associated type from a higher-ranked trait bound diff --git a/src/librustc_error_codes/error_codes/E0203.md b/src/librustc_error_codes/error_codes/E0203.md new file mode 100644 index 0000000000000..792ed3cb8bb8f --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0203.md @@ -0,0 +1,12 @@ +Having multiple relaxed default bounds is unsuported. + +Erroneous code example: + +```compile_fail,E0203 + +trait Foo {} + +struct S5(*const T) where T: ?Foo + ?Sized; +``` + +Here the type `T` cannot have a relaxed bound for both `Foo` and `Sized` diff --git a/src/test/ui/maybe-bounds-where.stderr b/src/test/ui/maybe-bounds-where.stderr index 15cbce46f0a9b..19f9cd28a9a01 100644 --- a/src/test/ui/maybe-bounds-where.stderr +++ b/src/test/ui/maybe-bounds-where.stderr @@ -42,3 +42,4 @@ LL | struct S5(*const T) where T: ?Trait<'static> + ?Sized; error: aborting due to 6 previous errors +For more information about this error, try `rustc --explain E0203`. From a52eb05ec6407054a0549b336fa746b62e1d22c0 Mon Sep 17 00:00:00 2001 From: Nixon Date: Sat, 30 Nov 2019 10:56:07 +0000 Subject: [PATCH 2/2] Address review comments --- src/librustc_error_codes/error_codes/E0203.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0203.md b/src/librustc_error_codes/error_codes/E0203.md index 792ed3cb8bb8f..1edb519275f79 100644 --- a/src/librustc_error_codes/error_codes/E0203.md +++ b/src/librustc_error_codes/error_codes/E0203.md @@ -1,12 +1,18 @@ -Having multiple relaxed default bounds is unsuported. +Having multiple relaxed default bounds is unsupported. Erroneous code example: ```compile_fail,E0203 +struct Bad{ + inner: T +} +``` -trait Foo {} +Here the type `T` cannot have a relaxed bound for multiple default traits +(`Sized` and `Send`). This can be fixed by only using one relaxed bound. -struct S5(*const T) where T: ?Foo + ?Sized; ``` - -Here the type `T` cannot have a relaxed bound for both `Foo` and `Sized` +struct Good{ + inner: T +} +```