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

proc_macro does not have a constructor for c string literals #118560

Closed
Tracked by #105723
MaxVerevkin opened this issue Dec 3, 2023 · 3 comments
Closed
Tracked by #105723

proc_macro does not have a constructor for c string literals #118560

MaxVerevkin opened this issue Dec 3, 2023 · 3 comments
Labels
A-proc-macros Area: Procedural macros C-bug Category: This is a bug. F-c_str_literals `#![feature(c_str_literals)]` T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@MaxVerevkin
Copy link

C string literals have been stabilized (#117472) but there is no way to create them in proc macros.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 3, 2023
@fmease fmease added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-bug Category: This is a bug. T-libs Relevant to the library team, which will review and decide on the PR/issue. A-proc-macros Area: Procedural macros F-c_str_literals `#![feature(c_str_literals)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 3, 2023
@Noratrieb
Copy link
Member

That's not good, I'm sure a PR adding it would be welcome. cc @rust-lang/libs-api

@fmease fmease assigned fmease and unassigned fmease Dec 10, 2023
compiler-errors added a commit to compiler-errors/rust that referenced this issue Jan 17, 2024
…ls, r=Amanieu

proc_macro: Add Literal::c_string constructor

Adds a constructor for C string literals, hopefully starts addressing rust-lang#118560.

Tracking issue: rust-lang#119750
bors added a commit to rust-lang-ci/rust that referenced this issue Jan 17, 2024
…, r=Amanieu

proc_macro: Add Literal::c_string constructor

Adds a constructor for C string literals, hopefully starts addressing rust-lang#118560.

Tracking issue: rust-lang#119750
@novafacing
Copy link
Contributor

This should be resolved by #119750 / #119651. C String literals can now be constructed like:

let lit = proc_macro::Literal::c_string(c"a");

(or, equivalently)

let lit = proc_macro::Literal::c_string(&std::ffi::CString::new("a").unwrap());

@fmease
Copy link
Member

fmease commented Jan 18, 2024

Closing as superseded by the libs-api tracking issue.

@fmease fmease closed this as completed Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-proc-macros Area: Procedural macros C-bug Category: This is a bug. F-c_str_literals `#![feature(c_str_literals)]` T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants