Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upCheck dependencies for no_std crates #38509
Comments
steveklabnik
added
A-lang
T-lang
labels
Dec 24, 2016
This comment has been minimized.
This comment has been minimized.
|
@rust-lang/lang , this would be technically-backwards-incompatible modification to |
This comment has been minimized.
This comment has been minimized.
|
Maybe just as a lint then? That would make it backward-compatible. |
This comment has been minimized.
This comment has been minimized.
|
New lints require an RFC. |
This comment has been minimized.
This comment has been minimized.
|
For transitional period of course, but in my opinion this lint should state that in future it will become a hard error. I guess it will depend on how many crates (and versions of them) affected by this issue, if there is just a few of them then it's possible to skip lint stage altogether by contacting crate owners directly and arguing that it's better to yank affected versions, but if there is too many it will have to be just a lint, at least in mid-term. How hard it will be to get this number? |
This comment has been minimized.
This comment has been minimized.
|
Seems like a great lint. Not sure it should ever be an error. Consider if you have a no_std crate with add-on std-using deps. It's more convenient if you can just continue to use |
This comment has been minimized.
This comment has been minimized.
|
I'm just afraid it will be a false guarantee. Personally when I see unconditional For me to have feature-gated Well if we'll go with the eternal lint approach, then this part of the book must be certainly changed:
|
This comment has been minimized.
This comment has been minimized.
|
I agree that this could make a good lint. cc @rust-lang/libs as well. |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
I don't think it should ever be an error. There are legitimate reasons to use |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis |
This comment has been minimized.
This comment has been minimized.
|
@newpavlov maybe I am not understanding, but I believe that one can just write Example: https://is.gd/rd0Pgd |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis Well, if it was not an oversight, but an intentional behaviour (with which I am not quite agree, but can understand) then lint and documentation update will do. I guess it's for @rust-lang/lang to decide. |
This comment has been minimized.
This comment has been minimized.
|
-1 The goal here would be better solved by a conjunction of rust-lang/rfcs#1133 and a way to prohibit a crate from appearing in the build plan. For the latter one can use See rust-lang/rfcs#1783 (comment) were I also propose the same |
This comment has been minimized.
This comment has been minimized.
|
Another case where having this be a hard error would be wrong is as follows. Crate A has an |
This comment has been minimized.
This comment has been minimized.
|
@retep998 |
This comment has been minimized.
This comment has been minimized.
|
@newpavlov That is not how cargo currently works. Right now if two crates depend on A with different feature sets, cargo will just use the union of those features and compile a single A for both crates to use. |
This comment has been minimized.
This comment has been minimized.
|
@retep998 |
newpavlov commentedDec 21, 2016
It's possible to compile
no_stdcrates with dependencies dependent on std. (e.g. generic-array rev. #7f73b31) But as expected it's impossible to use such crate in environments without std. In my opinion when compiler buildsno_stdcrate it also should check ifno_stdwas enabled in all its dependencies, as otherwise we can't consider it independent of std.