Tweak @live undisposed owner error

A pointer 'left dangling' means it refers to an invalid memory address -
change to 'not disposed of'. This also is consistent with the 'assigning
to Owner without disposing of owned value' error message.
This commit is contained in:
Nick Treleaven 2023-01-28 15:06:53 +00:00 committed by The Dlang Bot
parent 276ef2145b
commit fff3b36e9f
5 changed files with 13 additions and 13 deletions

View file

@ -2569,7 +2569,7 @@ void checkObErrors(ref ObState obstate)
{
auto v = obstate.vars[i];
if (v.type.hasPointers())
v.error(v.loc, "is left dangling at return");
v.error(v.loc, "is not disposed of before return");
}
}
}

View file

@ -2,11 +2,11 @@
REQUIRED_ARGS:-preview=dip1021
TEST_OUTPUT:
---
fail_compilation/failob1.d(104): Error: variable `failob1.test1.a1` is left dangling at return
fail_compilation/failob1.d(105): Error: variable `failob1.test2.a2` is left dangling at return
fail_compilation/failob1.d(107): Error: variable `failob1.test4.s4` is left dangling at return
fail_compilation/failob1.d(108): Error: variable `failob1.test5.dg5` is left dangling at return
fail_compilation/failob1.d(115): Error: variable `failob1.test12.p12` is left dangling at return
fail_compilation/failob1.d(104): Error: variable `failob1.test1.a1` is not disposed of before return
fail_compilation/failob1.d(105): Error: variable `failob1.test2.a2` is not disposed of before return
fail_compilation/failob1.d(107): Error: variable `failob1.test4.s4` is not disposed of before return
fail_compilation/failob1.d(108): Error: variable `failob1.test5.dg5` is not disposed of before return
fail_compilation/failob1.d(115): Error: variable `failob1.test12.p12` is not disposed of before return
---
*/

View file

@ -48,7 +48,7 @@ void test1() {
/*
TEST_OUTPUT:
---
fail_compilation/failob2.d(205): Error: variable `failob2.foo4!int.foo4.p` is left dangling at return
fail_compilation/failob2.d(205): Error: variable `failob2.foo4!int.foo4.p` is not disposed of before return
fail_compilation/failob2.d(209): Error: template instance `failob2.foo4!int` error instantiating
---
*/

View file

@ -18,7 +18,7 @@ fail_compilation/fob1.d(104): Error: variable `fob1.foo1.p` is returned but is U
/* TEST_OUTPUT:
---
fail_compilation/fob1.d(204): Error: variable `fob1.foo2.p` assigning to Owner without disposing of owned value
fail_compilation/fob1.d(203): Error: variable `fob1.foo2.p` is left dangling at return
fail_compilation/fob1.d(203): Error: variable `fob1.foo2.p` is not disposed of before return
---
*/
@ -35,7 +35,7 @@ fail_compilation/fob1.d(203): Error: variable `fob1.foo2.p` is left dangling at
---
fail_compilation/fob1.d(304): Error: variable `fob1.foo3.p` has undefined state and cannot be read
fail_compilation/fob1.d(304): Error: variable `fob1.foo3.p` is returned but is Undefined
fail_compilation/fob1.d(303): Error: variable `fob1.foo3.q` is left dangling at return
fail_compilation/fob1.d(303): Error: variable `fob1.foo3.q` is not disposed of before return
---
*/

View file

@ -8,7 +8,7 @@ void free(int*);
/* TEST_OUTPUT:
---
fail_compilation/fob2.d(110): Error: variable `fob2.foo1.b1` has undefined state and cannot be read
fail_compilation/fob2.d(103): Error: variable `fob2.foo1.p` is left dangling at return
fail_compilation/fob2.d(103): Error: variable `fob2.foo1.p` is not disposed of before return
---
*/
@ -29,7 +29,7 @@ fail_compilation/fob2.d(103): Error: variable `fob2.foo1.p` is left dangling at
/* TEST_OUTPUT:
---
fail_compilation/fob2.d(203): Error: variable `fob2.zoo2.p` is passed as Owner more than once
fail_compilation/fob2.d(202): Error: variable `fob2.zoo2.p` is left dangling at return
fail_compilation/fob2.d(202): Error: variable `fob2.zoo2.p` is not disposed of before return
---
*/
@ -44,7 +44,7 @@ fail_compilation/fob2.d(202): Error: variable `fob2.zoo2.p` is left dangling at
/* TEST_OUTPUT:
---
fail_compilation/fob2.d(303): Error: variable `fob2.foo3.b` is left dangling at return
fail_compilation/fob2.d(303): Error: variable `fob2.foo3.b` is not disposed of before return
---
*/
@ -140,7 +140,7 @@ fail_compilation/fob2.d(515): Error: variable `fob2.test52.p` has undefined stat
/* TEST_OUTPUT:
---
fail_compilation/fob2.d(603): Error: variable `fob2.test6.p` is left dangling at return
fail_compilation/fob2.d(603): Error: variable `fob2.test6.p` is not disposed of before return
---
*/