-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Trying to compile my project but it fails. #125328
Comments
query stack during panic: |
A smaller example with no external dependencies |
@pacak Your example seems to be a different ICE, as it has a different query stack and panics in a different place:
the issue gets reported as:
|
Hmm... I wonder when it changed. Will try again. I guess both ICEs should be fixed. |
Made a single file version again, trying to minimize |
hi back. thanks for the quick responses . i'll investigate all that you have provided me and reach back |
i ... don't know where or how to continue... is this something I'm doing wrong? is it a bug from compiler? |
Internal Compiler Error, you are doing something compiler doesn't expect
You are doing something unexpected, this is a bug in the compiler. I'm not sure what the best path forward would be though. |
Im happy to play my small part in open source :-)
El mar, 21 may 2024, 15:58, pacak ***@***.***> escribió:
… ..... what is an ICE?
Internal Compiler Error, you are doing something compiler doesn't expect
is this something I'm doing wrong? is it a bug from compiler?
You are doing something unexpected, this is a bug in the compiler. I'm not
sure what the best path forward would be though.
—
Reply to this email directly, view it on GitHub
<#125328 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAY43XS54THCFITGKELDAODZDNHJTAVCNFSM6AAAAABH7YKRT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRSG4YDIOJSGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
how can I see, or know, where is this bug coming from? so I can... undo stuff.,.. program things in a different way so that the bug does not happen again? |
You can take my "original file" link and whack at it until it stops panicking. devs at rocket might be of some help... |
Where is that original file? I see the link that you provided and I read
the file but I'm not sure of how to include it in my code. Is it something
that compiler does to transpile my class into different mini
implementations or am I getting at it the wrong way?
Are these files created somehow or cached somehow? How did you get to that
file? Any answer that will help me debug will be very useful. Im a newbie
in this.
In any case I'll keep investigating so thank you for the tip and the
attention to a complete stranger on the internet.
El mar, 21 may 2024, 20:48, pacak ***@***.***> escribió:
… You can take my "original file" link and whack at it until it stops
panicking. devs at rocket might be of some help...
—
Reply to this email directly, view it on GitHub
<#125328 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAY43XWBKEQFRTXPFTBOND3ZDOJITAVCNFSM6AAAAABH7YKRT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRTGI2DCNJUGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
You don't really include in your code. Its a smaller example of whatever causes compiler to panic that doesn't have any external dependencies. So paste it into a new crate and start experimenting. If you manage to convince rustc to compile it without problems - you'll need to apply similar change to your project. |
@troindx The code you are working with includes macros, which can expand to large implementations that themselves may induce compiler errors. Basically, nothing you personally wrote was independently responsible for the error, but rather the macro author's code has inflicted this on you. You can see this by applying the following diff, which cures your compilation issues: diff --git a/src/modules/user/dto.rs b/src/modules/user/dto.rs
index be80520..6cbe8e2 100644
--- a/src/modules/user/dto.rs
+++ b/src/modules/user/dto.rs
@@ -32,7 +32,7 @@ impl<'v> FromFormField<'v> for UserId {
}
}
-#[derive(Debug, Deserialize, Serialize,Clone, FromForm)]
+#[derive(Debug, Deserialize, Serialize,Clone)]
pub struct User<'r> {
pub email : &'r str ,
pub password : &'r str,
@@ -49,10 +49,10 @@ pub enum UserRole {
Admin
}
-#[derive(Debug, FromForm, Deserialize, Serialize,Clone)]
+#[derive(Debug, Deserialize, Serialize,Clone)]
pub struct UserDTO<'a> {
pub user : 'a+ User,
pub jwt_secret : String,
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
pub id : Option <String>
-}
\ No newline at end of file
+} I mean, the code fails typechecking still, but it doesn't ICE. |
The following more significant diff, makes the macros stop producing ICE-generating code: diff --git a/src/modules/user/dto.rs b/src/modules/user/dto.rs
index be80520..f7cc922 100644
--- a/src/modules/user/dto.rs
+++ b/src/modules/user/dto.rs
@@ -33,10 +33,10 @@ impl<'v> FromFormField<'v> for UserId {
}
#[derive(Debug, Deserialize, Serialize,Clone, FromForm)]
-pub struct User<'r> {
- pub email : &'r str ,
- pub password : &'r str,
- pub description : &'r str,
+pub struct User {
+ pub email : String,
+ pub password : String,
+ pub description : String,
pub role : u8,
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
pub _id : Option <UserId>
@@ -50,9 +50,9 @@ pub enum UserRole {
}
#[derive(Debug, FromForm, Deserialize, Serialize,Clone)]
-pub struct UserDTO<'a> {
- pub user : 'a+ User,
+pub struct UserDTO {
+ pub user : User,
pub jwt_secret : String,
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
pub id : Option <String>
-}
\ No newline at end of file
+} @troindx I recommend you apply that for now. |
This was very helpful to understand how macros work in rust.... Thanks.
El mar, 21 may 2024, 23:55, Jubilee ***@***.***> escribió:
… @troindx <https://github.com/troindx> The code you are working with
includes macros, which can expand to large implementations that themselves
may induce compiler errors. Basically, nothing you *personally* wrote was
independently responsible for the error, but rather the macro author's code
has inflicted this on you.
You can see this by applying the following diff, which cures your
compilation issues:
diff --git a/src/modules/user/dto.rs b/src/modules/user/dto.rs
index 352b316..9c98d32 100644--- a/src/modules/user/dto.rs+++ b/src/modules/user/dto.rs@@ -34,7 +34,7 @@ impl<'v> FromFormField<'v> for UserId {
}
}
-#[derive(Debug, Deserialize, Serialize, Clone, FromForm)]+#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct User<'r> {
pub email: &'r str,
pub password: &'r str,@@ -51,7 +51,7 @@ pub enum UserRole {
Admin,
}
-#[derive(Debug, FromForm, Deserialize, Serialize, Clone)]+#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct UserDTO<'a> {
pub user: 'a + User,
pub jwt_secret: String,
—
Reply to this email directly, view it on GitHub
<#125328 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAY43XT4XN6HMN6TZ3VCJADZDO7ELAVCNFSM6AAAAABH7YKRT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRTGUYDGMRZGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Thank you for taking the time to explain this to me.
El mié, 22 may 2024, 0:09, Jubilee ***@***.***> escribió:
… The following more significant diff, makes the macros stop producing
ICE-generating code:
diff --git a/src/modules/user/dto.rs b/src/modules/user/dto.rs
index be80520..f7cc922 100644--- a/src/modules/user/dto.rs+++ b/src/modules/user/dto.rs@@ -33,10 +33,10 @@ impl<'v> FromFormField<'v> for UserId {
}
#[derive(Debug, Deserialize, Serialize,Clone, FromForm)]-pub struct User<'r> {- pub email : &'r str ,- pub password : &'r str,- pub description : &'r str,+pub struct User {+ pub email : String,+ pub password : String,+ pub description : String,
pub role : u8,
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
pub _id : Option <UserId> @@ -50,9 +50,9 @@ pub enum UserRole {
}
#[derive(Debug, FromForm, Deserialize, Serialize,Clone)]-pub struct UserDTO<'a> {- pub user : 'a+ User,+pub struct UserDTO {+ pub user : User,
pub jwt_secret : String,
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
pub id : Option <String> -}
\ No newline at end of file+}
@troindx <https://github.com/troindx> I recommend you apply that for now.
—
Reply to this email directly, view it on GitHub
<#125328 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAY43XT77J3JIBDJI2S7MBTZDPAYJAVCNFSM6AAAAABH7YKRT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRTGUYTQNRVGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I learned why this happened. thanks for accompanying me in my path to becoming a rustacean. |
You solved your problem, but compiler shouldn't panic on invalid input either, this ticket needs to be reopened. |
sure. |
(https://github.com/troindx/oxidize/tree/bug-rust)
Meta
Error output
I am a noob at rust, just trying to teach myself how to code in rust when this showed up.
The text was updated successfully, but these errors were encountered: