Skip to content

Commit 07aeac8

Browse files
committed
auto merge of #17761 : bkoropoff/rust/issue-17758, r=alexcrichton
This fixes an ICE and closes issue #17758
2 parents a2e7c4d + 6f6d13a commit 07aeac8

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/librustc/middle/typeck/infer/error_reporting.rs

+13
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,19 @@ impl<'a, 'tcx> ErrorReporting for InferCtxt<'a, 'tcx> {
869869
ast::TypeImplItem(_) => None,
870870
}
871871
},
872+
ast_map::NodeTraitItem(ref item) => {
873+
match **item {
874+
ast::ProvidedMethod(ref m) => {
875+
Some((m.pe_fn_decl(),
876+
m.pe_generics(),
877+
m.pe_fn_style(),
878+
m.pe_ident(),
879+
Some(&m.pe_explicit_self().node),
880+
m.span))
881+
}
882+
_ => None
883+
}
884+
}
872885
_ => None
873886
},
874887
None => None

src/test/compile-fail/issue-17758.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2014 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+
// Test that regionck suggestions in a provided method of a trait
12+
// don't ICE
13+
14+
trait Foo<'a> {
15+
fn foo(&'a self);
16+
fn bar(&self) {
17+
self.foo();
18+
//~^ ERROR mismatched types: expected `&'a Self`, found `&Self` (lifetime mismatch)
19+
}
20+
}
21+
22+
fn main() {}

0 commit comments

Comments
 (0)