Skip to content

Commit f4d6362

Browse files
committed
librustc_lint: In recursion warning, change 'recurring' to 'recursing'
1 parent bfc3b20 commit f4d6362

File tree

6 files changed

+65
-65
lines changed

6 files changed

+65
-65
lines changed

src/doc/rustc/src/lints/listing/warn-by-default.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,11 @@ fn foo() {
603603
This will produce:
604604

605605
```text
606-
warning: function cannot return without recurring
606+
warning: function cannot return without recursing
607607
--> src/main.rs:1:1
608608
|
609609
1 | fn foo() {
610-
| ^^^^^^^^ cannot return without recurring
610+
| ^^^^^^^^ cannot return without recursing
611611
2 | foo();
612612
| ----- recursive call site
613613
|

src/librustc_lint/builtin.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnconditionalRecursion {
901901
// considers this to be an error for two reasons, (a) it is
902902
// easier to implement, and (b) it seems rare to actually want
903903
// to have behaviour like the above, rather than
904-
// e.g. accidentally recurring after an assert.
904+
// e.g. accidentally recursing after an assert.
905905

906906
let cfg = cfg::CFG::new(cx.tcx, &body);
907907

@@ -961,8 +961,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnconditionalRecursion {
961961
let sp = cx.tcx.sess.codemap().def_span(sp);
962962
let mut db = cx.struct_span_lint(UNCONDITIONAL_RECURSION,
963963
sp,
964-
"function cannot return without recurring");
965-
db.span_label(sp, "cannot return without recurring");
964+
"function cannot return without recursing");
965+
db.span_label(sp, "cannot return without recursing");
966966
// offer some help to the programmer.
967967
for call in &self_call_spans {
968968
db.span_label(*call, "recursive call site");
@@ -1090,7 +1090,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnconditionalRecursion {
10901090
// a default method definition.
10911091
Ok(Some(traits::VtableParam(_))) => {
10921092
let on_self = trait_ref.self_ty().is_self();
1093-
// We can only be recurring in a default
1093+
// We can only be recursing in a default
10941094
// method if we're being called literally
10951095
// on the `Self` type.
10961096
on_self && callee_id == method.def_id

src/test/ui/issues/issue-8727.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn generic<T>() {
1515
generic::<Option<T>>();
1616
}
1717
//~^^^ ERROR reached the recursion limit while instantiating `generic::<std::option::Option<
18-
//~| WARN function cannot return without recurring
18+
//~| WARN function cannot return without recursing
1919

2020

2121

src/test/ui/issues/issue-8727.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
warning: function cannot return without recurring
1+
warning: function cannot return without recursing
22
--> $DIR/issue-8727.rs:14:1
33
|
44
LL | fn generic<T>() {
5-
| ^^^^^^^^^^^^^^^ cannot return without recurring
5+
| ^^^^^^^^^^^^^^^ cannot return without recursing
66
LL | generic::<Option<T>>();
77
| ---------------------- recursive call site
88
|

src/test/ui/lint/lint-unconditional-recursion.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![deny(unconditional_recursion)]
1212

1313
#![allow(dead_code)]
14-
fn foo() { //~ ERROR function cannot return without recurring
14+
fn foo() { //~ ERROR function cannot return without recursing
1515
foo();
1616
}
1717

@@ -21,7 +21,7 @@ fn bar() {
2121
}
2222
}
2323

24-
fn baz() { //~ ERROR function cannot return without recurring
24+
fn baz() { //~ ERROR function cannot return without recursing
2525
if true {
2626
baz()
2727
} else {
@@ -33,7 +33,7 @@ fn qux() {
3333
loop {}
3434
}
3535

36-
fn quz() -> bool { //~ ERROR function cannot return without recurring
36+
fn quz() -> bool { //~ ERROR function cannot return without recursing
3737
if true {
3838
while quz() {}
3939
true
@@ -44,13 +44,13 @@ fn quz() -> bool { //~ ERROR function cannot return without recurring
4444

4545
// Trait method calls.
4646
trait Foo {
47-
fn bar(&self) { //~ ERROR function cannot return without recurring
47+
fn bar(&self) { //~ ERROR function cannot return without recursing
4848
self.bar()
4949
}
5050
}
5151

5252
impl Foo for Box<Foo+'static> {
53-
fn bar(&self) { //~ ERROR function cannot return without recurring
53+
fn bar(&self) { //~ ERROR function cannot return without recursing
5454
loop {
5555
self.bar()
5656
}
@@ -59,7 +59,7 @@ impl Foo for Box<Foo+'static> {
5959

6060
// Trait method call with integer fallback after method resolution.
6161
impl Foo for i32 {
62-
fn bar(&self) { //~ ERROR function cannot return without recurring
62+
fn bar(&self) { //~ ERROR function cannot return without recursing
6363
0.bar()
6464
}
6565
}
@@ -72,13 +72,13 @@ impl Foo for u32 {
7272

7373
// Trait method calls via paths.
7474
trait Foo2 {
75-
fn bar(&self) { //~ ERROR function cannot return without recurring
75+
fn bar(&self) { //~ ERROR function cannot return without recursing
7676
Foo2::bar(self)
7777
}
7878
}
7979

8080
impl Foo2 for Box<Foo2+'static> {
81-
fn bar(&self) { //~ ERROR function cannot return without recurring
81+
fn bar(&self) { //~ ERROR function cannot return without recursing
8282
loop {
8383
Foo2::bar(self)
8484
}
@@ -88,19 +88,19 @@ impl Foo2 for Box<Foo2+'static> {
8888
struct Baz;
8989
impl Baz {
9090
// Inherent method call.
91-
fn qux(&self) { //~ ERROR function cannot return without recurring
91+
fn qux(&self) { //~ ERROR function cannot return without recursing
9292
self.qux();
9393
}
9494

9595
// Inherent method call via path.
96-
fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring
96+
fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recursing
9797
Baz::as_ref(self)
9898
}
9999
}
100100

101101
// Trait method calls to impls via paths.
102102
impl Default for Baz {
103-
fn default() -> Baz { //~ ERROR function cannot return without recurring
103+
fn default() -> Baz { //~ ERROR function cannot return without recursing
104104
let x = Default::default();
105105
x
106106
}
@@ -109,14 +109,14 @@ impl Default for Baz {
109109
// Overloaded operators.
110110
impl std::ops::Deref for Baz {
111111
type Target = ();
112-
fn deref(&self) -> &() { //~ ERROR function cannot return without recurring
112+
fn deref(&self) -> &() { //~ ERROR function cannot return without recursing
113113
&**self
114114
}
115115
}
116116

117117
impl std::ops::Index<usize> for Baz {
118118
type Output = Baz;
119-
fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring
119+
fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recursing
120120
&self[x]
121121
}
122122
}
@@ -125,7 +125,7 @@ impl std::ops::Index<usize> for Baz {
125125
struct Quux;
126126
impl std::ops::Deref for Quux {
127127
type Target = Baz;
128-
fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring
128+
fn deref(&self) -> &Baz { //~ ERROR function cannot return without recursing
129129
self.as_ref()
130130
}
131131
}

src/test/ui/lint/lint-unconditional-recursion.stderr

+42-42
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: function cannot return without recurring
1+
error: function cannot return without recursing
22
--> $DIR/lint-unconditional-recursion.rs:14:1
33
|
4-
LL | fn foo() { //~ ERROR function cannot return without recurring
5-
| ^^^^^^^^ cannot return without recurring
4+
LL | fn foo() { //~ ERROR function cannot return without recursing
5+
| ^^^^^^^^ cannot return without recursing
66
LL | foo();
77
| ----- recursive call site
88
|
@@ -13,11 +13,11 @@ LL | #![deny(unconditional_recursion)]
1313
| ^^^^^^^^^^^^^^^^^^^^^^^
1414
= help: a `loop` may express intention better if this is on purpose
1515

16-
error: function cannot return without recurring
16+
error: function cannot return without recursing
1717
--> $DIR/lint-unconditional-recursion.rs:24:1
1818
|
19-
LL | fn baz() { //~ ERROR function cannot return without recurring
20-
| ^^^^^^^^ cannot return without recurring
19+
LL | fn baz() { //~ ERROR function cannot return without recursing
20+
| ^^^^^^^^ cannot return without recursing
2121
LL | if true {
2222
LL | baz()
2323
| ----- recursive call site
@@ -27,11 +27,11 @@ LL | baz()
2727
|
2828
= help: a `loop` may express intention better if this is on purpose
2929

30-
error: function cannot return without recurring
30+
error: function cannot return without recursing
3131
--> $DIR/lint-unconditional-recursion.rs:36:1
3232
|
33-
LL | fn quz() -> bool { //~ ERROR function cannot return without recurring
34-
| ^^^^^^^^^^^^^^^^ cannot return without recurring
33+
LL | fn quz() -> bool { //~ ERROR function cannot return without recursing
34+
| ^^^^^^^^^^^^^^^^ cannot return without recursing
3535
LL | if true {
3636
LL | while quz() {}
3737
| ----- recursive call site
@@ -41,113 +41,113 @@ LL | loop { quz(); }
4141
|
4242
= help: a `loop` may express intention better if this is on purpose
4343

44-
error: function cannot return without recurring
44+
error: function cannot return without recursing
4545
--> $DIR/lint-unconditional-recursion.rs:47:5
4646
|
47-
LL | fn bar(&self) { //~ ERROR function cannot return without recurring
48-
| ^^^^^^^^^^^^^ cannot return without recurring
47+
LL | fn bar(&self) { //~ ERROR function cannot return without recursing
48+
| ^^^^^^^^^^^^^ cannot return without recursing
4949
LL | self.bar()
5050
| ---------- recursive call site
5151
|
5252
= help: a `loop` may express intention better if this is on purpose
5353

54-
error: function cannot return without recurring
54+
error: function cannot return without recursing
5555
--> $DIR/lint-unconditional-recursion.rs:53:5
5656
|
57-
LL | fn bar(&self) { //~ ERROR function cannot return without recurring
58-
| ^^^^^^^^^^^^^ cannot return without recurring
57+
LL | fn bar(&self) { //~ ERROR function cannot return without recursing
58+
| ^^^^^^^^^^^^^ cannot return without recursing
5959
LL | loop {
6060
LL | self.bar()
6161
| ---------- recursive call site
6262
|
6363
= help: a `loop` may express intention better if this is on purpose
6464

65-
error: function cannot return without recurring
65+
error: function cannot return without recursing
6666
--> $DIR/lint-unconditional-recursion.rs:62:5
6767
|
68-
LL | fn bar(&self) { //~ ERROR function cannot return without recurring
69-
| ^^^^^^^^^^^^^ cannot return without recurring
68+
LL | fn bar(&self) { //~ ERROR function cannot return without recursing
69+
| ^^^^^^^^^^^^^ cannot return without recursing
7070
LL | 0.bar()
7171
| ------- recursive call site
7272
|
7373
= help: a `loop` may express intention better if this is on purpose
7474

75-
error: function cannot return without recurring
75+
error: function cannot return without recursing
7676
--> $DIR/lint-unconditional-recursion.rs:75:5
7777
|
78-
LL | fn bar(&self) { //~ ERROR function cannot return without recurring
79-
| ^^^^^^^^^^^^^ cannot return without recurring
78+
LL | fn bar(&self) { //~ ERROR function cannot return without recursing
79+
| ^^^^^^^^^^^^^ cannot return without recursing
8080
LL | Foo2::bar(self)
8181
| --------------- recursive call site
8282
|
8383
= help: a `loop` may express intention better if this is on purpose
8484

85-
error: function cannot return without recurring
85+
error: function cannot return without recursing
8686
--> $DIR/lint-unconditional-recursion.rs:81:5
8787
|
88-
LL | fn bar(&self) { //~ ERROR function cannot return without recurring
89-
| ^^^^^^^^^^^^^ cannot return without recurring
88+
LL | fn bar(&self) { //~ ERROR function cannot return without recursing
89+
| ^^^^^^^^^^^^^ cannot return without recursing
9090
LL | loop {
9191
LL | Foo2::bar(self)
9292
| --------------- recursive call site
9393
|
9494
= help: a `loop` may express intention better if this is on purpose
9595

96-
error: function cannot return without recurring
96+
error: function cannot return without recursing
9797
--> $DIR/lint-unconditional-recursion.rs:91:5
9898
|
99-
LL | fn qux(&self) { //~ ERROR function cannot return without recurring
100-
| ^^^^^^^^^^^^^ cannot return without recurring
99+
LL | fn qux(&self) { //~ ERROR function cannot return without recursing
100+
| ^^^^^^^^^^^^^ cannot return without recursing
101101
LL | self.qux();
102102
| ---------- recursive call site
103103
|
104104
= help: a `loop` may express intention better if this is on purpose
105105

106-
error: function cannot return without recurring
106+
error: function cannot return without recursing
107107
--> $DIR/lint-unconditional-recursion.rs:96:5
108108
|
109-
LL | fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring
110-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
109+
LL | fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recursing
110+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
111111
LL | Baz::as_ref(self)
112112
| ----------------- recursive call site
113113
|
114114
= help: a `loop` may express intention better if this is on purpose
115115

116-
error: function cannot return without recurring
116+
error: function cannot return without recursing
117117
--> $DIR/lint-unconditional-recursion.rs:103:5
118118
|
119-
LL | fn default() -> Baz { //~ ERROR function cannot return without recurring
120-
| ^^^^^^^^^^^^^^^^^^^ cannot return without recurring
119+
LL | fn default() -> Baz { //~ ERROR function cannot return without recursing
120+
| ^^^^^^^^^^^^^^^^^^^ cannot return without recursing
121121
LL | let x = Default::default();
122122
| ------------------ recursive call site
123123
|
124124
= help: a `loop` may express intention better if this is on purpose
125125

126-
error: function cannot return without recurring
126+
error: function cannot return without recursing
127127
--> $DIR/lint-unconditional-recursion.rs:112:5
128128
|
129-
LL | fn deref(&self) -> &() { //~ ERROR function cannot return without recurring
130-
| ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
129+
LL | fn deref(&self) -> &() { //~ ERROR function cannot return without recursing
130+
| ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
131131
LL | &**self
132132
| ------ recursive call site
133133
|
134134
= help: a `loop` may express intention better if this is on purpose
135135

136-
error: function cannot return without recurring
136+
error: function cannot return without recursing
137137
--> $DIR/lint-unconditional-recursion.rs:119:5
138138
|
139-
LL | fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring
140-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
139+
LL | fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recursing
140+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
141141
LL | &self[x]
142142
| ------- recursive call site
143143
|
144144
= help: a `loop` may express intention better if this is on purpose
145145

146-
error: function cannot return without recurring
146+
error: function cannot return without recursing
147147
--> $DIR/lint-unconditional-recursion.rs:128:5
148148
|
149-
LL | fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring
150-
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
149+
LL | fn deref(&self) -> &Baz { //~ ERROR function cannot return without recursing
150+
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
151151
LL | self.as_ref()
152152
| ---- recursive call site
153153
|

0 commit comments

Comments
 (0)