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

Syntect fails to build when combined with serde #87

Closed
epage opened this issue Jul 4, 2017 · 2 comments · Fixed by #88
Closed

Syntect fails to build when combined with serde #87

epage opened this issue Jul 4, 2017 · 2 comments · Fixed by #88

Comments

@epage
Copy link

epage commented Jul 4, 2017

I ran into this problem with cobalt. I hacked around it by disabling the default features I didn't need.

Example error

error[E0308]: mismatched types
  --> /home/epage/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/syntect-1.7.0/src/parsing/yaml_load.rs:90:34
   |
90 |         if let Ok(map) = get_key(h, "variables", |x| x.as_hash()) {
   |                                  ^ expected struct `std::collections::BTreeMap`, found struct `linked_hash_map::LinkedHashMap`
   |
   = note: expected type `&std::collections::BTreeMap<yaml_rust::Yaml, yaml_rust::Yaml>`
              found type `&linked_hash_map::LinkedHashMap<yaml_rust::Yaml, yaml_rust::Yaml>`
   = help: here are some functions which might fulfill your needs:
           - .hasher()

In case there is something weird we are doing with syntect

@epage
Copy link
Author

epage commented Jul 4, 2017

This is being forked off of #84

@robinst
Copy link
Collaborator

robinst commented Jul 4, 2017

I think the problem is this: dtolnay/serde-yaml#33 which is caused by chyh1990/yaml-rust#44

Basically, one of the dependencies of cobalt (serde-yaml) turns on the preserve_order feature, which changes what type Hash is in yaml-rust from BTreeMap to LinkedHashMap. Syntect expects to be compiled with the default features, which means using BTreeMap.

But I think we might be able to fix it by using the type alias instead of the concrete type instead. Let me try that.

robinst added a commit to robinst/syntect that referenced this issue Jul 4, 2017
This might fix trishume#87, so that syntect can be compiled regardless of
whether yaml-rust's `preserve_order` feature is configured.
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 a pull request may close this issue.

2 participants