mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: require unsafe for Struct(voidptr) casts
This commit is contained in:
@ -118,13 +118,13 @@ fn process_in_thread(mut pool PoolProcessor, task_id int) {
|
||||
// get_item - called by the worker callback.
|
||||
// Retrieves a type safe instance of the currently processed item
|
||||
pub fn (pool &PoolProcessor) get_item[T](idx int) T {
|
||||
return *(&T(pool.items[idx]))
|
||||
return unsafe { *(&T(pool.items[idx])) }
|
||||
}
|
||||
|
||||
// get_result - called by the main thread to get a specific result.
|
||||
// Retrieves a type safe instance of the produced result.
|
||||
pub fn (pool &PoolProcessor) get_result[T](idx int) T {
|
||||
return *(&T(pool.results[idx]))
|
||||
return unsafe { *(&T(pool.results[idx])) }
|
||||
}
|
||||
|
||||
// get_results - get a list of type safe results in the main thread.
|
||||
@ -140,7 +140,7 @@ pub fn (pool &PoolProcessor) get_results[T]() []T {
|
||||
pub fn (pool &PoolProcessor) get_results_ref[T]() []&T {
|
||||
mut res := []&T{cap: pool.results.len}
|
||||
for i in 0 .. pool.results.len {
|
||||
res << &T(pool.results[i])
|
||||
res << unsafe { &T(pool.results[i]) }
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
Reference in New Issue
Block a user