]> git.lizzy.rs Git - rust.git/blob - tests/ui/mismatched_types/wrap-suggestion-privacy.rs
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / tests / ui / mismatched_types / wrap-suggestion-privacy.rs
1 mod inner {
2     pub struct Wrapper<T>(T);
3 }
4
5 fn needs_wrapper(t: inner::Wrapper<i32>) {}
6 fn needs_wrapping(t: std::num::Wrapping<i32>) {}
7 fn needs_ready(t: std::future::Ready<i32>) {}
8
9 fn main() {
10     // Suggest wrapping expression because type is local
11     // and its privacy can be easily changed
12     needs_wrapper(0);
13     //~^ ERROR mismatched types
14     //~| HELP  try wrapping the expression in `inner::Wrapper`
15
16     // Suggest wrapping expression because field is accessible
17     needs_wrapping(0);
18     //~^ ERROR mismatched types
19     //~| HELP  try wrapping the expression in `std::num::Wrapping`
20
21     // Do not suggest wrapping expression
22     needs_ready(Some(0));
23     //~^ ERROR mismatched types
24 }