diff options
author | Andrii Kurdiumov <kant2002@gmail.com> | 2022-04-19 01:15:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-19 01:15:32 +0300 |
commit | 778b5226df678f5bf2653e7605e7ce75e8840da4 (patch) | |
tree | 4a002d15e4f6f77d8e5c56955dc5ae269fac6d54 /src/coreclr/nativeaot/Common | |
parent | 70612ee777d4f021db5e220f7b2cfe97dd5cc963 (diff) |
Fix nullability warnings for NativeAOT CoreLib (#65137)
* Fix nullability warnings for NatveAOT CoreLib
Enable checks for CS8600
Contributes to dotnet/runtimelab#106
* Bunch of CS8602
* Apply PR feedback
* Fix compile error
* Fix errors
* Use notnull constraint
Diffstat (limited to 'src/coreclr/nativeaot/Common')
-rw-r--r-- | src/coreclr/nativeaot/Common/src/Internal/Runtime/CompilerHelpers/StartupCodeHelpers.cs | 2 | ||||
-rw-r--r-- | src/coreclr/nativeaot/Common/src/Internal/Runtime/CompilerHelpers/StartupDebug.cs | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/coreclr/nativeaot/Common/src/Internal/Runtime/CompilerHelpers/StartupCodeHelpers.cs b/src/coreclr/nativeaot/Common/src/Internal/Runtime/CompilerHelpers/StartupCodeHelpers.cs index c7816d4c3c8..5439dfb5ce1 100644 --- a/src/coreclr/nativeaot/Common/src/Internal/Runtime/CompilerHelpers/StartupCodeHelpers.cs +++ b/src/coreclr/nativeaot/Common/src/Internal/Runtime/CompilerHelpers/StartupCodeHelpers.cs @@ -88,7 +88,7 @@ namespace Internal.Runtime.CompilerHelpers private static void AddModule(TypeManagerHandle newModuleHandle) { - if (s_modules == null || s_moduleCount >= s_modules.Length) + if (s_moduleCount >= s_modules!.Length) { // Reallocate logical module array int newModuleLength = 2 * s_moduleCount; diff --git a/src/coreclr/nativeaot/Common/src/Internal/Runtime/CompilerHelpers/StartupDebug.cs b/src/coreclr/nativeaot/Common/src/Internal/Runtime/CompilerHelpers/StartupDebug.cs index b69af16e839..637dd68a569 100644 --- a/src/coreclr/nativeaot/Common/src/Internal/Runtime/CompilerHelpers/StartupDebug.cs +++ b/src/coreclr/nativeaot/Common/src/Internal/Runtime/CompilerHelpers/StartupDebug.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; namespace Internal.Runtime.CompilerHelpers { @@ -13,7 +14,7 @@ namespace Internal.Runtime.CompilerHelpers internal static class StartupDebug { [Conditional("DEBUG")] - public static void Assert(bool condition) + public static void Assert([DoesNotReturnIf(false)] bool condition) { if (!condition) unsafe { *(int*)0 = 0; } |