Skip to content

Commit ce61a71

Browse files
authored
Merge pull request #38393 from brson/beta-next
[beta] Work around a borrow surviving too long (fixes #37686)
2 parents 9911f0e + 5a42929 commit ce61a71

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/librustc_const_eval/pattern.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ impl<'a, 'gcx, 'tcx> PatternContext<'a, 'gcx, 'tcx> {
223223
}
224224

225225
PatKind::Tuple(ref subpatterns, ddpos) => {
226-
match self.tcx.tables().node_id_to_type(pat.id).sty {
226+
let ty = self.tcx.tables().node_id_to_type(pat.id);
227+
match ty.sty {
227228
ty::TyTuple(ref tys) => {
228229
let subpatterns =
229230
subpatterns.iter()

src/test/run-pass/issue-37686.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2016 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+
fn main() {
12+
match (0, 0) {
13+
(std::usize::MIN, std::usize::MAX) => {}
14+
_ => {}
15+
}
16+
}

0 commit comments

Comments
 (0)