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

Specify version of Rust required #1214

Closed
BenMorganIO opened this issue Jan 24, 2015 · 6 comments
Closed

Specify version of Rust required #1214

BenMorganIO opened this issue Jan 24, 2015 · 6 comments

Comments

@BenMorganIO
Copy link

Coming from a ruby background, inside of a Gemfile you would be able to specify a version of ruby that your project was using. This was quite helpful.

Example:

source "https://rubygems.org"
ruby "2.2.0"

Since Rust is constantly changing as it nears 1.0 and goes beyond, I'm wondering if Cargo is able to do this? This would be helpful in managing dependencies.

The issue of rust versioning for dependencies occurred when I tried to use start up the nickel demo application. It did not work on rust 1.0.0.alpha.

  • Is there a way for libraries to specify the required version(s) of rust?
  • Is there a place in Cargo.toml to specify your applications version of rust?

Maybe:

[package]

rust = "1.0.0.alpha"
@alexcrichton
Copy link
Member

This specifically is a dupe of #837 and #1044 and is somewhat related to #967.

In general I do not think that we have enough experience with a post-1.0 Rust compiler to render a verdict on whether a feature like this will be necessary right out of the gate. I suspect that what I might imagine the feature would look like today may be quite a different picture a year or so from now.

I'm going to close this for now (as with the dupe issues) for the same reasons, those being that right now I do not believe we want to take action here and we always can do so after the fact :)

@BenMorganIO
Copy link
Author

@alexcrichton I think we might be able to get a half win. Is it valid syntax to add to one's Cargo.toml:

[package]

rust = "1.0.0.alpha"

If it isn't, then I think the best thing is to just allow that and either do nothing with it or include it in the Cargo.lock file. My reasoning is that a version manager for rust is going to pop up sooner or later (if it hasn't already such as rsvm). A version manager should be able to look for a Cargo.lock or Cargo.toml file and if it sees "hey, I'm version x.x.x of rust", then that version manager can auto set it for the developer. Something like what rvm does.

That's the least amount of work and functionality that I can think of from Cargo, everything else belongs to a developer's version manager.

@alexcrichton
Copy link
Member

Currently you can put any valid syntax in a manifest, but you'll get warnings about unused keys. The lockfile also contains a metadata section which is blindly preserved by Cargo to be forwards-compatible with a feature such as this.

@briansmith
Copy link

Here's an example demonstrating the need for this feature: briansmith/ring#521. When code fails to build, there are all kinds of possible reasons. If we know the code won't build with an older version of rustc, then having some way of informing the user of that can save both the user and the crate maintainer a lot of time.

@sanmai-NL
Copy link

sanmai-NL commented Apr 28, 2017

Being unable to specify the rustc version my crate depends on, it is hard to adopt the ergonomic improvements coming with Rust 1.17.

@kornelski
Copy link
Contributor

rust-lang/rfcs#2495

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

No branches or pull requests

5 participants