PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/src/test/compile-fail/struct-pat-derived-error.rs

https://github.com/paulstansifer/rust
Rust | 26 lines | 10 code | 3 blank | 13 comment | 0 complexity | 371375fef92efe80f9c3fa5409d56bf6 MD5 | raw file
Possible License(s): 0BSD, Apache-2.0, MIT, AGPL-1.0
  1. // Copyright 2013 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. struct a {
  11. b: usize,
  12. c: usize
  13. }
  14. impl a {
  15. fn foo(&self) {
  16. let a { x, y } = self.d; //~ ERROR attempted access of field `d`
  17. //~^ ERROR struct `a` does not have a field named `x`
  18. //~^^ ERROR struct `a` does not have a field named `y`
  19. //~^^^ ERROR pattern does not mention field `b`
  20. //~^^^^ ERROR pattern does not mention field `c`
  21. }
  22. }
  23. fn main() {}