ptal / oak

A typed parser generator embedded in Rust code for Parsing Expression Grammars
Apache License 2.0
142 stars 14 forks source link

Fixed lifetimes conflicting requirements. #81

Closed goyox86 closed 8 years ago

goyox86 commented 8 years ago

Hi @ptal !

I was trying to update Oak to build on latest master. I've fixed pretty much all errrors but I can't tackle this one:

~/C/r/oak ❯❯❯ cargo build                                                                                                      V goyox86-fix-latest-nightly ◼
   Compiling oak v0.3.16 (file:///Users/goyox86/Code/rust/oak)
src/liboak/lib.rs:42:36: 42:52 error: type mismatch resolving `for<'cx, 'r> <fn(&'cx mut syntax::ext::base::ExtCtxt<'cx>, syntax::codemap::Span, syntax::ast::
Ident, std::vec::Vec<syntax::ast::TokenTree>) -> Box<syntax::ext::base::MacResult + 'cx> {expand} as std::ops::FnOnce<(&'cx mut syntax::ext::base::ExtCtxt<'r>
, syntax::codemap::Span, syntax::ast::Ident, std::vec::Vec<syntax::ast::TokenTree>)>>::Output == Box<syntax::ext::base::MacResult + 'cx>`:
 expected bound lifetime parameter ,
    found concrete lifetime [E0271]
src/liboak/lib.rs:42     rust::SyntaxExtension::IdentTT(Box::new(expand), None, true));
                                                        ^~~~~~~~~~~~~~~~
src/liboak/lib.rs:42:36: 42:52 help: run `rustc --explain E0271` to see a detailed explanation
src/liboak/lib.rs:42:36: 42:52 note: required because of the requirements on the impl of `syntax::ext::base::IdentMacroExpander` for `fn(&'cx mut syntax::ext:
:base::ExtCtxt<'cx>, syntax::codemap::Span, syntax::ast::Ident, std::vec::Vec<syntax::ast::TokenTree>) -> Box<syntax::ext::base::MacResult + 'cx> {expand}`
src/liboak/lib.rs:42:36: 42:52 note: required for the cast to the object type `syntax::ext::base::IdentMacroExpander + 'static`
src/liboak/lib.rs:42:36: 42:52 error: type mismatch: the type `fn(&'cx mut syntax::ext::base::ExtCtxt<'cx>, syntax::codemap::Span, syntax::ast::Ident, std::ve
c::Vec<syntax::ast::TokenTree>) -> Box<syntax::ext::base::MacResult + 'cx> {expand}` implements the trait `for<'cx> std::ops::Fn<(&'cx mut syntax::ext::base::
ExtCtxt<'cx>, syntax::codemap::Span, syntax::ast::Ident, std::vec::Vec<syntax::ast::TokenTree>)>`, but the trait `for<'cx, 'r> std::ops::Fn<(&'cx mut syntax::
ext::base::ExtCtxt<'r>, syntax::codemap::Span, syntax::ast::Ident, std::vec::Vec<syntax::ast::TokenTree>)>` is required (expected concrete lifetime, found bou
nd lifetime parameter ) [E0281]
src/liboak/lib.rs:42     rust::SyntaxExtension::IdentTT(Box::new(expand), None, true));
                                                        ^~~~~~~~~~~~~~~~
src/liboak/lib.rs:42:36: 42:52 help: run `rustc --explain E0281` to see a detailed explanation
src/liboak/lib.rs:42:36: 42:52 note: required because of the requirements on the impl of `syntax::ext::base::IdentMacroExpander` for `fn(&'cx mut syntax::ext:
:base::ExtCtxt<'cx>, syntax::codemap::Span, syntax::ast::Ident, std::vec::Vec<syntax::ast::TokenTree>) -> Box<syntax::ext::base::MacResult + 'cx> {expand}`
src/liboak/lib.rs:42:36: 42:52 note: required for the cast to the object type `syntax::ext::base::IdentMacroExpander + 'static`
error: aborting due to 2 previous errors
error: Could not compile `oak`.

To learn more, run the command again with --verbose.
~/C/r/oak ❯❯❯  

Any advice so we can merge this fix 😄 ?

ptal commented 8 years ago

Thanks for your pull-request. Actually I'm working on another branch (simple_ast) that modify and improve the code and I will have finished soon. I will update my Rust compiler when I finish and will make it work. I will close this pull request to avoid annoying git merges because your code fixes a lot of lifetime that won't exist anymore! Thank you however!! About the error, I don't really know but I will try to find out soon when I will be at this point ;-)

goyox86 commented 8 years ago

No worries eagerly waiting on that new version :)