libexpr: Deprecate URL literals
Closes #437. Change-Id: I9f67fc965bb4a7e7fd849e5067ac1cb3bab064cd
This commit is contained in:
@@ -656,10 +656,10 @@ template<> struct BuildAST<grammar::expr::path> : p::maybe_nothing {};
|
||||
|
||||
template<> struct BuildAST<grammar::expr::uri> {
|
||||
static void apply(const auto & in, ExprState & s, State & ps) {
|
||||
bool noURLLiterals = ps.featureSettings.isEnabled(Xp::NoUrlLiterals);
|
||||
if (noURLLiterals)
|
||||
bool URLLiterals = ps.featureSettings.isEnabled(Dep::UrlLiterals);
|
||||
if (!URLLiterals)
|
||||
throw ParseError({
|
||||
.msg = HintFmt("URL literals are disabled"),
|
||||
.msg = HintFmt("URL literals are deprecated, allow using them with --extra-deprecated-features=url-literals"),
|
||||
.pos = ps.positions[ps.at(in)]
|
||||
});
|
||||
s.pushExpr<ExprString>(ps.at(in), in.string());
|
||||
|
||||
@@ -488,7 +488,13 @@ struct FeatureSettings : Config {
|
||||
Setting<std::set<DeprecatedFeature>> deprecatedFeatures{
|
||||
this, {}, "deprecated-features",
|
||||
R"(
|
||||
Deprecated features that are allowed. (Currently there are none.)
|
||||
Deprecated features that are allowed.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
deprecated-features = url-literals
|
||||
```
|
||||
|
||||
The following deprecated feature features can be re-activated:
|
||||
|
||||
|
||||
@@ -24,9 +24,16 @@ struct DeprecatedFeatureDetails
|
||||
* feature, we either have no issue at all if few features are not added
|
||||
* at the end of the list, or a proper merge conflict if they are.
|
||||
*/
|
||||
constexpr size_t numDepFeatures = 0;
|
||||
constexpr size_t numDepFeatures = 1 + static_cast<size_t>(Dep::UrlLiterals);
|
||||
|
||||
constexpr std::array<DeprecatedFeatureDetails, numDepFeatures> depFeatureDetails = {{
|
||||
{
|
||||
.tag = Dep::UrlLiterals,
|
||||
.name = "url-literals",
|
||||
.description = R"(
|
||||
Allow unquoted URLs as part of the Nix language syntax.
|
||||
)",
|
||||
},
|
||||
}};
|
||||
|
||||
static_assert(
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace nix {
|
||||
*/
|
||||
enum struct DeprecatedFeature
|
||||
{
|
||||
UrlLiterals
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user