{"record":{"id":"2e094454d67d0111","repo":"rust-lang/rust","slug":"a-rust-source-path-is-required-with-the-test-arg","errorCode":null,"errorMessage":"A Rust source path is required with the `test` argument","messagePattern":"A Rust source path is required with the `test` argument","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/ci/docker/scripts/fuchsia-test-runner.py","lineNumber":1051,"sourceCode":"                f\"--symbol-path={self.rust_dir}/lib/rustlib/{self.target}/lib\",\n            ]\n\n        # Add rust source if it's available\n        rust_src_map = None\n        if args.rust_src is not None:\n            # This matches the remapped prefix used by compiletest. There's no\n            # clear way that we can determine this, so it's hard coded.\n            rust_src_map = f\"/rustc/FAKE_PREFIX={args.rust_src}\"\n\n        # Add fuchsia source if it's available\n        fuchsia_src_map = None\n        if args.fuchsia_src is not None:\n            fuchsia_src_map = f\"./../..={args.fuchsia_src}\"\n\n        # Load debug symbols for the test binary and automatically attach\n        if args.test is not None:\n            if args.rust_src is None:\n                raise Exception(\n                    \"A Rust source path is required with the `test` argument\"\n                )\n\n            test_name = os.path.splitext(os.path.basename(args.test))[0]\n\n            build_dir = os.path.join(\n                args.rust_src,\n                \"fuchsia-build\",\n                self.host_arch_triple(),\n            )\n            test_dir = os.path.join(\n                build_dir,\n                \"test\",\n                os.path.dirname(args.test),\n                test_name,\n            )\n\n            # The fake-test-src-base directory maps to the suite directory","sourceCodeStart":1033,"sourceCodeEnd":1069,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/src/ci/docker/scripts/fuchsia-test-runner.py#L1033-L1069","documentation":"Raised by TestEnvironment.debug() when the user passes --test but not --rust-src. The --test path is used to construct a source-map and a zxdb attach script that references a Rust source tree; without --rust-src those paths cannot be built. It is a usage error caught early at fuchsia-test-runner.py:1050-1053.","triggerScenarios":"Invoking `fuchsia-test-runner.py debug --test ui/box/new.rs` (or any --test value) without also passing `--rust-src <path>`. The check is `if args.test is not None and args.rust_src is None`.","commonSituations":"Forgetting the --rust-src flag; assuming the runner can infer the Rust source location from the environment; copy-pasting a debug command from docs that omitted the flag.","solutions":["Add --rust-src pointing at your Rust source checkout: `fuchsia-test-runner.py debug --rust-src /path/to/rust --test ui/box/new.rs`.","If you do not need source-level debugging, drop --test and pass raw zxdb args instead.","Set up an alias/shell wrapper that always supplies --rust-src alongside --test."],"exampleFix":"// before\n$ fuchsia-test-runner.py debug --test ui/box/new.rs\n# Exception: A Rust source path is required with the `test` argument\n\n// after\n$ fuchsia-test-runner.py debug --rust-src ~/src/rust --test ui/box/new.rs","handlingStrategy":"validation","validationCode":"if getattr(args, \"test\", None) is not None and not getattr(args, \"rust_src\", None):\n    raise SystemExit(\"--rust-src is required when --test is passed to `debug`.\")\n# safe to call debug()\nenv.debug(args)","typeGuard":"def debug_args_are_valid(args) -> bool:\n    return not (args.test is not None and args.rust_src is None)","tryCatchPattern":"try:\n    test_env.debug(args)\nexcept Exception as e:\n    if \"Rust source path is required\" in str(e):\n        sys.exit(\"Re-run with --rust-src <path> when using --test.\")\n    raise","preventionTips":["Wrap the runner in a shell function that always supplies --rust-src when --test is given.","Document the --test/--rust-src pairing in your team's debug workflow.","Drop --test if you only need raw zxdb attachment."],"tags":["fuchsia","debug","zxdb","cli-args","usage"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}