Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Import json_internal #1013

Closed
wants to merge 1 commit into from
Closed

Import json_internal #1013

wants to merge 1 commit into from

Conversation

Xanewok
Copy link
Member

@Xanewok Xanewok commented Aug 24, 2018

Fixing error from rust-lang/rust#53610 (comment), specifically https://ci.appveyor.com/project/rust-lang/rust/build/1.0.8732/job/1vio56we88sawdcb#L11560.

error: cannot find macro `json_internal!` in this scope
   --> tools\rls\src\actions\mod.rs:506:9
    |
506 | /         json!({
507 | |             "watchers": watchers
508 | |         })
    | |__________^
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

Confirmed the error and the fix while using rust-lang/rust@61b0072.

@Xanewok
Copy link
Member Author

Xanewok commented Aug 24, 2018

Here's a log with -Z external-macro-backtrace in local Rust repo:

C:\Users\Xanewok\Documents\rust>cargo rustc --target x86_64-pc-windows-msvc -j 12 --manifest-path C:\\Users\\Xanewok\\Documents\\rust\\src/tools/rls\\Cargo.toml --features clippy -- -Z external-macro-backtrace
   Compiling rls v0.130.5 (file:///C:/Users/Xanewok/Documents/rust/src/tools/rls)
error: cannot find macro `json_internal!` in this scope
   --> <json macros>:1:30
    |
1   |   ( $ ( $ json : tt ) + ) => { json_internal ! ( $ ( $ json ) + ) } ;
    |   -----------------------------^^^^^^^^^^^^^------------------------- in this expansion of `json!`
    |
   ::: tools\rls\src\actions\mod.rs:506:9
    |
506 | /         json!({
507 | |             "watchers": watchers
508 | |         })
    | |__________- in this macro invocation

(mod.rs:506)

@dtolnay do you have any idea on why it pops only on Windows?

@dtolnay
Copy link
Member

dtolnay commented Aug 24, 2018

I don't know why this would happen on Windows only. Is the Windows build using the most recent version of serde_json and the most recent nightly compiler?

As the name suggests, json_internal is not a public API so be aware that we will break your code if you refer to it. I would recommend finding a different fix.

@nrc
Copy link
Member

nrc commented Aug 25, 2018

This seems like a naming/hygiene issue in Rust 2018. Could you file an issue, if there isn't one already please? It does seem really bad to need to use json_internal. If it's the only workaround, could you add a comment that it should be removed.

@Xanewok
Copy link
Member Author

Xanewok commented Aug 25, 2018

@dtolnay we're using serde_json 1.0.24 but it seems that serde-rs/json@e40cbad is in 1.0.25 - I'll update serde_json then and see if we won't have to pull in json_internal.

EDIT: False alert, didn't notice that python x.py build updated RLS submodule when building against current Rust master; it seems we're using serde_json 1.0.26 and that's the newest.

@Xanewok
Copy link
Member Author

Xanewok commented Aug 25, 2018

Not required as of rust-lang/rust#53701, turns out that updating serde_json in Rust repo seemed to have fixed the problem.

Cargo workspaces are surely convenient but sometimes it's really not obvious you're still affected by the parent dir/Cargo.toml - it took me some time to realize that the RLS submodule Cargo.lock (with serde_json 1.0.26) is not respected in favour of the Rust CI lockfile (with 1.0.24) 😢

Closing this.

@Xanewok Xanewok closed this Aug 25, 2018
@Xanewok Xanewok deleted the Xanewok-patch-2 branch August 25, 2018 16:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants