Skip to content

Commit 62e4e08

Browse files
committed
Auto merge of #53163 - oli-obk:const_prop_ice, r=nikomatsakis
Remove an overly pedantic and wrong assertion fixes #53157 fixes #53087
2 parents 376b60d + 8935f99 commit 62e4e08

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

src/librustc_mir/transform/const_prop.rs

-5
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,6 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> {
333333
) -> Option<Const<'tcx>> {
334334
let span = source_info.span;
335335
match *rvalue {
336-
// This branch exists for the sanity type check
337-
Rvalue::Use(Operand::Constant(ref c)) => {
338-
assert_eq!(c.ty, place_layout.ty);
339-
self.eval_constant(c, source_info)
340-
},
341336
Rvalue::Use(ref op) => {
342337
self.eval_operand(op, source_info)
343338
},

src/test/ui/const-eval/issue-53157.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-pass
12+
13+
macro_rules! m {
14+
() => {{
15+
fn f(_: impl Sized) {}
16+
f
17+
}}
18+
}
19+
20+
fn main() {
21+
fn f() -> impl Sized {};
22+
m!()(f());
23+
}

0 commit comments

Comments
 (0)