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

Use Rust 2018 edition #885

Merged
merged 1 commit into from
Dec 21, 2019
Merged

Use Rust 2018 edition #885

merged 1 commit into from
Dec 21, 2019

Conversation

samford
Copy link
Contributor

@samford samford commented Dec 19, 2019

Hyper 0.13 uses async but async functions aren't permitted in the 2015 edition of Rust. This migrates Zola to the 2018 edition, so we can continue moving forward with #782.

The main changes to make this work were related to path clarity. Besides that, this allows us to drop some extern crate statements as well. There may be more tidying that can be done but this at least compiles/tests correctly.

@samford samford changed the base branch from master to next December 19, 2019 04:40
@samford samford force-pushed the 2018-edition branch 4 times, most recently from 27b67af to 614e957 Compare December 19, 2019 05:29
@samford
Copy link
Contributor Author

samford commented Dec 19, 2019

For whatever reason, CI was running into errors related to the extern crate statement removals in files in the /components folder, though everything worked fine locally for me (Rust 1.39.0, macOS 10.15). Without those removals, it's now fine on CI.

src/cmd/build.rs Outdated Show resolved Hide resolved
@Keats
Copy link
Collaborator

Keats commented Dec 19, 2019

For the extern crate importing macros, you need to import the macros manually where they are used. I don't know why that would wok locally though

@samford samford force-pushed the 2018-edition branch 2 times, most recently from ee46025 to e6abcbf Compare December 19, 2019 15:14
@samford
Copy link
Contributor Author

samford commented Dec 19, 2019

For the extern crate importing macros, you need to import the macros manually where they are used. I don't know why that would wok locally though

In this latest commit, I've also removed the extern crate statements that were held back due to #[macro_use] and replaced them with use statements in the appropriate files (as described in the Macro changes section of the Edition Guide).

For what it's worth, I hadn't removed the #[macro_use] extern_crate statements in the previous commits, since removing those did cause errors locally. The failing CI tests were simply related to removing extern crate statements in /components. I'm just using a typical install of 1.39.0 using rustup, so I have no idea why my local setup was fine with it but CI wasn't.

@samford samford force-pushed the 2018-edition branch 2 times, most recently from 07e8016 to fc21781 Compare December 21, 2019 05:41
@samford
Copy link
Contributor Author

samford commented Dec 21, 2019

The components are now using the 2018 edition as well, with extern crate statements removed and use statements added where appropriate. I think this should be good, unless there are any other related changes that should be made.

It turns out that the reason why my local tests were different than CI was because I was mistakenly not using the --all flag when running cargo test, so it wasn't testing the components. This is what happens when you stay up too late working, I suppose.

@Keats
Copy link
Collaborator

Keats commented Dec 21, 2019

Ah, that happens a lot to me as well :p
I just merged a pretty big PR, can you rebase by any chance?

@samford
Copy link
Contributor Author

samford commented Dec 21, 2019

I rebased this, resolved the conflicts, and made sure it builds/tests fine, so it should be good to go.

@Keats Keats merged commit 4edc299 into getzola:next Dec 21, 2019
@Keats
Copy link
Collaborator

Keats commented Dec 21, 2019

Perfect, thanks!

@samford samford deleted the 2018-edition branch December 21, 2019 21:55
Keats pushed a commit that referenced this pull request Feb 3, 2020
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 this pull request may close these issues.

2 participants