Skip to content

Commit ddd6abb

Browse files
committed
Don't detect fn consts as generic consts
1 parent 88c82b1 commit ddd6abb

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

compiler/rustc_mir_transform/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ impl<'tcx> Visitor<'tcx> for MonoCompatVisitor {
855855
}
856856

857857
fn visit_const_operand(&mut self, constant: &ConstOperand<'tcx>, location: Location) {
858-
if constant.has_non_region_param() {
858+
if constant.has_non_region_param() && !constant.ty().is_fn() {
859859
self.contains_generic_const = true;
860860
}
861861
self.super_const_operand(constant, location);

tests/codegen/array-cmp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub fn array_of_tuple_le(a: &[(i16, u16); 2], b: &[(i16, u16); 2]) -> bool {
6767
// CHECK-NEXT: br i1 %[[EQ11]], label %[[DONE:.+]], label %[[EXIT_U]]
6868

6969
// CHECK: [[DONE]]:
70-
// CHECK: %[[RET:.+]] = phi i1 [ %{{.+}}, %[[EXIT_U]] ], [ %{{.+}}, %[[EXIT_S]] ], [ true, %[[L11]] ]
70+
// CHECK: %[[RET:.+]] = phi i1 [ %{{.+}}, %[[EXIT_S]] ], [ %{{.+}}, %[[EXIT_U]] ], [ true, %[[L11]] ]
7171
// CHECK: ret i1 %[[RET]]
7272

7373
a <= b

tests/ui/layout/post-mono-layout-cycle.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ error[E0391]: cycle detected when computing layout of `Wrapper<()>`
55
= note: cycle used when computing layout of `core::option::Option<Wrapper<()>>`
66
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
77

8-
note: the above error was encountered while instantiating `fn indirect::<()>`
9-
--> $DIR/post-mono-layout-cycle.rs:23:5
8+
note: the above error was encountered while instantiating `fn abi::<()>`
9+
--> $DIR/post-mono-layout-cycle.rs:19:5
1010
|
11-
LL | indirect::<()>();
12-
| ^^^^^^^^^^^^^^^^
11+
LL | abi::<T>(None);
12+
| ^^^^^^^^^^^^^^
1313

1414
error: aborting due to 1 previous error
1515

0 commit comments

Comments
 (0)