Skip to content

Commit dc905e4

Browse files
Revert "Revert "cg_llvm: fewer_names in uncached_llvm_type""
This reverts commit 88dc58f.
1 parent 926f069 commit dc905e4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

compiler/rustc_codegen_llvm/src/type_of.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ fn uncached_llvm_type<'a, 'tcx>(
4343
// FIXME(eddyb) producing readable type names for trait objects can result
4444
// in problematically distinct types due to HRTB and subtyping (see #47638).
4545
// ty::Dynamic(..) |
46-
ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Generator(..) | ty::Str => {
46+
ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Generator(..) | ty::Str
47+
if !cx.sess().fewer_names() =>
48+
{
4749
let mut name = with_no_trimmed_paths(|| layout.ty.to_string());
4850
if let (&ty::Adt(def, _), &Variants::Single { index }) =
4951
(layout.ty.kind(), &layout.variants)
@@ -59,6 +61,12 @@ fn uncached_llvm_type<'a, 'tcx>(
5961
}
6062
Some(name)
6163
}
64+
ty::Adt(..) => {
65+
// If `Some` is returned then a named struct is created in LLVM. Name collisions are
66+
// avoided by LLVM (with increasing suffixes). If rustc doesn't generate names then that
67+
// can improve perf.
68+
Some(String::new())
69+
}
6270
_ => None,
6371
};
6472

src/test/ui/const-generics/issues/issue-75763.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// ignore-test
2-
// FIXME(const_generics): This test causes an ICE after reverting #76030.
1+
// build-pass
32

43
#![allow(incomplete_features)]
54
#![feature(const_generics)]

0 commit comments

Comments
 (0)