diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-10-26 11:29:55 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-26 11:29:55 +0530 |
| commit | c9a04cddc02a5b2eaa419dcfdb4e75983a2ab8cd (patch) | |
| tree | 1b82a491e611a83a0e9de06874542333a11dbe17 /src | |
| parent | 785828744c04805d6f81b4ecd093d4460f8e513e (diff) | |
| parent | 74d4eefc1346a8b9242e072df16de4f664b0873c (diff) | |
| download | rust-c9a04cddc02a5b2eaa419dcfdb4e75983a2ab8cd.tar.gz rust-c9a04cddc02a5b2eaa419dcfdb4e75983a2ab8cd.zip | |
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``
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/cfg/cfg-method-receiver-ok.rs | 14 | ||||
| -rw-r--r-- | src/test/ui/cfg/cfg-method-receiver.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/cfg/cfg-method-receiver.stderr | 14 |
3 files changed, 17 insertions, 14 deletions
diff --git a/src/test/ui/cfg/cfg-method-receiver-ok.rs b/src/test/ui/cfg/cfg-method-receiver-ok.rs new file mode 100644 index 00000000000..61ad3b8c17a --- /dev/null +++ b/src/test/ui/cfg/cfg-method-receiver-ok.rs @@ -0,0 +1,14 @@ +// check-pass + +macro_rules! foo { + () => { + #[allow(unreachable_patterns)] + { + 123i32 + } + }; +} + +fn main() { + let _ = foo!().abs(); +} diff --git a/src/test/ui/cfg/cfg-method-receiver.rs b/src/test/ui/cfg/cfg-method-receiver.rs index 78a072f503f..71134ff17b5 100644 --- a/src/test/ui/cfg/cfg-method-receiver.rs +++ b/src/test/ui/cfg/cfg-method-receiver.rs @@ -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 } diff --git a/src/test/ui/cfg/cfg-method-receiver.stderr b/src/test/ui/cfg/cfg-method-receiver.stderr index 517fc8168e7..5767a7c1b4b 100644 --- a/src/test/ui/cfg/cfg-method-receiver.stderr +++ b/src/test/ui/cfg/cfg-method-receiver.stderr @@ -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`. |
