Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codegen metadata documentation is not exhaustive #104881

Open
alepez opened this issue Nov 25, 2022 · 0 comments
Open

Codegen metadata documentation is not exhaustive #104881

alepez opened this issue Nov 25, 2022 · 0 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools

Comments

@alepez
Copy link

alepez commented Nov 25, 2022

Location

https://doc.rust-lang.org/rustc/codegen-options/index.html#metadata

Summary

Current rustc -Cmetadata argument documentation:

This option allows you to control the metadata used for symbol mangling. This takes a space-separated list of strings. Mangled symbols will incorporate a hash of the metadata. This may be used, for example, to differentiate symbols between two different versions of the same crate being linked.

I feel it is not evident what is the expected behavior. I'm not talking about how the metadata is used to differentiate symbols, but what are the expected arguments.

Other non-documented rules, which are clear by looking at the code in charge
of generating a stable crate id (compiler/rustc_span/src/def_id.rs)

Metadata is a list of values. The order of such values does not matter.
So one two and two one are equivalent

Metadata values can be added with a single -Cmetadata option, which takes
a value of space-separated values.

Metadata values can also be added by multiple -Cmetadata options.

Every distinct -C metadata value is only incorporated once

A single metadata "ab" has a different meaning than two separated "a" "b"

So these are equivalent:

-Cmetadata=one -Cmetadata=two
-Cmetadata="one two"
-Cmetadata="two one"
-Cmetadata="one two one"

But these are not:

-Cmetadata="onetwo"
-Cmetadata="one,two"
@alepez alepez added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

No branches or pull requests

1 participant