You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
env! has a completely undocumented optional second argument for setting the error message #48044
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.T-libs-api[DEPRECATED; DO NOT USE]
changed the title [-]env! has a completely undocumented optional second argument for setting the "not defined" error[/-][+]env! has a completely undocumented optional second argument for setting the error message[/+]on Feb 7, 2018
I guess the question is: Is removing this an option that is even on the table? Or is the only option at this point to document it?
I wonder how reliable crater would be at finding usages? It does seem to me that the place where this is most likely to be used is in a build script, and there certainly are crates on crates.io with build scripts, but I'd imagine that most have external system dependencies (would crater even test those?).
Why would we want to go through the whole process of cratering and trying to figure out if it's okay to remove when we could just document it as a thing that exists?
I only tossed it out as a theoretical, i.e. "is removing it an option to even consider?" (i.e. can we just fix the docs, or should we wait?)
In order for that to be the case, it would need to be feasible, and there would need to be motivation for it.
My remark was about feasibility, but you're right about the motivation. The feature clearly isn't hurting anybody, so I can't see why anybody would want it to be removed.
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.T-libs-api[DEPRECATED; DO NOT USE]
Activity
[-]env! has a completely undocumented optional second argument for setting the "not defined" error[/-][+]env! has a completely undocumented optional second argument for setting the error message[/+]kennytm commentedon Feb 7, 2018
It was introduced by @sfackler in c3825c8 in Rust 0.8 (along with
option_env!). The relevant test case still exists today. I can't find any 2-argumentenv!calls other than the test cases.ExpHP commentedon Feb 8, 2018
I guess the question is: Is removing this an option that is even on the table? Or is the only option at this point to document it?
I wonder how reliable crater would be at finding usages? It does seem to me that the place where this is most likely to be used is in a build script, and there certainly are crates on crates.io with build scripts, but I'd imagine that most have external system dependencies (would
cratereven test those?).sfackler commentedon Feb 8, 2018
Why would we want to go through the whole process of cratering and trying to figure out if it's okay to remove when we could just document it as a thing that exists?
ExpHP commentedon Feb 8, 2018
I only tossed it out as a theoretical, i.e. "is removing it an option to even consider?" (i.e. can we just fix the docs, or should we wait?)
In order for that to be the case, it would need to be feasible, and there would need to be motivation for it.
My remark was about feasibility, but you're right about the motivation. The feature clearly isn't hurting anybody, so I can't see why anybody would want it to be removed.
Rollup merge of rust-lang#51014 - GuillaumeGomez:env_docs, r=QuietMis…