/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs

https://gitlab.com/pranith/rust · Rust · 36 lines · 16 code · 6 blank · 14 comment · 0 complexity · fb2652b3b35325e0c03f28e182705920 MD5 · raw file

  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. // Test that we do not ICE when the self type is `ty::err`, but rather
  11. // just propagate the error.
  12. #![crate_type = "lib"]
  13. #![feature(lang_items)]
  14. #![feature(no_std)]
  15. #![no_std]
  16. #[lang="sized"]
  17. pub trait Sized {
  18. // Empty.
  19. }
  20. #[lang = "add"]
  21. trait Add<RHS=Self> {
  22. type Output;
  23. fn add(self, RHS) -> Self::Output;
  24. }
  25. fn ice<A>(a: A) {
  26. let r = loop {};
  27. r = r + a;
  28. //~^ ERROR not implemented
  29. //~| ERROR not implemented
  30. }