You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/ui/ptr_to_temporary.stderr
+35-11Lines changed: 35 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,3 @@
1
-
error: lint `clippy::temporary_cstring_as_ptr` has been renamed to `temporary_cstring_as_ptr`
2
-
--> $DIR/ptr_to_temporary.rs:6:5
3
-
|
4
-
LL | clippy::temporary_cstring_as_ptr,
5
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `temporary_cstring_as_ptr`
6
-
|
7
-
= note: `-D renamed-and-removed-lints` implied by `-D warnings`
8
-
9
1
error: returning a raw pointer to a temporary value that cannot be promoted to a constant
10
2
--> $DIR/ptr_to_temporary.rs:22:5
11
3
|
@@ -55,6 +47,14 @@ LL | let pv = vec![1].as_ptr();
55
47
|
56
48
= note: usage of this pointer will cause Undefined Behavior as the temporary will be deallocated at the end of the statement, yet the pointer will continue pointing to it, resulting in a dangling pointer
57
49
50
+
error: calling `as_ptr` on a temporary value
51
+
--> $DIR/ptr_to_temporary.rs:59:14
52
+
|
53
+
LL | let pa = helper().as_ptr();
54
+
| ^^^^^^^^^^^^^^^^^
55
+
|
56
+
= note: usage of this pointer will cause Undefined Behavior as the temporary will be deallocated at the end of the statement, yet the pointer will continue pointing to it, resulting in a dangling pointer
57
+
58
58
error: calling `as_ptr` on a temporary value
59
59
--> $DIR/ptr_to_temporary.rs:63:14
60
60
|
@@ -72,20 +72,44 @@ LL | let prc = RefCell::new("oops more ub").as_ptr();
72
72
= note: usage of this pointer will cause Undefined Behavior as the temporary will be deallocated at the end of the statement, yet the pointer will continue pointing to it, resulting in a dangling pointer
73
73
74
74
error: calling `as_ptr` on a temporary value
75
-
--> $DIR/ptr_to_temporary.rs:71:26
75
+
--> $DIR/ptr_to_temporary.rs:72:26
76
76
|
77
77
LL | let pcstr = unsafe { CString::new(vec![]).unwrap().as_ptr() };
78
78
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
79
79
|
80
80
= note: usage of this pointer will cause Undefined Behavior as the temporary will be deallocated at the end of the statement, yet the pointer will continue pointing to it, resulting in a dangling pointer
81
81
82
82
error: calling `as_ptr` on a temporary value
83
-
--> $DIR/ptr_to_temporary.rs:75:24
83
+
--> $DIR/ptr_to_temporary.rs:76:24
84
84
|
85
85
LL | let pab = unsafe { AtomicBool::new(true).as_ptr() };
86
86
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87
87
|
88
88
= note: usage of this pointer will cause Undefined Behavior as the temporary will be deallocated at the end of the statement, yet the pointer will continue pointing to it, resulting in a dangling pointer
89
89
90
-
error: aborting due to 11 previous errors
90
+
error: calling `as_ptr` on a temporary value
91
+
--> $DIR/ptr_to_temporary.rs:80:14
92
+
|
93
+
LL | let ps = vec![1].as_slice().as_ptr();
94
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
95
+
|
96
+
= note: usage of this pointer will cause Undefined Behavior as the temporary will be deallocated at the end of the statement, yet the pointer will continue pointing to it, resulting in a dangling pointer
97
+
98
+
error: calling `as_ptr` on a temporary value
99
+
--> $DIR/ptr_to_temporary.rs:141:5
100
+
|
101
+
LL | pcstr.as_c_str().as_ptr();
102
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
103
+
|
104
+
= note: usage of this pointer will cause Undefined Behavior as the temporary will be deallocated at the end of the statement, yet the pointer will continue pointing to it, resulting in a dangling pointer
105
+
106
+
error: calling `as_ptr` on a temporary value
107
+
--> $DIR/ptr_to_temporary.rs:148:5
108
+
|
109
+
LL | CString::as_c_str(&pcstr).as_ptr();
110
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
111
+
|
112
+
= note: usage of this pointer will cause Undefined Behavior as the temporary will be deallocated at the end of the statement, yet the pointer will continue pointing to it, resulting in a dangling pointer
0 commit comments