Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_symbol_mangling/src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {

match ct.ty.kind() {
ty::Uint(_) => {}
ty::Bool => {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is all that's required, can we also add ty::Char and ty::Int, or do these need special attention?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty::Int seems reasonable, though we might want to change mangling to express signed-ness (so you get foo<-1> in perf top or whatever, not foo<255>). I think we do not want to encode char with the bits so I would like to hold off on it for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So both seem harder than just bool, which encoding with 0/1 seems quite reasonable.

_ => {
bug!("symbol_names: unsupported constant of type `{}` ({:?})", ct.ty, ct);
}
Expand Down
18 changes: 18 additions & 0 deletions src/test/ui/symbol-names/issue-76365.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// check-pass
// revisions: legacy v0
//[legacy]compile-flags: -Z symbol-mangling-version=legacy --crate-type=lib
//[v0]compile-flags: -Z symbol-mangling-version=v0 --crate-type=lib

#![feature(min_const_generics)]

pub struct Bar<const F: bool>;

impl Bar<true> {
pub fn foo() {}
}

impl<const F: bool> Bar<F> {
pub fn bar() {}
}

fn main() {}