]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0161.rs
Suggest `if let`/`let_else` for refutable pat in `let`
[rust.git] / src / test / ui / error-codes / E0161.rs
1 // Check that E0161 is a hard error in all possible configurations that might
2 // affect it.
3
4 // revisions: migrate nll zflags edition migrateul nllul zflagsul editionul
5 //[zflags]compile-flags: -Z borrowck=migrate
6 //[edition]edition:2018
7 //[zflagsul]compile-flags: -Z borrowck=migrate
8 //[editionul]edition:2018
9 //[migrateul] check-pass
10 //[nllul] check-pass
11 //[zflagsul] check-pass
12 //[editionul] check-pass
13
14 // Since we are testing nll (and migration) explicitly as a separate
15 // revisions, don't worry about the --compare-mode=nll on this test.
16
17 // ignore-compare-mode-nll
18
19 #![allow(incomplete_features)]
20 #![cfg_attr(nll, feature(nll))]
21 #![cfg_attr(nllul, feature(nll))]
22 #![cfg_attr(migrateul, feature(unsized_locals))]
23 #![cfg_attr(zflagsul, feature(unsized_locals))]
24 #![cfg_attr(nllul, feature(unsized_locals))]
25 #![cfg_attr(editionul, feature(unsized_locals))]
26
27 trait Bar {
28     fn f(self);
29 }
30
31 fn foo(x: Box<dyn Bar>) {
32     x.f();
33     //[migrate,nll,zflags,edition]~^ ERROR E0161
34 }
35
36 fn main() {}