-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Teach concat!()
to concatenate byte str literals
#52838
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
Conversation
rfc, const-repeat-expr: notes on is_rvalue_promotable(expr)
Issues are not feature requests
Add missing Copy bound for K in get_default in RFC 2094
Markdown style link for mdbook (same as rust-lang#2199)
Stable SIMD in Rust
Allow `loop` in constant evaluation
Update RFC 0430 to allow underscores between numbers in CamelCase names
The Cretonne project is now renamed to Cranelift. Update the names in the SIMD RFC and add links to the project page.
Rename Cretonne to Cranelift.
Fix link in RFC template and stuff
…unds RFC: Associated type bounds of form `MyTrait<AssociatedType: Bounds>`
(rust_highfive has picked a reviewer for you, use r? to override) |
CC @rust-lang/lang |
I think the new behavior of |
This comment has been minimized.
This comment has been minimized.
src/libsyntax/ast.rs
Outdated
@@ -1300,6 +1300,11 @@ impl LitKind { | |||
} | |||
} | |||
|
|||
/// Returns a `LitKind::ByteStr` from `content`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to have a constructor method, specifically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
src/libsyntax_ext/concat.rs
Outdated
if b_accumulator.len() > 0 { | ||
base::MacEager::expr(cx.expr_lit( | ||
sp, | ||
ast::LitKind::new_byte_str(b_accumulator), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want instead a cx.expr_byte_str
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@kennytm other than bad style of introducing insta-stable behavior, do you foresee any problems with the new behavior? If the PR also included support to mix and match |
@estebank The usual concern there would be if there's some subtle aspect of the new behavior that we don't catch before shipping it, people start relying on that aspect, and we then can't change it even if we want to. |
src/libsyntax_ext/concat.rs
Outdated
.map(|pos| (pos.shrink_to_lo(), "b".to_string())) | ||
.collect(), | ||
); | ||
err.emit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed that this error (and suggestion) will be wrong when doing concat!(b"asdf", true, 3)
.
This comment has been minimized.
This comment has been minimized.
Oh boy... I really messed this up, trying to push to the RFCS repo. Refiled at #52932. |
Fix #52710.