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

SyntaxTree is !Send and !Sync in parser 0.7.1 #702

Closed
SimonSapin opened this issue Oct 17, 2023 · 1 comment · Fixed by #704
Closed

SyntaxTree is !Send and !Sync in parser 0.7.1 #702

SimonSapin opened this issue Oct 17, 2023 · 1 comment · Fixed by #704
Assignees
Labels
apollo-parser bug Something isn't working

Comments

@SimonSapin
Copy link
Contributor

From @yanns in https://discord.com/channels/1022972389463687228/1117957327216201758/1163481102049083483, via #469 (comment):

Hi, when I try to upgrade apollo-parser from 0.6.1 to 0.7.1, I have an issue with some types that are not Sync anymore:

error[E0277]: `std::ptr::NonNull<rowan::cursor::NodeData>` cannot be shared between threads safely
   --> src/feature_toggle/plugin.rs:74:17
    |
74  | impl Plugin for FeatureTogglePlugin {
    |                 ^^^^^^^^^^^^^^^^^^^ `std::ptr::NonNull<rowan::cursor::NodeData>` cannot be shared between threads safely
    |
    = help: within `feature_toggle::plugin::FeatureTogglePlugin`, the trait `std::marker::Sync` is not implemented for `std::ptr::NonNull<rowan::cursor::NodeData>`
note: required because it appears within the type `SyntaxNode`
   --> /Users/yannsimon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rowan-0.15.13/src/cursor.rs:146:12
    |
146 | pub struct SyntaxNode {
    |            ^^^^^^^^^^
note: required because it appears within the type `SyntaxNode<GraphQLLanguage>`
   --> /Users/yannsimon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rowan-0.15.13/src/api.rs:16:12
    |
16  | pub struct SyntaxNode<L: Language> {
    |            ^^^^^^^^^^
note: required because it appears within the type `Document`
   --> /Users/yannsimon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/apollo-parser-0.7.1/src/cst/generated/nodes.rs:19:12
    |
19  | pub struct Document {
    |            ^^^^^^^^
note: required because it appears within the type `PhantomData<Document>`
   --> /Users/yannsimon/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/marker.rs:789:12
    |
789 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `SyntaxTree`
   --> /Users/yannsimon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/apollo-parser-0.7.1/src/parser/syntax_tree.rs:55:12
    |
55  | pub struct SyntaxTree<T: CstNode = cst::Document> {
    |            ^^^^^^^^^^

I can fix this one by removing SyntaxTree from the plugin and saving a Arc<String> that I parse each time. It's not the most efficient.

@yanns
Copy link
Contributor

yanns commented Oct 17, 2023

awesome thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apollo-parser bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants