Skip to content

--crate-type didn't overwrite target.kind in json message output #10389

Closed
@csmoe

Description

@csmoe

Problem

From #10083 The --crate-type from cli should take higher priority than the crate-type specified in Cargo.toml, but it does not changed the json message output as expected.

Steps

copy and paste this shell into your terminal:

cargo new --lib crate-type && \ 
cd crate-type && \
printf '[lib]\ncrate-type = [ "cdylib", "rlib" ]' >> Cargo.toml && \
cargo rustc -Zunstable-options --crate-type=cdylib --message-format=json

output

{"reason":"compiler-artifact","package_id":"crate-type 0.1.0 (path+file:///Users/mac/repo/lark/crate-type)","manifest_path":"/Users/mac/repo/lark/crate-type/Cargo.toml","target":{"kind":["cdylib","rlib"],"crate_types":["cdylib","rlib"],"name":"crate-type","src_path":"/Users/mac/repo/lark/crate-type/src/lib.rs","edition":"2021","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/Users/mac/repo/lark/crate-type/target/debug/libcrate_type.dylib"],"executable":null,"fresh":false}

As you can see, target.kind is still ["cdylib","rlib"].

Possible Solution(s)

No response

Notes

No response

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions