NativeList.GetUnsafePtr() throwing The type 'T' must be a non-nullable value type

I have this method

public static unsafe void ClearMemory<T>(
    this NativeList<T> nativeList)
    where T : struct
    UnsafeUtility.MemClear(nativeList.GetUnsafePtr(), nativeList.Length * UnsafeUtility.SizeOf<T>());

and I get the following error:

The type 'T' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'

Arrays are working fine, but Lists don’t.

Anybody got a suggestion?

where T : unmanaged

where T : struct does not exclude managed types from struct fields where many Unity.Collections requires it.