-
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
Force vec![] to expression position only #81080
Conversation
Superb, thanks! @bors r+ |
📌 Commit 23a7aaada1ef1bc8428bbff94cffb0f6d680b91b has been approved by |
I would love if we ever got the suggestion back, but it is super low priority 😅 |
maybe we can get it to actually work in patterns once we have deref or box patterns or whatever ends up becoming stable |
That'd be a great possibility, but would want us to lint against "expensive" pattern derefs in some form :) |
Unfortunately, this new If this is fixing a high priority issue, we can merge it now and deal with that problem later. But otherwise I'd prefer finding a different solution that doesn't leak to the public interface. Maybe something like @bors r- |
Nice! If you make it a |
All right, that's way more complicated than necessary here and could have been done once the macro gets used in more than one place, but whatever :) Thanks for the how-to. TIL: pub macro exists |
Yeah, maybe. But in general I think it's good to leave implementation details like this out of the root of the crate. The public interface of core/alloc/std is a sacred place. ^^ Any idea what happened with Cargo.lock? It's downgrading |
Apart from the fact that I accidentally committed it, I have no idea. I'll fix it asap, thanks for noticing :)
Fair enough :) |
Thanks! @bors r=oli-obk,m-ou-se |
📌 Commit c127ed6 has been approved by |
Rollup of 13 pull requests Successful merges: - rust-lang#79298 (correctly deal with late-bound lifetimes in anon consts) - rust-lang#80031 (resolve: Reject ambiguity built-in attr vs different built-in attr) - rust-lang#80201 (Add benchmark and fast path for BufReader::read_exact) - rust-lang#80635 (Improve diagnostics when closure doesn't meet trait bound) - rust-lang#80765 (resolve: Simplify collection of traits in scope) - rust-lang#80932 (Allow downloading LLVM on Windows and MacOS) - rust-lang#80983 (Remove is_dllimport_foreign_item definition from cg_ssa) - rust-lang#81064 (Support non-stage0 check) - rust-lang#81080 (Force vec![] to expression position only) - rust-lang#81082 (BTreeMap: clean up a few more comments) - rust-lang#81084 (Use Option::map instead of open-coding it) - rust-lang#81095 (Use Option::unwrap_or instead of open-coding it) - rust-lang#81107 (Add NonZeroUn::is_power_of_two) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
I'd rather we use |
There are implementation instructions for a macro solution in #81080 (comment) I think it's ok to move to an unstable |
The downside is that |
See #81241 |
…li-obk Turn alloc's force_expr macro into a regular macro_rules. This turns `alloc`'s `force_expr` macro into a regular `macro_rules`. Otherwise rust-analyzer doesn't understand `vec![]`. See rust-lang/rust-analyzer#7349 and rust-lang#81080 (comment) Edit: See rust-lang#81241 (comment) for a discussion of alternatives.
r? @oli-obk
I went with the lazy way of only changing what broke. I moved the test to ui/macros because the diagnostics no longer give suggestions.
Closes #61933