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.
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.
11 #![deny(unconditional_recursion)]
14 fn foo() { //~ ERROR function cannot return without recursing
24 fn baz() { //~ ERROR function cannot return without recursing
36 fn quz() -> bool { //~ ERROR function cannot return without recursing
45 // Trait method calls.
47 fn bar(&self) { //~ ERROR function cannot return without recursing
52 impl Foo for Box<Foo+'static> {
53 fn bar(&self) { //~ ERROR function cannot return without recursing
60 // Trait method call with integer fallback after method resolution.
62 fn bar(&self) { //~ ERROR function cannot return without recursing
73 // Trait method calls via paths.
75 fn bar(&self) { //~ ERROR function cannot return without recursing
80 impl Foo2 for Box<Foo2+'static> {
81 fn bar(&self) { //~ ERROR function cannot return without recursing
90 // Inherent method call.
91 fn qux(&self) { //~ ERROR function cannot return without recursing
95 // Inherent method call via path.
96 fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recursing
101 // Trait method calls to impls via paths.
102 impl Default for Baz {
103 fn default() -> Baz { //~ ERROR function cannot return without recursing
104 let x = Default::default();
109 // Overloaded operators.
110 impl std::ops::Deref for Baz {
112 fn deref(&self) -> &() { //~ ERROR function cannot return without recursing
117 impl std::ops::Index<usize> for Baz {
119 fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recursing
124 // Overloaded autoderef.
126 impl std::ops::Deref for Quux {
128 fn deref(&self) -> &Baz { //~ ERROR function cannot return without recursing
139 fn method<T: Bar>(&self, x: &T) {