-
Notifications
You must be signed in to change notification settings - Fork 31
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
cmd!
panics when string contains backslash followed by a line break
#65
Comments
Thought I'd add some extra information. I recompiled a sample on nightly use xshell::{cmd, Shell};
fn main() -> anyhow::Result<()> {
let sh = Shell::new()?;
cmd!(
sh,
"scoop \
--help"
);
Ok(())
}
|
Yeah, this is a bug, will get to fixing this one day if no-one beats me to it. The semantics we want here is the following:
That's the same semantics of escapes that fn main() {
println!("{\x7d", 93)
} The problem with implementing this is that the first step, parsing string literal into string value, is part of Rust semantics, and ideally should be implemented by the compiler. So the proper solution here is to go & RFC https://internals.rust-lang.org/t/getting-value-out-of-proc-macro-literal/14140. While we are waiting for that to happen, we should approximate what rustc is doing. I don't think we need to aim to be 100% correct here, but we obviously should fix panics |
And see also #4 (comment), we need to figure out the correct semantics for quotes as well... |
This panics during macro expansion:
The text was updated successfully, but these errors were encountered: