Skip to content
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

Add functions to allow constructing Attributes in a const context #817

Merged
merged 1 commit into from Jan 6, 2024

Conversation

kierdavis
Copy link
Contributor

Previously, the only ways to construct new Attributes values were Attributes::default() or Attributes::from(_), neither of can be made const fn due to limitations of these standard library traits.

@kierdavis
Copy link
Contributor Author

kierdavis commented Aug 30, 2023

I tried to test with the MSRV in Cargo.toml, 1.58.0, but got:

[nix-shell:~/checkouts/crossterm]$ rm -rf Cargo.lock target
[nix-shell:~/checkouts/crossterm]$ cargo version
cargo 1.58.0 (7f08ace4f 2021-11-24)
[nix-shell:~/checkouts/crossterm]$ cargo test
error: failed to parse manifest at `/home/kier/checkouts/crossterm/Cargo.toml`

Caused by:
  namespaced features with the `dep:` prefix are only allowed on the nightly channel and requires the `-Z namespaced-features` flag on the command-line

which I don't think is related to my changes. All tests pass on Rust 1.60.0 (oldest) and 1.72.0 (newest).

Previously, the only ways to construct new `Attributes` values were
`Attributes::default()` or `Attributes::from(_)`, neither of can be
made `const fn` due to limitations of these standard library traits.
@TimonPost TimonPost changed the title add functions to allow constructing Attributes in a const context Add functions to allow constructing Attributes in a const context Jan 6, 2024
@TimonPost TimonPost merged commit 0935196 into crossterm-rs:master Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants