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

Tuple Struct interior can't be accessed via .0.0 #309

Closed
nipunn1313 opened this issue Jul 11, 2024 · 1 comment · Fixed by #310
Closed

Tuple Struct interior can't be accessed via .0.0 #309

nipunn1313 opened this issue Jul 11, 2024 · 1 comment · Fixed by #310

Comments

@nipunn1313
Copy link

nipunn1313 commented Jul 11, 2024

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ada5458f736b0dd393bbe31e10b4ff31

use thiserror::Error;

#[derive(Debug)]
pub struct S1(String);

#[derive(Debug)]
pub struct S2 {
    inner: String,
}

#[derive(Debug, Error)]
pub enum BigError {
    #[error("{:?}", .0)]
    E1(S1),
    #[error("{}", .0.inner)]
    E2(S2),
    
    #[error("{}", .0.0)]
    E3(S2),
}

fn main() {
}

E1 and E2 compile.
E3 fails to compile with

error: expected expression, found `.`
  --> src/main.rs:18:19
   |
18 |     #[error("{}", .0.0)]
   |                   ^ expected expression

I found it a bit surprising - it seems like it should work.

convex-copybara bot pushed a commit to get-convex/convex-backend that referenced this issue Jul 11, 2024
We were accidentally printing the schema out twice. Probably a copy-paste error.

Provided both table_name and suggested_table into the error even though
it's redundant because of
dtolnay/thiserror#309

GitOrigin-RevId: 18bb7edece0cc7ea1499c46a90626dd83f6d1f53
@nipunn1313
Copy link
Author

thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant