Remove noexcepts from Config (#1523)
Some checks failed
benchmark / callgrind (map[branch:main name:luau-lang/benchmark-data], ubuntu-22.04) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:macos version:macos-latest]) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:macos-arm version:macos-14]) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:ubuntu version:ubuntu-latest]) (push) Has been cancelled
build / windows (Win32) (push) Has been cancelled
build / windows (x64) (push) Has been cancelled
build / coverage (push) Has been cancelled
build / web (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:macos version:macos-latest]) (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:ubuntu version:ubuntu-20.04]) (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:windows version:windows-latest]) (push) Has been cancelled
release / web (push) Has been cancelled

Fixes https://github.com/luau-lang/luau/issues/1515.

By removing these `noexcept`s, we guarantee that the internal call to
`std::swap` uses move semantics when a `Config` is copy-assigned.
This commit is contained in:
Varun Saini 2024-11-12 14:25:04 -08:00 committed by GitHub
parent 53e6e4b8f0
commit d1025d0029
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -21,10 +21,10 @@ constexpr const char* kConfigName = ".luaurc";
struct Config struct Config
{ {
Config(); Config();
Config(const Config& other) noexcept; Config(const Config& other);
Config& operator=(const Config& other) noexcept; Config& operator=(const Config& other);
Config(Config&& other) noexcept = default; Config(Config&& other) = default;
Config& operator=(Config&& other) noexcept = default; Config& operator=(Config&& other) = default;
Mode mode = Mode::Nonstrict; Mode mode = Mode::Nonstrict;

View File

@ -17,7 +17,7 @@ Config::Config()
enabledLint.setDefaults(); enabledLint.setDefaults();
} }
Config::Config(const Config& other) noexcept Config::Config(const Config& other)
: mode(other.mode) : mode(other.mode)
, parseOptions(other.parseOptions) , parseOptions(other.parseOptions)
, enabledLint(other.enabledLint) , enabledLint(other.enabledLint)
@ -40,7 +40,7 @@ Config::Config(const Config& other) noexcept
} }
} }
Config& Config::operator=(const Config& other) noexcept Config& Config::operator=(const Config& other)
{ {
if (this != &other) if (this != &other)
{ {