-
Notifications
You must be signed in to change notification settings - Fork 4
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
expected string literal #18
Comments
And what is the actual error you get when you compile it? Pretty sure this is just |
@kyrias It can compile and run normally, with the output being correct, but Rust Analyzer issues an error. table: userscode:#[derive(Debug)]
struct OutputType {
id: i32,
name: String,
}
async fn query_conditional(db: &MySqlPool) -> Result<(), sqlx::Error> {
let limit = Some(5);
let rows: Vec<OutputType> = conditional_query_as!(
OutputType,
r#"
select id, name from users
{#limit}
"#,
#limit = match limit {
Some(_) => "limit {limit}",
None => ""
},
)
.fetch_all(db)
.await?;
for row in rows {
debug!("-------------------");
debug!("{}", row.id);
debug!("{}", row.name);
}
Ok(())
} The output result is:
ISSUE expected string literal |
@kyrias When you have time, could you please resolve it as soon as possible? |
It's a rust-analyzer bug where it appears to now be expanding macros differently from how the Rust compiler does, so there's nothing I can do here other than try to report it to them when I have the time. |
@kyrias Thanks. |
I posted it to rust-analizer repo rust-lang/rust-analyzer#18686. If you have more input, just write a comment there |
The text was updated successfully, but these errors were encountered: