-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Implement builtin # syntax and use it for offset_of!(...) #110694
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Once |
@clubby789 personally I'd like that, yes. It is imo better to have such a primitive than |
This comment has been minimized.
This comment has been minimized.
It might be better to have a |
Oh I was unaware of rust-lang/compiler-team#460 and #89030 . It seems to be a special case just to support Unwinding seems to be implemented weirdly, order depending on whether there is a panic call or not: struct LoudDrop(u8);
impl Drop for LoudDrop {
fn drop(&mut self) {
println!("dropping {}", self.0);
}
}
fn main() {
{
let _v = vec!(LoudDrop(0), LoudDrop(1));
}
println!("Hi");
{
let _v = vec!(LoudDrop(2), LoudDrop(3), LoudDrop(4), panic!());
}
} prints
anyways we should better discuss this in a separate thread, I want to keep this one dedicated to my PR. Edit: filed #110715 |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
@rustbot ready |
@bors r+ |
📌 Commit d5669bf7f881d194c9c5ff1536c67fa635d4030c has been approved by It is now in the queue for this repository. |
Rollup of 6 pull requests Successful merges: - rust-lang#103056 (Fix `checked_{add,sub}_duration` incorrectly returning `None` when `other` has more than `i64::MAX` seconds) - rust-lang#108801 (Implement RFC 3348, `c"foo"` literals) - rust-lang#110773 (Reduce MIR dump file count for MIR-opt tests) - rust-lang#110876 (Added default target cpu to `--print target-cpus` output and updated docs) - rust-lang#111068 (Improve check-cfg implementation) - rust-lang#111238 (btree_map: `Cursor{,Mut}::peek_prev` must agree) Failed merges: - rust-lang#110694 (Implement builtin # syntax and use it for offset_of!(...)) r? `@ghost` `@rustbot` modify labels: rollup
This comment was marked as resolved.
This comment was marked as resolved.
@bors r+ |
Rollup of 7 pull requests Successful merges: - rust-lang#110304 (Add GNU Property Note) - rust-lang#110504 (Tweak borrow suggestion span) - rust-lang#110583 (tweak "make mut" spans when assigning to locals) - rust-lang#110694 (Implement builtin # syntax and use it for offset_of!(...)) - rust-lang#111120 (Suggest let for possible binding with ty) - rust-lang#111252 (Min specialization improvements) - rust-lang#111361 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Add
builtin #
syntax to the parser, as well as a generic infrastructure to support both item and expression position builtin syntaxes. The PR also uses this infrastructure for the implementation of theoffset_of!
macro, added by #106934.cc @petrochenkov @drmeepster
cc #110680
builtin #
tracking issuecc #106655
offset_of!
tracking issue