diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-04-01 12:13:57 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-04-01 17:40:27 +1100 |
| commit | 72a28e85d77bab7f1073ad2224d536ae232cfc50 (patch) | |
| tree | 0f77906c83eba7d64d2ad4eaf51b92785167415e /src/test/codegen/src-hash-algorithm | |
| parent | 4c8bf5028f31c0d82bbf46a50b2375131a488623 (diff) | |
| download | rust-72a28e85d77bab7f1073ad2224d536ae232cfc50.tar.gz rust-72a28e85d77bab7f1073ad2224d536ae232cfc50.zip | |
Improve `ModuleConfig` initialization.
There are three `ModuleConfigs`, one for each `ModuleKind`. The code to initialized them is spaghetti imperative code that sets each field to a default value and then modifies many fields in complicated ways. This makes it very hard to tell what value ends up in each field in each config. For example, the `modules_config.emit_pre_lto_bc` field is set twice, which means it can be set to true and then incorrectly set back to false. (This probably hasn't been noticed because it happens in a very obscure case.) This commit changes the code to a declarative style in which `ModuleConfig::new` initializes all fields and then they are never changed again. This is slightly more concise and much easier to read. (And it fixes the abovementioned `emit_pre_lto_bc` error as well.)
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions
