aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/config/rust.amazon.properties10
-rw-r--r--lib/formatters/rustfmt.ts2
2 files changed, 9 insertions, 3 deletions
diff --git a/etc/config/rust.amazon.properties b/etc/config/rust.amazon.properties
index cfa427ee6..f08301c80 100644
--- a/etc/config/rust.amazon.properties
+++ b/etc/config/rust.amazon.properties
@@ -944,10 +944,14 @@ tools.osacatrunk.type=postcompilation
tools.osacatrunk.class=osaca-tool
tools.osacatrunk.stdinHint=disabled
-tools.rustfmt1436.name=rustfmt (1.4.36)
-tools.rustfmt1436.exe=/opt/compiler-explorer/rustfmt-1.4.36/rustfmt
+# This tool has the "rustfmmt1436" name for legacy reasons. It was initially introduced when Rustfmt was a separate
+# component, not distributed with the Rust compiler. The tool is still named "rustfmt1436" to avoid breaking existing
+# shortlinks.
+tools.rustfmt1436.name=rustfmt (1.77.0)
+tools.rustfmt1436.exe=/opt/compiler-explorer/rust-1.77.0/bin/rustfmt
tools.rustfmt1436.type=independent
tools.rustfmt1436.class=rustfmt-tool
tools.rustfmt1436.stdinHint=disabled
tools.rustfmt1436.languageId=rust
-tools.rustfmt1436.options=--emit stdout
+# Force edition 2021 to support most modern syntax features
+tools.rustfmt1436.options=--emit stdout --edition 2021
diff --git a/lib/formatters/rustfmt.ts b/lib/formatters/rustfmt.ts
index b81eeeef4..1cba03aad 100644
--- a/lib/formatters/rustfmt.ts
+++ b/lib/formatters/rustfmt.ts
@@ -41,6 +41,8 @@ export class RustFmtFormatter extends BaseFormatter {
`hard_tabs=${options.useSpaces ? 'false' : 'true'}`,
'--config',
`tab_spaces=${options.tabWidth}`,
+ // Force edition 2021 to support most modern syntax features
+ '--edition 2021',
];
return await exec.execute(this.formatterInfo.exe, args, {input: source});
}