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

On bin crates with both lib.rs and main.rs, recursion_limit hint is correct only for lib.rs #100262

Open
nappa85 opened this issue Aug 8, 2022 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nappa85
Copy link

nappa85 commented Aug 8, 2022

On bin crates with both lib.rs and main.rs, when the compiler overflows evaluating the requirement of a type, it correctly prints an hint like

    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`foo`)
    = note: required because it appears within the type `Foo`
   [...really long list of type requirements...]

If you put it only on main.rs, the error message doesn't change at all, so the first thing the user will think it's the directive has been put on the wrong fiile.
Putting it only on lib.rs changes the error, that loses all the hints and becomes a really concise

error: overflow representing the type `Unique<dyn futures_core::stream::Stream<Item = Result<Foo, Bar>> + Send>`

error: could not compile `foo` due to previous error

At this point the user is lost, the solution is to put the directive on both main.rs and lib.rs, but it's not obvious, the compilerr should hint it

@nappa85 nappa85 added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 8, 2022
@compiler-errors
Copy link
Member

@nappa85 can you provide some sample code?

@nappa85
Copy link
Author

nappa85 commented Aug 9, 2022

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 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

2 participants