title: How does mscorlib's `System.Boolean` avoid struct layout cycles?
body: <p>The source-code for <code>System.Boolean</code> at the Reference Source website states that instances of the <code>struct Boolean</code> contain only a single <code>bool</code> field: <code>private bool m_value</code>:</p>
  
  <p><a href="https://referencesource.microsoft.com/#mscorlib/system/boolean.cs,f1b135ff6c380b37" rel="noreferrer">https://referencesource.microsoft.com/#mscorlib/system/boolean.cs,f1b135ff6c380b37</a></p>
  
  <pre><code>namespace System {
  
      using System;
      using System.Globalization;
      using System.Diagnostics.Contracts;
  
      [Serializable]
      [System.Runtime.InteropServices.ComVisible(true)]
      public struct Boolean : IComparable, IConvertible
  #if GENERICS_WORK
          , IComparable&lt;Boolean&gt;,  IEquatable&lt;Boolean&gt;
  #endif
      {
        private bool m_value;
  
        internal const int True = 1; 
        internal const int False = 0; 
  
        internal const String TrueLiteral  = "True";
        internal const String FalseLiteral = "False";
  
        public static readonly String TrueString  = TrueLiteral;
        public static readonly String FalseString = FalseLiteral;
  }
  </code></pre>
  
  <p>But I noticed that...</p>
  
  <ul>
  <li><code>bool</code> is <a href="https://stackoverflow.com/questions/134746/what-is-the-difference-between-bool-and-boolean-types-in-c-sharp">a C# language alias</a> for <code>System.Boolean</code>.</li>
  <li>The type is <code>struct Boolean</code> which is a value-type which means <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0523" rel="noreferrer">it cannot contain itself as a field</a>.</li>
  <li>...yet this code presumably compiles.</li>
  <li>I understand that when the <code>-nostdlib</code> compiler option is set you need to provide your own <em>essential</em> type definitions like <code>System.String</code>, <code>System.Int32</code>, <code>System.Exception</code> - that's the only difference.</li>
  <li>The published source-code contains no other special attributes like <code>[MethodImpl( MethodImplOptions.InternalCall )]</code>.</li>
  </ul>
  
  <p>So how does this code compile?</p>