irondash / cargokit

Integrate cargo build with flutter plugins and applications.
Other
51 stars 16 forks source link

`nightly`-only options in `~/.cargo/config.toml` break build of default setup #66

Open virtualritz opened 2 months ago

virtualritz commented 2 months ago

I reported an analogous issue with flutter_rust_bridge and was forwarded to here.

Indeed, it seems it is caused by cargokit using stable even though nightly is set as default on my system and I have nightly-only options in my ~/.cargo/config.toml.

TLDR; how can I tell cargokit to use a nightly toolchain?

Output from flutter run:

Connected devices:
Linux (desktop) • linux  • linux-x64      • Ubuntu 23.10 6.5.11-060511-generic
Chrome (web)    • chrome • web-javascript • Google Chrome 123.0.6312.105
[1]: Linux (linux)
[2]: Chrome (chrome)
Please choose one (or "q" to quit): 1
Launching lib/main.dart on Linux in debug mode...
SEVERE: error: failed to run `rustc` to learn about target-specific information
SEVERE:   error: the option `Z` is only accepted on the nightly compiler
SEVERE:   error: 1 nightly option were parsed
Building Linux application...                                           
Error: Build process failed

And output from flutter run --verbose:

[  +13 ms] executing: uname -m
[   +8 ms] Exit code 0 from: uname -m
[        ] x86_64
[  +80 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +91 ms] executing: /home/moritz/Android/Sdk/platform-tools/adb devices -l
[  +43 ms] List of devices attached
[   +3 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +50 ms] Connected devices:
[ +174 ms] Linux (desktop) • linux  • linux-x64      • Ubuntu 23.10 6.5.11-060511-generic
[        ] Chrome (web)    • chrome • web-javascript • Google Chrome 123.0.6312.105
[        ] [1]: Linux (linux)
[        ] [2]: Chrome (chrome)
[        ] Please choose one (or "q" to quit)
[        ] : 
[+3627 ms] 1
[   +9 ms] Skipping pub get: version match.
[  +71 ms] Found plugin rust_lib_fl_test at /home/moritz/code/zynk/fl_test/rust_builder/
[  +20 ms] Found plugin integration_test at /opt/flutter/packages/integration_test/
[  +45 ms] Found plugin rust_lib_fl_test at /home/moritz/code/zynk/fl_test/rust_builder/
[   +7 ms] Found plugin integration_test at /opt/flutter/packages/integration_test/
[  +29 ms] Found plugin rust_lib_fl_test at /home/moritz/code/zynk/fl_test/rust_builder/
[   +4 ms] Found plugin integration_test at /opt/flutter/packages/integration_test/
[  +47 ms] Generating /home/moritz/code/zynk/fl_test/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[  +60 ms] No packages with native assets. Skipping native assets compilation.
[   +1 ms] Initializing file store
[   +6 ms] Skipping target: gen_localizations
[   +2 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have updated contents: /home/moritz/code/zynk/fl_test/.dart_tool/package_config_subset}
[  +23 ms] Found plugin rust_lib_fl_test at /home/moritz/code/zynk/fl_test/rust_builder/
[   +4 ms] Found plugin integration_test at /opt/flutter/packages/integration_test/
[   +2 ms] gen_dart_plugin_registrant: Complete
[        ] Skipping target: _composite
[   +1 ms] complete
[   +2 ms] Launching lib/main.dart on Linux in debug mode...
[   +2 ms] /opt/flutter/bin/cache/dart-sdk/bin/dartaotruntime --disable-dart-dev /opt/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server_aot.dart.snapshot --sdk-root
/opt/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true
-DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/e76c956498841e1ab458577d3892003e553e4f3c/ --output-dill /tmp/flutter_tools.RMQAWW/flutter_tool.QLDKKW/app.dill --packages
/home/moritz/code/zynk/fl_test/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root
--initialize-from-dill build/129fe64d39a60f20f40290b7a749e2dc.cache.dill.track.dill --verbosity=error --enable-experiment=alternative-invalidation-strategy
[  +17 ms] Building Linux application...
[  +11 ms] <- compile package:fl_test/main.dart
[   +2 ms] executing: [build/linux/x64/debug/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DFLUTTER_TARGET_PLATFORM=linux-x64 /home/moritz/code/zynk/fl_test/linux
[ +142 ms] -- Configuring done (0.1s)
[  +41 ms] -- Generating done (0.0s)
[  +12 ms] -- Build files have been written to: /home/moritz/code/zynk/fl_test/build/linux/x64/debug
[  +11 ms] executing: ninja -C build/linux/x64/debug install
[   +7 ms] ninja: Entering directory `build/linux/x64/debug'
[ +690 ms] [1/6] Generating librust_lib_fl_test.so, _phony_
[   +2 ms] FAILED: plugins/rust_lib_fl_test/librust_lib_fl_test.so plugins/rust_lib_fl_test/_phony_ /home/moritz/code/zynk/fl_test/build/linux/x64/debug/plugins/rust_lib_fl_test/librust_lib_fl_test.so
/home/moritz/code/zynk/fl_test/build/linux/x64/debug/plugins/rust_lib_fl_test/_phony_
[  +20 ms] cd /home/moritz/code/zynk/fl_test/build/linux/x64/debug/plugins/rust_lib_fl_test && /usr/bin/cmake -E env CARGOKIT_CMAKE=/usr/bin/cmake CARGOKIT_CONFIGURATION=Debug
CARGOKIT_MANIFEST_DIR=/home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/.plugin_symlinks/rust_lib_fl_test/linux/../../rust
CARGOKIT_TARGET_TEMP_DIR=/home/moritz/code/zynk/fl_test/build/linux/x64/debug/plugins/rust_lib_fl_test/cargokit_build
CARGOKIT_OUTPUT_DIR=/home/moritz/code/zynk/fl_test/build/linux/x64/debug/plugins/rust_lib_fl_test CARGOKIT_TARGET_PLATFORM=linux-x64
CARGOKIT_TOOL_TEMP_DIR=/home/moritz/code/zynk/fl_test/build/linux/x64/debug/plugins/rust_lib_fl_test/cargokit_build/tool CARGOKIT_ROOT_PROJECT_DIR=/home/moritz/code/zynk/fl_test/linux
/home/moritz/code/zynk/fl_test/rust_builder/cargokit/run_build_tool.sh build-cmake
[   +1 ms] INFO: Precompiled binaries are disabled
[        ] INFO: Building rust_lib_fl_test for x86_64-unknown-linux-gnu
[        ] SEVERE: ================================================================================
[        ] SEVERE: Cargokit BuildTool failed with error:
[        ] SEVERE: --------------------------------------------------------------------------------
[        ] SEVERE: External Command: rustup "run" "stable" "cargo" "build" "--manifest-path" "/home/moritz/code/zynk/fl_test/rust/Cargo.toml" "-p" "rust_lib_fl_test" "--target" "x86_64-unknown-linux-gnu"
"--target-dir" "/home/moritz/code/zynk/fl_test/build/linux/x64/debug/plugins/rust_lib_fl_test/cargokit_build"
[        ] SEVERE: Returned Exit Code: 101
[        ] SEVERE: --------------------------------------------------------------------------------
[        ] SEVERE: STDOUT:
[        ] SEVERE: --------------------------------------------------------------------------------
[        ] SEVERE: STDERR:
[        ] SEVERE: error: failed to run `rustc` to learn about target-specific information
[   +1 ms] SEVERE: 
[        ] SEVERE: Caused by:
[        ] SEVERE:   process didn't exit successfully: `sccache /home/moritz/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names -Z share-generics=y -C
link-arg=--ld-path=/usr/bin/mold --target x86_64-unknown-linux-gnu --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot
--print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
[        ] SEVERE:   --- stderr
[        ] SEVERE:   error: the option `Z` is only accepted on the nightly compiler
[        ] SEVERE: 
[        ] SEVERE:   help: consider switching to a nightly toolchain: `rustup default nightly`
[        ] SEVERE: 
[        ] SEVERE:   note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see <https://rust-lang.github.io/rustup/concepts/index.html>
[        ] SEVERE: 
[        ] SEVERE:   note: for more information about Rust's stability policy, see <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html#unstable-features>
[        ] SEVERE: 
[        ] SEVERE:   error: 1 nightly option were parsed
[        ] SEVERE: --------------------------------------------------------------------------------
[        ] SEVERE: #0      runCommand (package:build_tool/src/util.dart:121:5)
[        ] SEVERE: #1      RustBuilder.build (package:build_tool/src/builder.dart:142:5)
[        ] SEVERE: <asynchronous suspension>
[        ] SEVERE: #2      ArtifactProvider.getArtifacts (package:build_tool/src/artifacts_provider.dart:71:25)
[        ] SEVERE: <asynchronous suspension>
[        ] SEVERE: #3      BuildCMake.build (package:build_tool/src/build_cmake.dart:29:23)
[        ] SEVERE: <asynchronous suspension>
[        ] SEVERE: #4      BuildCMakeCommand.runBuildCommand (package:build_tool/src/build_tool.dart:79:5)
[        ] SEVERE: <asynchronous suspension>
[        ] SEVERE: #5      BuildCommand.run (package:build_tool/src/build_tool.dart:37:5)
[        ] SEVERE: <asynchronous suspension>
[        ] SEVERE: #6      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
[        ] SEVERE: <asynchronous suspension>
[        ] SEVERE: #7      runMain (package:build_tool/src/build_tool.dart:251:5)
[        ] SEVERE: <asynchronous suspension>
[        ] SEVERE: --------------------------------------------------------------------------------
[        ] SEVERE: BuildTool arguments: [build-cmake]
[        ] SEVERE: ================================================================================
[ +776 ms] [2/6] Generating /home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/libflutter_linux_gtk.so, /home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h,
/home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h, /home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h,
/home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h, /home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_engine.h,
/home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h, /home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h,
/home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h, /home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_method_call.h,
/home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h, /home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h,
/home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_method_response.h, /home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h,
/home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h, /home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h,
/home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h, /home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h,
/home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_value.h, /home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/fl_view.h,
/home/moritz/code/zynk/fl_test/linux/flutter/ephemeral/flutter_linux/flutter_linux.h, _phony_
[   +1 ms] [   +9 ms] executing: uname -m
[        ] [   +8 ms] Exit code 0 from: uname -m
[        ] [        ] x86_64
[        ] [  +19 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[        ] [   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [  +65 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [   +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[        ] [  +21 ms] Initializing file store
[        ] [   +5 ms] Done initializing file store
[        ] [  +30 ms] Skipping target: native_assets
[        ] [   +1 ms] Skipping target: gen_localizations
[        ] [   +1 ms] Skipping target: gen_dart_plugin_registrant
[        ] [ +375 ms] Skipping target: unpack_linux
[        ] [ +237 ms] Skipping target: kernel_snapshot
[        ] [ +175 ms] Skipping target: debug_bundle_linux-x64_assets
[        ] [        ] Persisting file store
[        ] [   +6 ms] Done persisting file store
[        ] [   +3 ms] build succeeded.
[        ] [   +5 ms] "flutter assemble" took 941ms.
[        ] [   +1 ms] Running 0 shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [        ] exiting with code 0
[        ] ninja: build stopped: subcommand failed.
[   +7 ms] Building Linux application... (completed in 1,729ms)
[        ] Error: Build process failed
[        ] "flutter run" took 6,128ms.
[   +2 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:815:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1389:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:355:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:295:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:119:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:90:3)
           <asynchronous suspension>

[        ] Running 1 shutdown hook
[   +4 ms] Shutdown hooks complete
[        ] exiting with code 1
knopp commented 2 months ago

I don't think there's solution to this right now. Cargokit takes care of installing whichever toolchain the package requires. Your config basically breaks stable toolchain, which is not expected. Not sure what the best way of handling this would be.

virtualritz commented 2 months ago

Fixed with an edit to one of the answers in the other issue. Kindly pardon the noise.

TLDR; I added rust/cargokit.yaml to the project generated by flutter_rust_bridge_codegen create:

 cargo:
  debug:
    toolchain: nightly
  release:
    toolchain: nightly 
knopp commented 2 months ago

Right. That will work if you're in charge of the package. But if you're using somebody else's package that might still be trying to get build with stable.

virtualritz commented 2 months ago

That is a severe limitation.

knopp commented 2 months ago

Well, the config file basically breaks stable toolchain. It's a bit unexpected :)

virtualritz commented 2 months ago

Well, the config file basically breaks stable toolchain. It's a bit unexpected :)

I would say it's more unexpected that you can't configure your project's local toolchain any more with rustup.

The usefullness of this can't be overstated. Want to use unstable feature (e.g. let chains)? Use nightly. Hit a compiler bug with latest nightly? Lock the toolchain to a previous last-known-good version by date. Etc.

This often includes stuff triggere/required by dependencies.

Not having control over this is just a bummer. And I mean that in a very caring way.

knopp commented 2 months ago

If you want to use certain feature that means you are in charge of the code. For that you can use cargokit.yaml to force the plugin to compile with nightly. The idea here is that plugin author knows best which toolchain the plugin needs to build.

What your setting does is that it injects nightly flag to every cargo invocation.

virtualritz commented 2 months ago

I was mainly referring to this:

Right. That will work if you're in charge of the package. But if you're using somebody else's package that might still be trying to get build with stable.

Rust developers are used to control exactly what tool chain gets used to compile anything Rust, including dependencies they aren't the author of.

Maybe I misunderstand but I read this as: if you use cargokit, this assumption does not hold any more.

Furthermore, rustup override is called override for a reason. It overrides the default.

The 'certain feature' was an example. There are other reasons to force a specific toolchain version.

Consider this case instead: package I don't maintain but depend on uses nightly and breaks (compiler bug). In a normal Rust project I can force the toolchain to something that allows me to keep working. Uninterrupted, apart from the time it takes to d/l the resp. toolchain.

In this case however, I need to fork the resp. dependency and edit the cargokit.yaml of that dependency. And remember that ofc.

That reminds me of dependency management in my C++ days.

I guess I'm saying: there are quite a few well-founded reasons why rustup works the way it does. Not just the two I brought up OTOMH here.

knopp commented 2 months ago

Cargokit is primary meant to be used for plugin creators to write plugins in Rust that seamlessly build as part of Flutter build process. The assumption is that vast majority of target users might not even know what a toolchain is. In which case Cargokit will configure the toolchains, targets and choose the default toolchain depending on what each plugin requires.

It doesn't take into account that user have global rustc flags set that break stable rust. You have a situation on your machine where rustup run stable <anything> fails, which is not expected. If you have a proposed solution that will make this work while letting plugin authors specify which toolchain to use I'll be interested to hear about it.

virtualritz commented 2 months ago

If you have a proposed solution that will make this work while letting plugin authors specify which toolchain to use I'll be interested to hear about it.

It's tricky because the idea that the toolchain is specified for a dependency and the user of the dependency has no way to override that (w/o jumping through aforementioned hoops) is kinda weird for Rust folk.

But since there is one explicitly specified, in cargokit.yaml, I would go for an in-between solutiuon. One that doesn't break/change what you have at the moment but allows people like me to override. Specifically:

  1. Read ~/.rustup/settings.toml.

  2. If the toolchain specified in default_toolchain differs from the one used for the current project or any dependency, print a warning like:

    Using Rust toolchain `stable` from `cargokit.yaml` but active default toolchain from `rustup` is `stable-2023-12-31`

    This will already make what happend to me with my cargo config's nightly-only flags less of a surprise. And contains a hint where to change this.

    Or for a dependency:

    Using Rust toolchain `beta` from `cargokit.yaml` for depdendency `foo` but active default toolchain from `rustup` is `stable-2023-12-31`
  3. If the current project is specified in the [overrides] section of ~/.rustup/settings.toml, read this as: "the user really wants an overrride" and use it, i.e. ignore whatever toolchains any cargokit.yamls (incl. dependencies) this project depends on contains.

    Also print a warning like:

    Using Rust toolchain override `nightly-2024-04-01` from `rustup` and ignoring any toolchains set via `cargokit.yaml` for this project and all dependencies.

Does that make sense?

julian-CStack commented 2 weeks ago

rust stable on one machine may not be the same stable on another.

virtualritz commented 2 weeks ago

That's another good point why the idea of enforcing/assuming stable, as cargokit currently does, is fundamentally flawed.