Skip to content

Commit 1392842

Browse files
committed
bless a few trivial tests under polonius
These are all about reaching some type and recursion limits and saving the full type in a file, whose folder changes in this compare-mode.
1 parent f252ab1 commit 1392842

8 files changed

+129
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: reached the recursion limit while instantiating `function::<Option<Option<Option<...>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
2+
--> $DIR/infinite-instantiation.rs:22:9
3+
|
4+
LL | function(counter - 1, t.to_option());
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: `function` defined here
8+
--> $DIR/infinite-instantiation.rs:20:1
9+
|
10+
LL | fn function<T:ToOpt + Clone>(counter: usize, t: T) {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
= note: the full type name has been written to '$TEST_BUILD_DIR/infinite/infinite-instantiation.polonius/infinite-instantiation.long-type.txt'
13+
14+
error: aborting due to previous error
15+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: reached the recursion limit while instantiating `A::matches::$CLOSURE`
2+
--> $DIR/issue-22638.rs:56:9
3+
|
4+
LL | a.matches(f)
5+
| ^^^^^^^^^^^^
6+
|
7+
note: `A::matches` defined here
8+
--> $DIR/issue-22638.rs:15:5
9+
|
10+
LL | pub fn matches<F: Fn()>(&self, f: &F) {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-22638.polonius/issue-22638.long-type.txt'
13+
14+
error: aborting due to previous error
15+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: reached the recursion limit while instantiating `<(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(.....), ...), ...) as Foo>::recurse`
2+
--> $DIR/issue-37311.rs:17:9
3+
|
4+
LL | (self, self).recurse();
5+
| ^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: `<T as Foo>::recurse` defined here
8+
--> $DIR/issue-37311.rs:16:5
9+
|
10+
LL | fn recurse(&self) {
11+
| ^^^^^^^^^^^^^^^^^
12+
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-37311-type-length-limit/issue-37311.polonius/issue-37311.long-type.txt'
13+
14+
error: aborting due to previous error
15+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut &... &mut &mut &mut &mut &mut Empty>`
2+
--> $DIR/issue-67552.rs:28:9
3+
|
4+
LL | rec(identity(&mut it))
5+
| ^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: `rec` defined here
8+
--> $DIR/issue-67552.rs:21:1
9+
|
10+
LL | / fn rec<T>(mut it: T)
11+
LL | | where
12+
LL | | T: Iterator,
13+
| |________________^
14+
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-67552.polonius/issue-67552.long-type.txt'
15+
16+
error: aborting due to previous error
17+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
warning: function cannot return without recursing
2+
--> $DIR/issue-8727.rs:7:1
3+
|
4+
LL | fn generic<T>() {
5+
| ^^^^^^^^^^^^^^^ cannot return without recursing
6+
LL | generic::<Option<T>>();
7+
| ---------------------- recursive call site
8+
|
9+
= note: `#[warn(unconditional_recursion)]` on by default
10+
= help: a `loop` may express intention better if this is on purpose
11+
12+
error: reached the recursion limit while instantiating `generic::<Option<Option<Option<O...>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
13+
--> $DIR/issue-8727.rs:8:5
14+
|
15+
LL | generic::<Option<T>>();
16+
| ^^^^^^^^^^^^^^^^^^^^^^
17+
|
18+
note: `generic` defined here
19+
--> $DIR/issue-8727.rs:7:1
20+
|
21+
LL | fn generic<T>() {
22+
| ^^^^^^^^^^^^^^^
23+
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-8727.polonius/issue-8727.long-type.txt'
24+
25+
error: aborting due to previous error; 1 warning emitted
26+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: reached the recursion limit while instantiating `std::ptr::drop_in_place::<S<fn(f...)))))))))))))))))))))))))))))>))`
2+
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
3+
|
4+
LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: `std::ptr::drop_in_place` defined here
8+
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
9+
|
10+
LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
= note: the full type name has been written to '$TEST_BUILD_DIR/recursion/issue-38591-non-regular-dropck-recursion.polonius/issue-38591-non-regular-dropck-recursion.long-type.txt'
13+
14+
error: aborting due to previous error
15+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: reached the recursion limit while instantiating `test::<Cons<Cons<Cons<Cons<Cons<...>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
2+
--> $DIR/recursion.rs:18:11
3+
|
4+
LL | _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})}
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: `test` defined here
8+
--> $DIR/recursion.rs:16:1
9+
|
10+
LL | fn test<T:Dot> (n:isize, i:isize, first:T, second:T) ->isize {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
= note: the full type name has been written to '$TEST_BUILD_DIR/recursion/recursion.polonius/recursion.long-type.txt'
13+
14+
error: aborting due to previous error
15+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: reached the type-length limit while instantiating `std::mem::drop::<Option<((((...,....., ...), ..., ...), ..., ...)>>`
2+
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
3+
|
4+
LL | pub fn drop<T>(_x: T) {}
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit.polonius/type_length_limit.long-type.txt'
8+
= help: consider adding a `#![type_length_limit="8"]` attribute to your crate
9+
10+
error: aborting due to previous error
11+

0 commit comments

Comments
 (0)