-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Tracking Issue for #![feature(extended_key_value_attributes)]
#78835
Comments
Accept arbitrary expressions in key-value attributes at parse time Continuation of rust-lang#77271. We now support arbitrary expressions in values of key-value attributes at parse time. ``` #[my_attr = EXPR] ``` Previously only unsuffixed literals and interpolated expressions (`$expr`) were accepted. There are two immediate motivational cases for this: - External doc strings (`#[doc = include_str!("my_doc.md")]`, eliminating the need in rust-lang#44732) and expanding macros in this position in general. Currently such macro expansions are supported in this position in interpolated `$expr`s (the `#[doc = $doc]` idiom). - Paths (`#[namespace = foo::bar] extern "C++" { ... }`) like proposed in rust-lang#76734. If the attribute in question survives expansion, then the value is still restricted to unsuffixed literals by a semantic check. This restriction doesn't prevent the use cases listed above, so this PR keeps it in place for now. Closes rust-lang#52607. Previous attempt - rust-lang#67121. Some more detailed write up on internals - https://internals.rust-lang.org/t/macro-expansion-points-in-attributes/11455. Tracking issue - rust-lang#78835.
On the next bootstrap bump, I plan to switch the standard library from using
|
Depends on extended_key_value_attributes, tracked here: rust-lang/rust#78835.
It doesn't work for "sub attributes". For example:
I'm sending a little fix so it is supported as well. |
Use #[doc = include_str!()] in std cc rust-lang#78835 (comment) r? `@jyn514`
Use #[doc = include_str!()] in std cc rust-lang#78835 (comment) r? ``@jyn514``
Use #[doc = include_str!()] in std cc rust-lang#78835 (comment) r? ```@jyn514```
Use #[doc = include_str!()] in std cc rust-lang#78835 (comment) r? ````@jyn514````
Use #[doc = include_str!()] in std cc rust-lang#78835 (comment) r? `````@jyn514`````
I'm having a bit of a weird issue. If I compile the project with this file on Windows, everything is fine. But if I compile it on Ubuntu, I get this:
I don't understand
|
@alexschrod |
- Bump MSRV for rust-lang/rust#78835 - Required by `fltk`: fltk-rs/fltk-rs#1054
- Bump MSRV for rust-lang/rust#78835 - Required by `fltk`: fltk-rs/fltk-rs#1054
Following is 1.53 output Compiling clap_derive v3.0.0 error[E0658]: arbitrary expressions in key-value attributes are unstable --> /home/tshepang/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_derive-3.0.0/src/lib.rs:16:10 | 16 | #![doc = include_str!("../README.md")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #78835 <rust-lang/rust#78835> for more information
The problem was that the Rust compiler version we were using (v1.52.x) seem to have gotten outdated and it would no longer work with wasm-pack. To provide a fix I upgraded the base image of the container to come with Rust v1.57.x and now the build error[1] is no longer present and the test case is passing with the new image that was pushed to ghcr.io. The image tag this was pushed as is: ghcr.io/hyperledger/cactus-rust-compiler:2022-01-12-15d4793c---fix-1646 which is now also the default tag that the RustcContainer class uses in the test-tooling package. [1]: ```sh Compiling bumpalo v3.9.1 �[38;5;9merror[E0658]: arbitrary expressions in key-value attributes are unstable �[38;5;12m--> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/bumpalo-3.9.1/src/lib.rs:1:10 �[38;5;12m| �[38;5;12m1 �[38;5;12m| #![doc = include_str!("../README.md")] �[38;5;12m| �[38;5;9m^^^^^^^^^^^^^^^^^^^^^^^^^^^^ �[38;5;12m| �[38;5;12m= note: see issue #78835 <rust-lang/rust#78835> for more information Compiling wasm-bindgen v0.2.78 �[38;5;9merror: aborting due to previous error For more information about this error, try `rustc --explain E0658`. error: could not compile `bumpalo` ``` Fixes hyperledger-cacti#1646 Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
The problem was that the Rust compiler version we were using (v1.52.x) seem to have gotten outdated and it would no longer work with wasm-pack. To provide a fix I upgraded the base image of the container to come with Rust v1.57.x and now the build error[1] is no longer present and the test case is passing with the new image that was pushed to ghcr.io. The image tag this was pushed as is: ghcr.io/hyperledger/cactus-rust-compiler:2022-01-12-15d4793c---fix-1646 which is now also the default tag that the RustcContainer class uses in the test-tooling package. [1]: ```sh Compiling bumpalo v3.9.1 �[38;5;9merror[E0658]: arbitrary expressions in key-value attributes are unstable �[38;5;12m--> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/bumpalo-3.9.1/src/lib.rs:1:10 �[38;5;12m| �[38;5;12m1 �[38;5;12m| #![doc = include_str!("../README.md")] �[38;5;12m| �[38;5;9m^^^^^^^^^^^^^^^^^^^^^^^^^^^^ �[38;5;12m| �[38;5;12m= note: see issue #78835 <rust-lang/rust#78835> for more information Compiling wasm-bindgen v0.2.78 �[38;5;9merror: aborting due to previous error For more information about this error, try `rustc --explain E0658`. error: could not compile `bumpalo` ``` Fixes #1646 Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
The problem was that the Rust compiler version we were using (v1.52.x) seem to have gotten outdated and it would no longer work with wasm-pack. To provide a fix I upgraded the base image of the container to come with Rust v1.57.x and now the build error[1] is no longer present and the test case is passing with the new image that was pushed to ghcr.io. The image tag this was pushed as is: ghcr.io/hyperledger/cactus-rust-compiler:2022-01-12-15d4793c---fix-1646 which is now also the default tag that the RustcContainer class uses in the test-tooling package. [1]: ```sh Compiling bumpalo v3.9.1 �[38;5;9merror[E0658]: arbitrary expressions in key-value attributes are unstable �[38;5;12m--> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/bumpalo-3.9.1/src/lib.rs:1:10 �[38;5;12m| �[38;5;12m1 �[38;5;12m| #![doc = include_str!("../README.md")] �[38;5;12m| �[38;5;9m^^^^^^^^^^^^^^^^^^^^^^^^^^^^ �[38;5;12m| �[38;5;12m= note: see issue #78835 <rust-lang/rust#78835> for more information Compiling wasm-bindgen v0.2.78 �[38;5;9merror: aborting due to previous error For more information about this error, try `rustc --explain E0658`. error: could not compile `bumpalo` ``` Fixes hyperledger-cacti#1646 Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com> Signed-off-by: aldousalvarez <aldousss.alvarez@gmail.com>
The problem was that the Rust compiler version we were using (v1.52.x) seem to have gotten outdated and it would no longer work with wasm-pack. To provide a fix I upgraded the base image of the container to come with Rust v1.57.x and now the build error[1] is no longer present and the test case is passing with the new image that was pushed to ghcr.io. The image tag this was pushed as is: ghcr.io/hyperledger/cactus-rust-compiler:2022-01-12-15d4793c---fix-1646 which is now also the default tag that the RustcContainer class uses in the test-tooling package. [1]: ```sh Compiling bumpalo v3.9.1 �[38;5;9merror[E0658]: arbitrary expressions in key-value attributes are unstable �[38;5;12m--> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/bumpalo-3.9.1/src/lib.rs:1:10 �[38;5;12m| �[38;5;12m1 �[38;5;12m| #![doc = include_str!("../README.md")] �[38;5;12m| �[38;5;9m^^^^^^^^^^^^^^^^^^^^^^^^^^^^ �[38;5;12m| �[38;5;12m= note: see issue #78835 <rust-lang/rust#78835> for more information Compiling wasm-bindgen v0.2.78 �[38;5;9merror: aborting due to previous error For more information about this error, try `rustc --explain E0658`. error: could not compile `bumpalo` ``` Fixes hyperledger-cacti#1646 Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com> Signed-off-by: aldousalvarez <aldousss.alvarez@gmail.com>
libz-sys crate became incompatible with Alpine 3.13 toolchain (rust 1.47): error: unexpected token: `zng_prefix` --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libz-sys-1.1.8/src/lib.rs:115:19 | 114 | extern "C" { | - while parsing this item list starting here 115 | #[link_name = zng_prefix!(adler32)] | ^^^^^^^^^^ ... 241 | } | - the item list ends here With Alpine 3.14 toolchain (rust 1.52): error[E0658]: arbitrary expressions in key-value attributes are unstable --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libz-sys-1.1.8/src/lib.rs:115:19 | 115 | #[link_name = zng_prefix!(adler32)] | ^^^^^^^^^^^^^^^^^^^^ | = note: see issue #78835 <rust-lang/rust#78835> for more information
beta.4 introduced errors like these: error[E0658]: arbitrary expressions in key-value attributes are unstable --> /Users/ericswanson/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.0.0-beta.4/src/lib.rs:8:10 | 8 | #![doc = include_str!("../README.md")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #78835 <rust-lang/rust#78835> for more information error[E0658]: use of unstable library feature 'osstring_ascii' --> /Users/ericswanson/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.0.0-beta.4/src/parse/matches/matched_arg.rs:130:19 | 130 | v.eq_ignore_ascii_case(val) | ^^^^^^^^^^^^^^^^^^^^ | = note: see issue #70516 <rust-lang/rust#70516> for more information
Implemented in #78837.
With this feature arbitrary expressions are supported in values of key-value attributes at parse time.
Previously only unsuffixed literals and interpolated expressions (
$expr
) were accepted.If the attribute in question survives expansion, then the value is still restricted to unsuffixed literals by a semantic check. This restriction may also be relaxed in the future.
The text was updated successfully, but these errors were encountered: