about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-10-22 07:21:53 +0000
committerbors <bors@rust-lang.org>2021-10-22 07:21:53 +0000
commit7e4c9eebd82e9fa71f74626e5ba4e3494b8aba25 (patch)
tree02f9afc52fcf73e4cf9919ca5418fa5d1b2d9027 /src/test/codegen
parentd4647278cb2948e76b51e8cd7aa7d31ba6478a08 (diff)
parent88e4e0ea24fe9e43332eb94fbc023b2468c9486c (diff)
downloadrust-7e4c9eebd82e9fa71f74626e5ba4e3494b8aba25.tar.gz
rust-7e4c9eebd82e9fa71f74626e5ba4e3494b8aba25.zip
Auto merge of #90151 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] backports

*  Don't emit a warning for empty rmeta files. #90072
*  Erase late-bound regions before computing vtable debuginfo name. #90050
*  Fix wrong niche calculation when 2+ niches are placed at the start #90040
*  Revert #86011 to fix an incorrect bound check #90025
*  Fix macro_rules! duplication when reexported in the same module #89867
* Bump cargo to include rust-lang/cargo#9979 - Fix fetching git repos after a force push.

r? `@Mark-Simulacrum`
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/debug-vtable.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/codegen/debug-vtable.rs b/src/test/codegen/debug-vtable.rs
index 851d68da5ee..1c8cc61f204 100644
--- a/src/test/codegen/debug-vtable.rs
+++ b/src/test/codegen/debug-vtable.rs
@@ -18,6 +18,9 @@
 // MSVC-LABEL: !DIGlobalVariable(name: "impl$<debug_vtable::Foo, _>::vtable$"
 // CHECK: !DISubrange(count: 3
 
+// NONMSVC-LABEL: !DIGlobalVariable(name: "<debug_vtable::bar::{closure#0} as core::ops::function::FnOnce<(core::option::Option<&dyn core::ops::function::Fn<(), Output=()>>)>>::{vtable}"
+// MSVC-LABEL: !DIGlobalVariable(name: "impl$<debug_vtable::bar::closure$0, core::ops::function::FnOnce<tuple$<enum$<core::option::Option<ref$<dyn$<core::ops::function::Fn<tuple$<>,assoc$<Output,tuple$<> > > > > >, {{.*}}, {{.*}}, Some> > > >::vtable$"
+
 #![crate_type = "lib"]
 
 pub struct Foo;
@@ -45,3 +48,10 @@ pub fn foo(x: &Foo) -> (u32, (u64, i8), &dyn Send) {
     let z: &dyn SomeTraitWithGenerics<u64, i8> = x;
     (y.method1(), z.method1(), x as &dyn Send)
 }
+
+// Constructing the debuginfo name for the FnOnce vtable below initially caused an ICE on MSVC
+// because the trait type contains a late bound region that needed to be erased before the type
+// layout for the niche enum `Option<&dyn Fn()>` could be computed.
+pub fn bar() -> Box<dyn FnOnce(Option<&dyn Fn()>)> {
+    Box::new(|_x: Option<&dyn Fn()>| {})
+}