Closed Bug 1661961 Opened 4 years ago Closed 4 years ago

Upgrade cstr crate to 0.2.x

Categories

(Core :: General, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
85 Branch
Tracking Status
firefox85 --- fixed

People

(Reporter: xidorn, Assigned: xidorn)

References

Details

Attachments

(1 file)

cstr 0.2 switches away from the procedural macro hack, and uses the proper function-like procedural macro. It requires Rust 1.45 and above. With 0.2.2 and Rust 1.46, cstr macro would also be usable to initialize const as well.

Not likely to see this until FX83?

Any better using 0.2.5?

Summary: Upgrade cstr crate to 0.2 → Upgrade cstr crate to 0.2.x
Depends on: 1671545
No longer depends on: 1644624
Assignee: nobody → xidorn+moz

Somehow can't make it work on try... This is my latest attempt: https://treeherder.mozilla.org/jobs?repo=try&revision=b6cb30b2e0c3832adc92d274c36851f8171d5314

The two Android WR fails have:

[task 2020-12-05T23:15:41.926Z] error[E0432]: unresolved import `proc_macro`
[task 2020-12-05T23:15:41.927Z]   --> /builds/worker/checkouts/gecko/gfx/wr/vendor/cstr/src/lib.rs:23:5
[task 2020-12-05T23:15:41.927Z]    |
[task 2020-12-05T23:15:41.927Z] 23 | use proc_macro::TokenStream as RawTokenStream;
[task 2020-12-05T23:15:41.927Z]    |     ^^^^^^^^^^ help: a similar path exists: `quote::proc_macro`
[task 2020-12-05T23:15:41.927Z] 
[task 2020-12-05T23:15:41.967Z] error: aborting due to previous error

which looks like an error from old days when extern crate proc_macro was still required, like before 1.42.0 was released. On that version cstr 0.2.x definitely can't be compiled.

But I checked the rustc toolchain downloaded in that log, and it seems to be using the exactly same 1.48.0 I'm using locally, and I can't reproduce its result...

It would be appreciated if anyone can shed some light on this.

OK, I know the reason. I think this is because of cargo-apk used in the build somehow invokes rustc directly without passing --extern proc_macro like what cargo normally does. I think that means adding extern crate proc_macro; would fix it.

And it seems to me the latest version of cargo-apk doesn't have this problem, so maybe we should upgrade it.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: