-
Notifications
You must be signed in to change notification settings - Fork 13k
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
error[E0506] when using rustc but passes with cargo #61855
Comments
The default edition in rustc is 2015. New cargo projects default to 2018. 2018 now uses non-lexical lifetimes. rustc 1.36 (beta) will also use NLL in the 2015 edition, but the versions you have do not. If you want to use the rustc command line, pass |
@ehuss Thank you! That's definitely something I missed. I will use the information to see how it applies to my code. |
@AbdouSeck filed #61914 for a more holistic approach to these kind of edition discrepancies. This particular problem will go away once we enable NLL in 2015 edition, but the general problem of discrepancies between editions not being explained when encountered are a paper cut that needs fixing. |
@estebank Thanks for making that clear. Please don't hesitate to ask if I can be of any help; especially with documentation. It may take me a little bit to navigate and fully understand the structure of the project though. So, any guidance will be appreciated. |
I am sorry if this turns out to be a duplicate, or an issue directly related with some other issue. I am relatively new to the language.
The following (also linked here) will compile just fine with
cargo run
orcargo build
. However, when compiled withrustc
, I get a compile error:Code:
Error with rustc:
I have, quite frankly, come to terms with the fact that the borrow checker is right about the error here.
self.status
is mutably borrowed atmatch &mut self.status
; so reassigning it with the lineself.status = Status::Sick(vec![d])
should trigger an error. Hence, I see that error by directly invokingrustc
. Not seeing the same error withcargo
has me confused.Summary:
or
or
and
Questions:
Is this a bug or am I missing something?
Thank you,
Abdou
The text was updated successfully, but these errors were encountered: