From 38f9cd4d696a729dcf832a62af0f2eb43908bafb Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 27 Nov 2019 13:51:38 +0100 Subject: [PATCH 1/3] Clean up E0080 long explanation --- src/librustc_error_codes/error_codes/E0080.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0080.md b/src/librustc_error_codes/error_codes/E0080.md index 262bf00d38540..273238a943b4f 100644 --- a/src/librustc_error_codes/error_codes/E0080.md +++ b/src/librustc_error_codes/error_codes/E0080.md @@ -1,14 +1,18 @@ -This error indicates that the compiler was unable to sensibly evaluate a -constant expression that had to be evaluated. Attempting to divide by 0 -or causing integer overflow are two ways to induce this error. For example: +A constant value failed to get evaluated. + +Erroneous code example: ```compile_fail,E0080 enum Enum { X = (1 << 500), - Y = (1 / 0) + Y = (1 / 0), } ``` +This error indicates that the compiler was unable to sensibly evaluate a +constant expression that had to be evaluated. Attempting to divide by 0 +or causing an integer overflow are two ways to induce this error. + Ensure that the expressions given can be evaluated as the desired integer type. See the FFI section of the Reference for more information about using a custom integer type: From ce696101c492964c31d5f368b27e6f2027af8f07 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 27 Nov 2019 13:51:44 +0100 Subject: [PATCH 2/3] Clean up E0081 long explanation --- src/librustc_error_codes/error_codes/E0081.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0081.md b/src/librustc_error_codes/error_codes/E0081.md index ec88ca9765e29..fd5eca68e21fd 100644 --- a/src/librustc_error_codes/error_codes/E0081.md +++ b/src/librustc_error_codes/error_codes/E0081.md @@ -1,21 +1,23 @@ -Enum discriminants are used to differentiate enum variants stored in memory. -This error indicates that the same value was used for two or more variants, -making them impossible to tell apart. +A discrimant value is present more than once. + +Erroneous code example: ```compile_fail,E0081 -// Bad. enum Enum { P = 3, - X = 3, + X = 3, // error! Y = 5, } ``` +Enum discriminants are used to differentiate enum variants stored in memory. +This error indicates that the same value was used for two or more variants, +making it impossible to distinguish them. + ``` -// Good. enum Enum { P, - X = 3, + X = 3, // ok! Y = 5, } ``` @@ -27,7 +29,7 @@ variants. ```compile_fail,E0081 enum Bad { X, - Y = 0 + Y = 0, // error! } ``` From 7edaebaf6ab309bd4730988ac5978c42a9159fea Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 27 Nov 2019 13:51:50 +0100 Subject: [PATCH 3/3] Clean up E0091 long explanation --- src/librustc_error_codes/error_codes/E0091.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0091.md b/src/librustc_error_codes/error_codes/E0091.md index 2a092402429f1..03cb32803715e 100644 --- a/src/librustc_error_codes/error_codes/E0091.md +++ b/src/librustc_error_codes/error_codes/E0091.md @@ -1,5 +1,6 @@ -You gave an unnecessary type or const parameter in a type alias. Erroneous -code example: +An unnecessary type or const parameter was given in a type alias. + +Erroneous code example: ```compile_fail,E0091 type Foo = u32; // error: type parameter `T` is unused