Skip to content

Commit 0ac5e48

Browse files
arielb1Ariel Ben-Yehuda
authored and
Ariel Ben-Yehuda
committed
test the substs ppaux code both with and without -Z verbose
1 parent 832b707 commit 0ac5e48

File tree

3 files changed

+63
-48
lines changed

3 files changed

+63
-48
lines changed

Diff for: src/librustc/traits/error_reporting.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,8 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
436436
// If we can't show anything useful, try to find
437437
// similar impls.
438438

439-
let impl_candidates = find_similar_impl_candidates(infcx, trait_ref);
439+
let impl_candidates =
440+
find_similar_impl_candidates(infcx, trait_ref);
440441
if impl_candidates.len() > 0 {
441442
report_similar_impl_candidates(obligation.cause.span,
442443
&mut err, &impl_candidates);

Diff for: src/test/compile-fail/substs-ppaux.rs

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
// revisions: verbose normal
12+
//
13+
//[verbose] compile-flags: -Z verbose
14+
15+
trait Foo<'b, 'c, S=u32> {
16+
fn bar<'a, T>() where T: 'a {}
17+
fn baz() {}
18+
}
19+
20+
impl<'a,'b,T,S> Foo<'a, 'b, S> for T {}
21+
22+
fn main() {}
23+
24+
fn foo<'z>() where &'z (): Sized {
25+
let x: () = <i8 as Foo<'static, 'static, u8>>::bar::<'static, char>;
26+
//[verbose]~^ ERROR mismatched types
27+
//[verbose]~| expected `()`
28+
//[verbose]~| found `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>}`
29+
//[normal]~^^^^ ERROR mismatched types
30+
//[normal]~| expected `()`
31+
//[normal]~| found `fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>}`
32+
33+
34+
let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>;
35+
//[verbose]~^ ERROR mismatched types
36+
//[verbose]~| expected `()`
37+
//[verbose]~| found `fn() {<i8 as Foo<ReStatic, ReStatic, u32>>::bar::<ReStatic, char>}`
38+
//[normal]~^^^^ ERROR mismatched types
39+
//[normal]~| expected `()`
40+
//[normal]~| found `fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>}`
41+
42+
let x: () = <i8 as Foo<'static, 'static, u8>>::baz;
43+
//[verbose]~^ ERROR mismatched types
44+
//[verbose]~| expected `()`
45+
//[verbose]~| found `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz}`
46+
//[normal]~^^^^ ERROR mismatched types
47+
//[normal]~| expected `()`
48+
//[normal]~| found `fn() {<i8 as Foo<'static, 'static, u8>>::baz}`
49+
50+
let x: () = foo::<'static>;
51+
//[verbose]~^ ERROR mismatched types
52+
//[verbose]~| expected `()`
53+
//[verbose]~| found `fn() {foo::<ReStatic>}`
54+
//[normal]~^^^^ ERROR mismatched types
55+
//[normal]~| expected `()`
56+
//[normal]~| found `fn() {foo::<'static>}`
57+
58+
<str as Foo<u8>>::bar;
59+
//[verbose]~^ ERROR `str: std::marker::Sized` is not satisfied
60+
//[normal]~^^ ERROR `str: std::marker::Sized` is not satisfied
61+
}

Diff for: src/test/compile-fail/substs-verbose.rs

-47
This file was deleted.

0 commit comments

Comments
 (0)