Skip to content

Commit 01872f7

Browse files
committed
Do not return the result from sub/equate routines, just return a.
1 parent c8ded9a commit 01872f7

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

src/librustc/middle/infer/equate.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ impl<'a, 'tcx> TypeRelation<'a,'tcx> for Equate<'a, 'tcx> {
6868
}
6969

7070
_ => {
71-
combine::super_combine_tys(self.fields.infcx, self, a, b)
71+
try!(combine::super_combine_tys(self.fields.infcx, self, a, b));
72+
Ok(a)
7273
}
7374
}
7475
}

src/librustc/middle/infer/sub.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Sub<'a, 'tcx> {
9090
}
9191

9292
_ => {
93-
combine::super_combine_tys(self.fields.infcx, self, a, b)
93+
try!(combine::super_combine_tys(self.fields.infcx, self, a, b));
94+
Ok(a)
9495
}
9596
}
9697
}

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

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2015 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+
use std::rc::Rc;
12+
13+
fn test1() -> Rc<for<'a> Fn(&'a usize) + 'static> {
14+
if let Some(_) = Some(1) {
15+
loop{}
16+
} else {
17+
loop{}
18+
}
19+
}
20+
21+
fn test2() -> *mut for<'a> Fn(&'a usize) + 'static {
22+
if let Some(_) = Some(1) {
23+
loop{}
24+
} else {
25+
loop{}
26+
}
27+
}
28+
29+
fn main() {}
30+

0 commit comments

Comments
 (0)