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

upgrade semver #3154

Merged
merged 8 commits into from
Oct 7, 2016
Merged

upgrade semver #3154

merged 8 commits into from
Oct 7, 2016

Conversation

steveklabnik
Copy link
Member

This is a spike at fixing #3124.

@alexcrichton I'm not sure how to actually emit the error message here. In the TOML example you linked me:

config: &Config) -> CargoResult<toml::Table> {

That takes a Config as an argument. This function does not. What's the right approach here?

Also, this code is messy. I am 99% sure I can write it nicer with combinators. This is just to get the discussion going.

@rust-highfive
Copy link

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

Looking good to me! It should be fine to just thread a Config all the way through to this location as well.

@steveklabnik
Copy link
Member Author

👍 on it

@steveklabnik
Copy link
Member Author

Whew! That was... a lot of stuff. I think I got it though.

I think there might be some places where I didn't need to thread it this much, mostly around workspaces. Also, there's no tests for this in Cargo. I am testing in SemVer, though...

@steveklabnik
Copy link
Member Author

This is still pointing at my special branch, but if the code looks good, I can cut a semver version and fix up the Cargo.toml. But I think this is ready for review.

@@ -27,7 +27,7 @@ pub trait Source: Registry {

/// The download method fetches the full package for each name and
/// version specified.
fn download(&mut self, package: &PackageId) -> CargoResult<Package>;
fn download(&mut self, package: &PackageId, config: &Config) -> CargoResult<Package>;
Copy link
Member

Choose a reason for hiding this comment

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

Most of these Source types already store Config, so I think it may not need to get passed in here?

Copy link
Member

Choose a reason for hiding this comment

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

(which I think may end up backing out a lot of the threading around)

Copy link
Member Author

Choose a reason for hiding this comment

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

ah ha! I did not know that. That would be... great.

ReqParseError::DeprecatedVersionRequirement(requirement) => {
let msg = format!("One of your version requirements ({}) is invalid. \
Previous versions of Cargo accepted this malformed requirement, but it is being deprecated. Please \
use {} instead.", req, requirement);
Copy link
Member

Choose a reason for hiding this comment

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

I think we'll emit this for anything cargo parses, so perhaps something like:

parsed version requirement `{}` is no longer valid

Previous versions of Cargo accepted this malformed requirement,
but it is being deprecated. This was found when parsing the manifest
of iron v1.2.3, and the correct version requirement is `0.2.0`.

This will soon become a hard error, so it's either recommended to
update to a fixed version or contact the upstream maintainer about
this warning.

That is, the requirement may not always be local, so we'll just want to help everyone find the crate at fault asap.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we have the crate name at this point? I thought it was just the version string.

Copy link
Member

Choose a reason for hiding this comment

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

Not immediately on hand, but I think it can be passed through?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's.... not very simple. Saying "Hey the dependency "foo" is, but not which crate has the "foo" dependency. Ugh.

Copy link
Member

Choose a reason for hiding this comment

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

Ah yeah I'm just worried about users looking at this error and not really knowing what to do when the error shows up. The current versions says "one of you version requirements" but that's actually not true if it's coming from some upstream dependency (and then you have to hunt and track that down)

Copy link
Member Author

Choose a reason for hiding this comment

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

I certainly think it has a lot of value. It's just gonna take me a while to figure it all out.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, I think I'm defeated by this. Do you have any advice, @alexcrichton ? Sorry 😦

Copy link
Member

Choose a reason for hiding this comment

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

No worries! I'll take over

Copy link
Member Author

Choose a reason for hiding this comment

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

❤️

@bors
Copy link
Collaborator

bors commented Oct 6, 2016

☔ The latest upstream changes (presumably #3136) made this pull request unmergeable. Please resolve the merge conflicts.

@steveklabnik
Copy link
Member Author

(oh btw @alexcrichton I have the "allow edits from maintainers" so you SHOULD be able to push directly to my branch)

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Collaborator

bors commented Oct 7, 2016

📌 Commit f40f8c6 has been approved by alexcrichton

@steveklabnik
Copy link
Member Author

@bors: r-

@steveklabnik
Copy link
Member Author

Thanks @alexcrichton ! Yeah, you know the source way better than I do.....

I r-'d this because it's still pointing at my unreleased branch; let me cut a semver version.

@alexcrichton
Copy link
Member

@bors: r+

👍

@bors
Copy link
Collaborator

bors commented Oct 7, 2016

📌 Commit 464e6a9 has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Oct 7, 2016

⌛ Testing commit 464e6a9 with merge e7523cd...

bors added a commit that referenced this pull request Oct 7, 2016
upgrade semver

This is a spike at fixing #3124.

@alexcrichton I'm not sure how to actually emit the error message here. In the TOML example you linked me: https://github.com/rust-lang/cargo/blob/5593045ddef2744c1042dee0c0037c2ebcc1834e/src/cargo/util/toml.rs#L166

That takes a Config as an argument. This function does not. What's the right approach here?

Also, this code is messy. I am 99% sure I can write it nicer with combinators. This is just to get the discussion going.
@bors
Copy link
Collaborator

bors commented Oct 7, 2016

☀️ Test successful - cargo-cross-linux, cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64
Approved by: alexcrichton
Pushing e7523cd to master...

@bors bors merged commit 464e6a9 into rust-lang:master Oct 7, 2016
@bors bors mentioned this pull request Oct 7, 2016
@steveklabnik
Copy link
Member Author

Yesssssssssssssssssssssssssssssssssssssssssssss

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.

4 participants