rustc_codegen_utils: don't ignore Ctor
path components in symbols.
This commit is contained in:
parent
2092963a18
commit
408bf9de34
2 changed files with 13 additions and 3 deletions
|
@ -586,13 +586,11 @@ impl Printer<'tcx, 'tcx> for SymbolMangler<'_, 'tcx> {
|
||||||
disambiguated_data: &DisambiguatedDefPathData,
|
disambiguated_data: &DisambiguatedDefPathData,
|
||||||
) -> Result<Self::Path, Self::Error> {
|
) -> Result<Self::Path, Self::Error> {
|
||||||
let ns = match disambiguated_data.data {
|
let ns = match disambiguated_data.data {
|
||||||
// Avoid putting the burden on demanglers to ignore this.
|
|
||||||
DefPathData::Ctor => return print_prefix(self),
|
|
||||||
|
|
||||||
// Uppercase categories are more stable than lowercase ones.
|
// Uppercase categories are more stable than lowercase ones.
|
||||||
DefPathData::TypeNs(_) => 't',
|
DefPathData::TypeNs(_) => 't',
|
||||||
DefPathData::ValueNs(_) => 'v',
|
DefPathData::ValueNs(_) => 'v',
|
||||||
DefPathData::ClosureExpr => 'C',
|
DefPathData::ClosureExpr => 'C',
|
||||||
|
DefPathData::Ctor => 'c',
|
||||||
DefPathData::AnonConst => 'k',
|
DefPathData::AnonConst => 'k',
|
||||||
DefPathData::ImplTrait => 'i',
|
DefPathData::ImplTrait => 'i',
|
||||||
|
|
||||||
|
|
12
src/test/run-pass/struct-ctor-mangling.rs
Normal file
12
src/test/run-pass/struct-ctor-mangling.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
fn size_of_val<T>(_: &T) -> usize {
|
||||||
|
std::mem::size_of::<T>()
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Foo(i64);
|
||||||
|
|
||||||
|
// Test that the (symbol) mangling of `Foo` (the `struct` type) and that of
|
||||||
|
// `typeof Foo` (the function type of the `struct` constructor) don't collide.
|
||||||
|
fn main() {
|
||||||
|
size_of_val(&Foo(0));
|
||||||
|
size_of_val(&Foo);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue