rustc_artifact.gni to support new edition.--force-warn=rust-2021-compatibility to args.fx clippy --all --raw > lints.json (make sure to add repos --with //bundles/kitchen_sink --with //bundles/buildbot/core)fx shush lints.json --lint rust-2021-compatibility fix (after building shush fx build host-tools/shush)jq '.[] | select(.src[0] | startswith("..")) | .original' out/edition_migration/clippy_target_mapping.json -r | sed 's/(.*$//' | sort -u > /tmp/clippy_targets.txtedition = 2021 for each of them in BUILD.gn.go run cmd/examples/rust_migration "$FUCHSIA_DIR" /tmp/clippy_targets.txt | tee /tmp/migration_log.txtedition = 2018 and make edition requirededition to default to 2021 instead of being required. Or not.jiri update -gc -v
# add `--force-warn=rust-2021-compatibility`
vim ./build/rust/clippy.gni
git commit -a -m "throwaway"
fx set core.x64 --with //bundles/kitchen_sink --with //bundles/buildbot/core
fx clippy --all --raw > lints.json
fx build host-tools/shush
fx shush lints.json --lint rust-2021-compatibility fix
# Pending https://fxbug.dev/42052264 fix
git restore src/settings/service
git commit -a -m "[rust] Edition 2021 fixes"
jq '.[] | select(.src[0] | startswith("..")) | .original' out/default/clippy_target_mapping.json -r | sed 's/(.*$//' | sort -u > /tmp/clippy_targets.txt
cd ~/infra/fuchsia/infra/codifier
jiri update -gc -v
go run cmd/examples/rust_migration/main.go "$FUCHSIA_DIR" /tmp/clippy_targets.txt | tee /tmp/migration_log.txt
git restore src/settings/service
At this point, manual fixups are required:
$ grep "couldn't find" /tmp/migration_log.txt| grep -v //src/tests/fidl/source_compatibility/
couldn't find //src/developer/ffx/daemon/protocols:ffx_daemon_protocols_lib
couldn't find //src/developer/ffx:ffx
couldn't find //src/lib/fuchsia-cxx/examples/basic:example_blobstore_rustc_library
couldn't find //src/storage/fuchsia-fatfs:fatfs
couldn't find //src/storage/fxfs:fxfs
couldn't find //src/sys/pkg/lib/fuchsia-pkg:lib_test
Manually add edition = "2021" to each of the targets in ^
rust_cxx_ffi_library("example_blobstore") and ffx_protocols("ffx_daemon_protocols") hardcodes edition 2018 (and doesnt forward from invocations) so we left it alone
fx gen fails due to component_manager (another template which sets edition itself). This time we updated the template definition to the new edition.
fx gen succeeds
2015 edition opt-outs: * src/lib/mundane/BUILD.gn git restore --source HEAD^ src/lib/mundane/ * git restore --source HEAD^ third_party/rust_crates/compat/rustyline * git -C third_party/rust_crates/mirrors/rustyline reset --hard * git -C third_party/rust_crates/mirrors/quiche reset --hard * git -C third_party/alacritty-migrating/src reset --hard
fx build (fails due to TryInto)
git fetch https://fuchsia.googlesource.com/fuchsia refs/changes/14/684214/5 && git cherry-pick FETCH_HEAD
fx build (works this time)