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

The compiler gets hopelessly confused on enum S(usize); #80043

Open
jyn514 opened this issue Dec 15, 2020 · 5 comments
Open

The compiler gets hopelessly confused on enum S(usize); #80043

jyn514 opened this issue Dec 15, 2020 · 5 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Dec 15, 2020

I think the error speaks for itself.

Here is the change I made, applied to 025f0e649e3a9869e42148ee8cf3041e24a13e8c.

diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs
index 26b630440a1..4c2f3b5ce43 100644
--- a/src/librustdoc/clean/types.rs
+++ b/src/librustdoc/clean/types.rs
@@ -1163,33 +1163,7 @@ fn def_id(&self) -> Option<DefId> {
 }
 
 #[derive(Clone, PartialEq, Eq, Hash, Copy, Debug)]
-crate enum PrimitiveType {
-    Isize,
-    I8,
-    I16,
-    I32,
-    I64,
-    I128,
-    Usize,
-    U8,
-    U16,
-    U32,
-    U64,
-    U128,
-    F32,
-    F64,
-    Char,
-    Bool,
-    Str,
-    Slice,
-    Array,
-    Tuple,
-    Unit,
-    RawPointer,
-    Reference,
-    Fn,
-    Never,
-}
+crate enum PrimitiveType(Symbol);
 
 #[derive(Clone, PartialEq, Eq, Hash, Copy, Debug)]
 crate enum TypeKind {

errors.log edit: this is the wrong logfile, see below

I think the main thing making this so awful (1429 errors) is that it continues to try and do name resolution afterwards. I would not expect any errors other than further syntax errors to be reported.

@jyn514 jyn514 added A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. labels Dec 15, 2020
@jyn514
Copy link
Member Author

jyn514 commented Dec 15, 2020

Oh wait what, that's only 126 errors :( I'm not sure what changed between seeing them and opening the issue.

@jyn514
Copy link
Member Author

jyn514 commented Dec 15, 2020

I think most of these are actually reasonable errors coming from deleting the enum variants. Not sure why it had so many the first time, it has 126 consistently now :/

@jyn514 jyn514 closed this as completed Dec 15, 2020
@jyn514
Copy link
Member Author

jyn514 commented Dec 15, 2020

Oh, I applied the wrong diff - that was with crate struct instead of crate enum. So that's good actually, it gives a baseline: I would not expect this to give more than 130 errors or so. Here is the full log from using crate enum instead:
enum-errors.log

@jyn514 jyn514 reopened this Dec 15, 2020
@camelid camelid added the C-bug Category: This is a bug. label Dec 16, 2020
@estebank
Copy link
Contributor

estebank commented Nov 8, 2023

I believe the underlying ask here is to silence resolve errors if they reference modules that have had parse errors. The easiest way to accomplish that would be something like #116904.

CC #74863.

@estebank
Copy link
Contributor

#133937 will mitigate this case, but I don't think it will propagate the "this mod failed to parse" bit through re-exports, which the original issue was a case of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants