Rollup merge of #103430 - cjgillot:receiver-attrs, r=petrochenkov
Workaround unstable stmt_expr_attributes for method receiver expressions Fixes https://github.com/rust-lang/rust/issues/103244 cc ``@Mark-Simulacrum`` ``@ehuss``
This commit is contained in:
commit
c9a04cddc0
9 changed files with 121 additions and 19 deletions
14
src/test/ui/cfg/cfg-method-receiver-ok.rs
Normal file
14
src/test/ui/cfg/cfg-method-receiver-ok.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// check-pass
|
||||
|
||||
macro_rules! foo {
|
||||
() => {
|
||||
#[allow(unreachable_patterns)]
|
||||
{
|
||||
123i32
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = foo!().abs();
|
||||
}
|
||||
|
|
@ -7,6 +7,5 @@ macro_rules! cbor_map {
|
|||
|
||||
fn main() {
|
||||
cbor_map! { #[cfg(test)] 4};
|
||||
//~^ ERROR attributes on expressions are experimental
|
||||
//~| ERROR removing an expression is not supported in this position
|
||||
//~^ ERROR removing an expression is not supported in this position
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,3 @@
|
|||
error[E0658]: attributes on expressions are experimental
|
||||
--> $DIR/cfg-method-receiver.rs:9:17
|
||||
|
|
||||
LL | cbor_map! { #[cfg(test)] 4};
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
|
||||
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
|
||||
|
||||
error: removing an expression is not supported in this position
|
||||
--> $DIR/cfg-method-receiver.rs:9:17
|
||||
|
|
||||
|
|
@ -28,7 +19,6 @@ help: you must specify a concrete type for this numeric value, like `i32`
|
|||
LL | cbor_map! { #[cfg(test)] 4_i32};
|
||||
| ~~~~~
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0658, E0689.
|
||||
For more information about an error, try `rustc --explain E0658`.
|
||||
For more information about this error, try `rustc --explain E0689`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue