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

Add support for new path dep field #149

Merged
merged 4 commits into from
Jan 15, 2021

Conversation

jonhoo
Copy link
Contributor

@jonhoo jonhoo commented Dec 18, 2020

This is pending for when rust-lang/cargo#8994 eventually lands, and would be very useful for rust-lang/rustfmt#4247 (comment).

@jonhoo jonhoo marked this pull request as ready for review January 6, 2021 00:12
@jonhoo
Copy link
Contributor Author

jonhoo commented Jan 6, 2021

rust-lang/cargo#8994 was just accepted and is being merged. Will land in Rust 1.51 if all goes according to plan.

@jonhoo
Copy link
Contributor Author

jonhoo commented Jan 6, 2021

Is it reasonable to merge this before 1.51 is released, given that it's documented that the field will be None until 1.51? I'm asking specifically because I think rust-lang/rustfmt#4247 needs this to land in order to start taking advantage of the new field in nightly builds.

@oli-obk
Copy link
Owner

oli-obk commented Jan 11, 2021

Yes, seems fine to me to merge this, we just need to change the tests in CI to make sure they work right now

tests/test_samples.rs Outdated Show resolved Hide resolved
@jonhoo
Copy link
Contributor Author

jonhoo commented Jan 11, 2021

@oli-obk I updated the test to only test for a path in 1.51+

path_dep
.path
.as_ref()
.map(|p| p.ends_with("path-dep/Cargo.toml")),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the path ends with Cargo.toml, you may want something more like this:

        assert_eq!(
            path_dep.path.as_ref().unwrap().file_name().unwrap().to_str().unwrap(),
            "path-dep",
        );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, you're right, I forgot to update the path following the change from manifest_path to path upstream. Will fix shortly!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the reason I did not assert the full string was that I believe it will be an absolute path, not a relative path. Is that not the case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an absolute path. The snippet I posted calls file_name just to get the last part. You could also check if it ends with tests/all/path-dep.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, missed the call to file_name. I think ends_with("path-dep") is probably true enough to what we want to test, without the potential of generating false-positives if the test directories get moved around. If you'd strongly prefer the file_name() or a longer prefix for ends_with though, I'd be happy to update the PR.

@jonhoo
Copy link
Contributor Author

jonhoo commented Jan 15, 2021

I think this is now ready to merge and release?

@oli-obk oli-obk merged commit d3f0d7f into oli-obk:main Jan 15, 2021
@oli-obk
Copy link
Owner

oli-obk commented Jan 15, 2021

Jup! Thanks for the ping

@jonhoo jonhoo deleted the manifest-in-local-deps-meta branch January 15, 2021 18:15
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.

3 participants