diff --git a/src/dmd/cli.d b/src/dmd/cli.d index e1b5fc94d771..9467105e86e0 100644 --- a/src/dmd/cli.d +++ b/src/dmd/cli.d @@ -765,6 +765,7 @@ dmd -cov -unittest myprog.d static immutable reverts = [ Feature("dip25", "noDIP25", "revert DIP25 changes https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP25.md"), Feature("markdown", "markdown", "disable Markdown replacements in Ddoc"), + Feature("dip1000", "noVsafe", "revert DIP1000 changes https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1000.md"), ]; /// Returns all available previews diff --git a/src/dmd/globals.d b/src/dmd/globals.d index 2a5b1527a354..083d01d9f2a1 100644 --- a/src/dmd/globals.d +++ b/src/dmd/globals.d @@ -202,6 +202,7 @@ extern (C++) struct Param * before becoming default. */ bool vsafe; // use enhanced @safe checking + bool noVsafe; // revert to pre-DIP1000 behavior bool ehnogc; // use @nogc exception handling bool dtorFields; // destruct fields of partially constructed objects // https://issues.dlang.org/show_bug.cgi?id=14246 diff --git a/src/dmd/globals.h b/src/dmd/globals.h index aff48de4a96f..5009b76b8926 100644 --- a/src/dmd/globals.h +++ b/src/dmd/globals.h @@ -177,6 +177,7 @@ struct Param bool fixAliasThis; // if the current scope has an alias this, check it before searching upper scopes bool inclusiveInContracts; // 'in' contracts of overridden methods must be a superset of parent contract bool vsafe; // use enhanced @safe checking + bool noVsafe; // revert to pre-DIP1000 behavior bool ehnogc; // use @nogc exception handling bool dtorFields; // destruct fields of partially constructed objects // https://issues.dlang.org/show_bug.cgi?id=14246 diff --git a/src/dmd/mars.d b/src/dmd/mars.d index 50cb7d9e3163..eea595ae121d 100644 --- a/src/dmd/mars.d +++ b/src/dmd/mars.d @@ -2579,6 +2579,20 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, ref Param continue; } } + + if (!params.vsafe && !params.noVsafe) + { + deprecation( + Loc.initial, + "-preview=dip1000 will become the default then deprecated."); + deprecationSupplemental( + Loc.initial, + "Please use -revert=dip1000 to maintain current behavior."); + deprecationSupplemental( + Loc.initial, + "https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1000.md"); + } + return errors; }