Merge pull request #4538 from apple/stdlib-warning-suppression

[stdlib] Suppress noisy warnings
diff --git a/docs/Literals.rst b/docs/Literals.rst
index 6b52bd9..a55471e 100644
--- a/docs/Literals.rst
+++ b/docs/Literals.rst
@@ -138,6 +138,6 @@
 
 String interpolations are a bit different: they try to individually convert
 each element of the interpolation to the type that adopts
-ExpressibleByStringInterpolation, then calls the variadic
+_ExpressibleByStringInterpolation, then calls the variadic
 ``convertFromStringInterpolation`` to put them all together. The default type
 for an interpolated literal without context is also ``StringLiteralType``.
diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def
index 9dcdb83..56630ef 100644
--- a/include/swift/AST/DiagnosticsSema.def
+++ b/include/swift/AST/DiagnosticsSema.def
@@ -2107,10 +2107,10 @@
      "test for '!= nil' instead", (Type))
 
 ERROR(interpolation_missing_proto,none,
-      "string interpolation requires the protocol 'ExpressibleByStringInterpolation' to be defined",
+      "string interpolation requires the protocol '_ExpressibleByStringInterpolation' to be defined",
       ())
 ERROR(interpolation_broken_proto,none,
-      "protocol 'ExpressibleByStringInterpolation' is broken",
+      "protocol '_ExpressibleByStringInterpolation' is broken",
       ())
 
 ERROR(object_literal_broken_proto,none,
diff --git a/include/swift/AST/KnownProtocols.def b/include/swift/AST/KnownProtocols.def
index 1d6a2c9..af1cc87 100644
--- a/include/swift/AST/KnownProtocols.def
+++ b/include/swift/AST/KnownProtocols.def
@@ -71,7 +71,7 @@
 EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByExtendedGraphemeClusterLiteral)
 EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByFloatLiteral)
 EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByIntegerLiteral)
-EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByStringInterpolation)
+EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByStringInterpolation)
 EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByStringLiteral)
 EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByNilLiteral)
 EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByUnicodeScalarLiteral)
diff --git a/stdlib/private/StdlibCollectionUnittest/CheckCollectionInstance.swift.gyb b/stdlib/private/StdlibCollectionUnittest/CheckCollectionInstance.swift.gyb
index 3350d35..48fb3f8 100644
--- a/stdlib/private/StdlibCollectionUnittest/CheckCollectionInstance.swift.gyb
+++ b/stdlib/private/StdlibCollectionUnittest/CheckCollectionInstance.swift.gyb
@@ -40,8 +40,8 @@
 }
 
 % for inc, protocol, direction, end in (
-%  ('inc', 'Indexable', 'after', 'end'),
-%  ('dec', 'BidirectionalIndexable', 'before', 'start')):
+%  ('inc', '_Indexable', 'after', 'end'),
+%  ('dec', '_BidirectionalIndexable', 'before', 'start')):
 
 /// Test that the elements of `instances` satisfy
 /// ${'some of ' if inc == 'dec' else ''}the semantic
@@ -91,7 +91,7 @@
   ${TRACE}
 ) where
   Instances : Collection,
-  BaseCollection : Indexable,
+  BaseCollection : _Indexable,
   Instances.Iterator.Element == BaseCollection.Index,
   // FIXME(compiler limitation): these constraints should be applied to
   // associated types of Collection.
@@ -128,7 +128,7 @@
   endIndex: Instances.Iterator.Element, ${TRACE}
 ) where
   Instances : Collection,
-  BaseCollection : Indexable,
+  BaseCollection : _Indexable,
   Instances.Iterator.Element == BaseCollection.Index,
   // FIXME(compiler limitation): these constraints should be applied to
   // associated types of Collection.
@@ -158,7 +158,7 @@
   ${TRACE}
 ) where
   Instances: Collection,
-  BaseCollection : BidirectionalIndexable,
+  BaseCollection : _BidirectionalIndexable,
   Instances.Iterator.Element == BaseCollection.Index,
   // FIXME(compiler limitation): these constraints should be applied to
   // associated types of Collection.
@@ -197,7 +197,7 @@
 ) where
   Instances : Collection,
   Distances : Collection,
-  BaseCollection : RandomAccessIndexable,
+  BaseCollection : _RandomAccessIndexable,
   Instances.Iterator.Element == BaseCollection.Index,
   Distances.Iterator.Element == BaseCollection.IndexDistance,
   // FIXME(compiler limitation): these constraints should be applied to
@@ -230,7 +230,7 @@
 ) where
   Instances : Collection,
   Distances : Collection,
-  BaseCollection : Indexable,
+  BaseCollection : _Indexable,
   Instances.Iterator.Element == BaseCollection.Index,
   Distances.Iterator.Element == BaseCollection.IndexDistance,
   // FIXME(compiler limitation): these constraints should be applied to
diff --git a/stdlib/public/SDK/Foundation/Data.swift b/stdlib/public/SDK/Foundation/Data.swift
index 22e0dcc..764234a 100644
--- a/stdlib/public/SDK/Foundation/Data.swift
+++ b/stdlib/public/SDK/Foundation/Data.swift
@@ -735,10 +735,10 @@
 
 extension Data {
     @available(*, unavailable, renamed: "copyBytes(to:count:)")
-    public func getBytes(_ buffer: UnsafeMutablePointer<Swift.Void>, length: Int) { }
+  public func getBytes<UnsafeMutablePointerVoid: _Pointer>(_ buffer: UnsafeMutablePointerVoid, length: Int) { }
 
     @available(*, unavailable, renamed: "copyBytes(to:from:)")
-    public func getBytes(_ buffer: UnsafeMutablePointer<Swift.Void>, range: NSRange) { }
+    public func getBytes<UnsafeMutablePointerVoid: _Pointer>(_ buffer: UnsafeMutablePointerVoid, range: NSRange) { }
 }
 
 /// Provides bridging functionality for struct Data to class NSData and vice-versa.
diff --git a/stdlib/public/core/BidirectionalCollection.swift b/stdlib/public/core/BidirectionalCollection.swift
index e2c9f30..0d99d47 100644
--- a/stdlib/public/core/BidirectionalCollection.swift
+++ b/stdlib/public/core/BidirectionalCollection.swift
@@ -17,7 +17,8 @@
 /// `BidirectionalCollection` protocol instead, because it has a more complete
 /// interface.
 @available(*, deprecated, message: "it will be removed in Swift 4.0.  Please use 'BidirectionalCollection' instead")
-public protocol BidirectionalIndexable : Indexable {
+public typealias BidirectionalIndexable = _BidirectionalIndexable
+public protocol _BidirectionalIndexable : _Indexable {
   // FIXME(ABI)(compiler limitation): there is no reason for this protocol
   // to exist apart from missing compiler features that we emulate with it.
   // rdar://problem/20531108
@@ -65,7 +66,7 @@
 /// - If `i > c.startIndex && i <= c.endIndex`
 ///   `c.index(after: c.index(before: i)) == i`.
 public protocol BidirectionalCollection
-  : BidirectionalIndexable, Collection {
+  : _BidirectionalIndexable, Collection {
 
 // TODO: swift-3-indexing-model - replaces functionality in BidirectionalIndex
   /// Returns the position immediately before the given index.
@@ -83,18 +84,37 @@
 
   /// A sequence that can represent a contiguous subrange of the collection's
   /// elements.
-  associatedtype SubSequence : BidirectionalIndexable, Collection
+  associatedtype SubSequence : _BidirectionalIndexable, Collection
     = BidirectionalSlice<Self>
   // FIXME(compiler limitation):
   // associatedtype SubSequence : BidirectionalCollection
 
   /// A type that can represent the indices that are valid for subscripting the
   /// collection, in ascending order.
-  associatedtype Indices : BidirectionalIndexable, Collection
+  associatedtype Indices : _BidirectionalIndexable, Collection
     = DefaultBidirectionalIndices<Self>
   // FIXME(compiler limitation):
   // associatedtype Indices : BidirectionalCollection
 
+  /// The indices that are valid for subscripting the collection, in ascending
+  /// order.
+  ///
+  /// A collection's `indices` property can hold a strong reference to the
+  /// collection itself, causing the collection to be non-uniquely referenced.
+  /// If you mutate the collection while iterating over its indices, a strong
+  /// reference can cause an unexpected copy of the collection. To avoid the
+  /// unexpected copy, use the `index(after:)` method starting with
+  /// `startIndex` to produce indices instead.
+  ///
+  ///     var c = MyFancyCollection([10, 20, 30, 40, 50])
+  ///     var i = c.startIndex
+  ///     while i != c.endIndex {
+  ///         c[i] /= 5
+  ///         i = c.index(after: i)
+  ///     }
+  ///     // c == MyFancyCollection([2, 4, 6, 8, 10])
+  var indices: Indices { get }
+  
   // TODO: swift-3-indexing-model: tests.
   /// The last element of the collection.
   ///
@@ -111,7 +131,7 @@
 }
 
 /// Default implementation for bidirectional collections.
-extension BidirectionalIndexable {
+extension _BidirectionalIndexable {
 
   @inline(__always)
   public func formIndex(before i: inout Index) {
diff --git a/stdlib/public/core/Builtin.swift b/stdlib/public/core/Builtin.swift
index 96519ce..b429f26 100644
--- a/stdlib/public/core/Builtin.swift
+++ b/stdlib/public/core/Builtin.swift
@@ -193,12 +193,12 @@
 /// not much you can do with this other than use it to identify the
 /// object.
 @available(*, unavailable, message: "Removed in Swift 3. Use Unmanaged.passUnretained(x).toOpaque() instead.")
-public func unsafeAddress(of object: AnyObject) -> UnsafePointer<Void> {
+public func unsafeAddress(of object: AnyObject) -> UnsafeRawPointer {
   Builtin.unreachable()
 }
 
 @available(*, unavailable, message: "Removed in Swift 3. Use Unmanaged.passUnretained(x).toOpaque() instead.")
-public func unsafeAddressOf(_ object: AnyObject) -> UnsafePointer<Void> {
+public func unsafeAddressOf(_ object: AnyObject) -> UnsafeRawPointer {
   Builtin.unreachable()
 }
 
diff --git a/stdlib/public/core/Collection.swift b/stdlib/public/core/Collection.swift
index 2fc1c85..b758922 100644
--- a/stdlib/public/core/Collection.swift
+++ b/stdlib/public/core/Collection.swift
@@ -16,7 +16,8 @@
 /// In most cases, it's best to ignore this protocol and use the `Collection`
 /// protocol instead, because it has a more complete interface.
 @available(*, deprecated, message: "it will be removed in Swift 4.0.  Please use 'Collection' instead")
-public protocol IndexableBase {
+public typealias IndexableBase = _IndexableBase
+public protocol _IndexableBase {
   // FIXME(ABI)(compiler limitation): there is no reason for this protocol
   // to exist apart from missing compiler features that we emulate with it.
   // rdar://problem/20531108
@@ -159,7 +160,8 @@
 /// In most cases, it's best to ignore this protocol and use the `Collection`
 /// protocol instead, because it has a more complete interface.
 @available(*, deprecated, message: "it will be removed in Swift 4.0.  Please use 'Collection' instead")
-public protocol Indexable : IndexableBase {
+public typealias Indexable = _Indexable
+public protocol _Indexable : _IndexableBase {
   /// A type used to represent the number of steps between two indices, where
   /// one value is reachable from the other.
   ///
@@ -354,7 +356,7 @@
 ///     // Prints "15.0"
 ///     // Prints "20.0"
 public struct IndexingIterator<
-  Elements : IndexableBase
+  Elements : _IndexableBase
   // FIXME(compiler limitation):
   // Elements : Collection
 > : IteratorProtocol, Sequence {
@@ -530,7 +532,7 @@
 /// forward or bidirectional collection must traverse the entire collection to
 /// count the number of contained elements, accessing its `count` property is
 /// an O(*n*) operation.
-public protocol Collection : Indexable, Sequence {
+public protocol Collection : _Indexable, Sequence {
   /// A type that can represent the number of steps between a pair of
   /// indices.
   associatedtype IndexDistance : SignedInteger = Int
@@ -555,7 +557,7 @@
   /// This associated type appears as a requirement in the `Sequence`
   /// protocol, but it is restated here with stricter constraints. In a
   /// collection, the subsequence should also conform to `Collection`.
-  associatedtype SubSequence : IndexableBase, Sequence = Slice<Self>
+  associatedtype SubSequence : _IndexableBase, Sequence = Slice<Self>
   // FIXME(compiler limitation):
   // associatedtype SubSequence : Collection
   //   where
@@ -614,7 +616,7 @@
 
   /// A type that can represent the indices that are valid for subscripting the
   /// collection, in ascending order.
-  associatedtype Indices : IndexableBase, Sequence = DefaultIndices<Self>
+  associatedtype Indices : _Indexable, Sequence = DefaultIndices<Self>
 
   // FIXME(compiler limitation):
   // associatedtype Indices : Collection
@@ -859,7 +861,7 @@
 }
 
 /// Default implementation for forward collections.
-extension Indexable {
+extension _Indexable {
   /// Replaces the given index with its successor.
   ///
   /// - Parameter i: A valid index of the collection. `i` must be less than
@@ -1702,7 +1704,7 @@
 public enum Bit {}
 
 @available(*, unavailable, renamed: "IndexingIterator")
-public struct IndexingGenerator<Elements : IndexableBase> {}
+public struct IndexingGenerator<Elements : _IndexableBase> {}
 
 @available(*, unavailable, renamed: "Collection")
 public typealias CollectionType = Collection
diff --git a/stdlib/public/core/CollectionAlgorithms.swift.gyb b/stdlib/public/core/CollectionAlgorithms.swift.gyb
index 92b9598..b613e2d 100644
--- a/stdlib/public/core/CollectionAlgorithms.swift.gyb
+++ b/stdlib/public/core/CollectionAlgorithms.swift.gyb
@@ -469,7 +469,7 @@
   }
 }
 
-% for Self in 'Indexable', 'MutableIndexable':
+% for Self in '_Indexable', '_MutableIndexable':
 %{
 
 subscriptCommentPre = """\
diff --git a/stdlib/public/core/CompilerProtocols.swift b/stdlib/public/core/CompilerProtocols.swift
index 3df6243..8e964f7 100644
--- a/stdlib/public/core/CompilerProtocols.swift
+++ b/stdlib/public/core/CompilerProtocols.swift
@@ -614,7 +614,8 @@
 ///           String(stringInterpolationSegment: price * number),
 ///           String(stringInterpolationSegment: "."))
 @available(*, deprecated, message: "it will be replaced or redesigned in Swift 4.0.  Instead of conforming to 'ExpressibleByStringInterpolation', consider adding an 'init(_:String)'")
-public protocol ExpressibleByStringInterpolation {
+public typealias ExpressibleByStringInterpolation = _ExpressibleByStringInterpolation
+public protocol _ExpressibleByStringInterpolation {
   /// Creates an instance by concatenating the given values.
   ///
   /// Do not call this initializer directly. It is used by the compiler when
diff --git a/stdlib/public/core/ExistentialCollection.swift.gyb b/stdlib/public/core/ExistentialCollection.swift.gyb
index 9d7d637..edc31ab 100644
--- a/stdlib/public/core/ExistentialCollection.swift.gyb
+++ b/stdlib/public/core/ExistentialCollection.swift.gyb
@@ -799,6 +799,9 @@
 public struct ${Self}<Element>
   : _AnyCollectionProtocol, ${SelfProtocol} {
 
+//  public typealias Indices
+//    = Default${Traversal.replace('Forward', '')}Indices<${Self}>
+  
   internal init(_box: _${Self}Box<Element>) {
     self._box = _box
   }
diff --git a/stdlib/public/core/HashedCollections.swift.gyb b/stdlib/public/core/HashedCollections.swift.gyb
index 9107e37..7624053 100644
--- a/stdlib/public/core/HashedCollections.swift.gyb
+++ b/stdlib/public/core/HashedCollections.swift.gyb
@@ -2211,7 +2211,7 @@
   var result = Dictionary<BaseKey, BaseValue>(minimumCapacity: source.count)
 
   for (k, v) in source {
-    result[k as! BaseKey] = v as! BaseValue
+    result[k as! BaseKey] = (v as! BaseValue)
   }
   return result
 }
diff --git a/stdlib/public/core/Indices.swift.gyb b/stdlib/public/core/Indices.swift.gyb
index ae238d1..0baa782 100644
--- a/stdlib/public/core/Indices.swift.gyb
+++ b/stdlib/public/core/Indices.swift.gyb
@@ -30,7 +30,7 @@
 
 /// A collection of indices for an arbitrary ${collection}.
 public struct ${Self}<
-  Elements : ${collectionForTraversal(Traversal).replace('Collection', 'Indexable')}
+  Elements : _${collectionForTraversal(Traversal).replace('Collection', 'Indexable')}
   // FIXME(ABI)(compiler limitation):
   // Elements : Collection
   // rdar://problem/20531108
diff --git a/stdlib/public/core/MutableCollection.swift b/stdlib/public/core/MutableCollection.swift
index 3a5fa39..4e34dad 100644
--- a/stdlib/public/core/MutableCollection.swift
+++ b/stdlib/public/core/MutableCollection.swift
@@ -16,7 +16,8 @@
 /// `MutableCollection` protocol instead, because it has a more complete
 /// interface.
 @available(*, deprecated, message: "it will be removed in Swift 4.0.  Please use 'MutableCollection' instead")
-public protocol MutableIndexable : Indexable {
+public typealias MutableIndexable = _MutableIndexable
+public protocol _MutableIndexable : _Indexable {
   // FIXME(ABI)(compiler limitation): there is no reason for this protocol
   // to exist apart from missing compiler features that we emulate with it.
   // rdar://problem/20531108
@@ -216,7 +217,7 @@
 ///     // Must be equivalent to:
 ///     a[i] = x
 ///     let y = x
-public protocol MutableCollection : MutableIndexable, Collection {
+public protocol MutableCollection : _MutableIndexable, Collection {
   // FIXME: should be constrained to MutableCollection
   // (<rdar://problem/20715009> Implement recursive protocol
   // constraints)
diff --git a/stdlib/public/core/RandomAccessCollection.swift b/stdlib/public/core/RandomAccessCollection.swift
index 88001bc..7d613f6 100644
--- a/stdlib/public/core/RandomAccessCollection.swift
+++ b/stdlib/public/core/RandomAccessCollection.swift
@@ -16,7 +16,8 @@
 /// `RandomAccessCollection` protocol instead, because it has a more complete
 /// interface.
 @available(*, deprecated, message: "it will be removed in Swift 4.0.  Please use 'RandomAccessCollection' instead")
-public protocol RandomAccessIndexable : BidirectionalIndexable {
+public typealias RandomAccessIndexable = _RandomAccessIndexable
+public protocol _RandomAccessIndexable : _BidirectionalIndexable {
   // FIXME(ABI)(compiler limitation): there is no reason for this protocol
   // to exist apart from missing compiler features that we emulate with it.
   // rdar://problem/20531108
@@ -46,21 +47,40 @@
 /// `Strideable` protocol or you must implement the `index(_:offsetBy:)` and
 /// `distance(from:to:)` methods with O(1) efficiency.
 public protocol RandomAccessCollection :
-  RandomAccessIndexable, BidirectionalCollection
+  _RandomAccessIndexable, BidirectionalCollection
 {
   /// A collection that represents a contiguous subrange of the collection's
   /// elements.
-  associatedtype SubSequence : RandomAccessIndexable, BidirectionalCollection
+  associatedtype SubSequence : _RandomAccessIndexable, BidirectionalCollection
     = RandomAccessSlice<Self>
   // FIXME(compiler limitation):
   // associatedtype SubSequence : RandomAccessCollection
 
   /// A type that can represent the indices that are valid for subscripting the
   /// collection, in ascending order.
-  associatedtype Indices : RandomAccessIndexable, BidirectionalCollection
+  associatedtype Indices : _RandomAccessIndexable, BidirectionalCollection
     = DefaultRandomAccessIndices<Self>
   // FIXME(compiler limitation):
   // associatedtype Indices : RandomAccessCollection
+
+  /// The indices that are valid for subscripting the collection, in ascending
+  /// order.
+  ///
+  /// A collection's `indices` property can hold a strong reference to the
+  /// collection itself, causing the collection to be non-uniquely referenced.
+  /// If you mutate the collection while iterating over its indices, a strong
+  /// reference can cause an unexpected copy of the collection. To avoid the
+  /// unexpected copy, use the `index(after:)` method starting with
+  /// `startIndex` to produce indices instead.
+  ///
+  ///     var c = MyFancyCollection([10, 20, 30, 40, 50])
+  ///     var i = c.startIndex
+  ///     while i != c.endIndex {
+  ///         c[i] /= 5
+  ///         i = c.index(after: i)
+  ///     }
+  ///     // c == MyFancyCollection([2, 4, 6, 8, 10])
+  var indices: Indices { get }
 }
 
 /// Supply the default "slicing" `subscript` for `RandomAccessCollection`
@@ -103,7 +123,7 @@
 // wrong complexity.
 
 /// Default implementation for random access collections.
-extension RandomAccessIndexable {
+extension _RandomAccessIndexable {
   /// Returns an index that is the specified distance from the given index,
   /// unless that distance is beyond a given limiting index.
   ///
diff --git a/stdlib/public/core/RangeReplaceableCollection.swift.gyb b/stdlib/public/core/RangeReplaceableCollection.swift.gyb
index 692639b..490e1d0 100644
--- a/stdlib/public/core/RangeReplaceableCollection.swift.gyb
+++ b/stdlib/public/core/RangeReplaceableCollection.swift.gyb
@@ -14,7 +14,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// FIXME: swift-3-indexing-model: synchronize Indexable with the actual
+// FIXME: swift-3-indexing-model: synchronize _Indexable with the actual
 // protocol.
 /// A type that supports replacement of an arbitrary subrange of elements with
 /// the elements of another collection.
@@ -23,7 +23,8 @@
 /// `RangeReplaceableCollection` protocol instead, because it has a more
 /// complete interface.
 @available(*, deprecated, message: "it will be removed in Swift 4.0.  Please use 'RandomAccessCollection' instead")
-public protocol RangeReplaceableIndexable : Indexable {
+public typealias RangeReplaceableIndexable = _RangeReplaceableIndexable
+public protocol _RangeReplaceableIndexable : _Indexable {
   // FIXME(ABI)(compiler limitation): there is no reason for this protocol
   // to exist apart from missing compiler features that we emulate with it.
   // rdar://problem/20531108
@@ -241,7 +242,7 @@
 /// of the protocol's required methods to provide your own custom
 /// implementation.
 public protocol RangeReplaceableCollection
-  : RangeReplaceableIndexable, Collection
+  : _RangeReplaceableIndexable, Collection
 {
   //===--- Fundamental Requirements ---------------------------------------===//
 
diff --git a/stdlib/public/core/Slice.swift.gyb b/stdlib/public/core/Slice.swift.gyb
index 9ef92fb..9b4173e 100644
--- a/stdlib/public/core/Slice.swift.gyb
+++ b/stdlib/public/core/Slice.swift.gyb
@@ -96,11 +96,11 @@
 %   for Mutable in [ False, True ]:
 %     for RangeReplaceable in [ False, True ]:
 %       Self = sliceTypeName(traversal=Traversal, mutable=Mutable, rangeReplaceable=RangeReplaceable)
-%       BaseRequirements = [collectionForTraversal(Traversal).replace('Collection', 'Indexable')]
+%       BaseRequirements = ['_' + collectionForTraversal(Traversal).replace('Collection', 'Indexable')]
 %       if Mutable:
-%         BaseRequirements.append('MutableIndexable')
+%         BaseRequirements.append('_MutableIndexable')
 %       if RangeReplaceable:
-%         BaseRequirements.append('RangeReplaceableIndexable')
+%         BaseRequirements.append('_RangeReplaceableIndexable')
 %       BaseRequirements = ' & '.join(BaseRequirements)
 %       SelfProtocols = ', '.join(protocolsForCollectionFeatures(traversal=Traversal, mutable=Mutable, rangeReplaceable=RangeReplaceable))
 
diff --git a/stdlib/public/core/StringInterpolation.swift.gyb b/stdlib/public/core/StringInterpolation.swift.gyb
index 384785d..071f6ce 100644
--- a/stdlib/public/core/StringInterpolation.swift.gyb
+++ b/stdlib/public/core/StringInterpolation.swift.gyb
@@ -34,7 +34,7 @@
 
 }%
 
-extension String : ExpressibleByStringInterpolation {
+extension String : _ExpressibleByStringInterpolation {
   /// Creates a new string by concatenating the given interpolations.
   ///
   /// Do not call this initializer directly. It is used by the compiler when
diff --git a/stdlib/public/core/UnsafeBufferPointer.swift.gyb b/stdlib/public/core/UnsafeBufferPointer.swift.gyb
index b2f4ba2..8cab815 100644
--- a/stdlib/public/core/UnsafeBufferPointer.swift.gyb
+++ b/stdlib/public/core/UnsafeBufferPointer.swift.gyb
@@ -37,7 +37,7 @@
 ///
 /// The pointer should be aligned to `MemoryLayout<Element>.alignment`.
 public struct Unsafe${Mutable}BufferPointer<Element>
-  : ${Mutable}Indexable, ${Mutable}Collection, RandomAccessCollection {
+  : _${Mutable}Indexable, ${Mutable}Collection, RandomAccessCollection {
 
   public typealias Index = Int
   public typealias IndexDistance = Int
diff --git a/test/Interpreter/repl.swift b/test/Interpreter/repl.swift
index 996b865..6f82de3 100644
--- a/test/Interpreter/repl.swift
+++ b/test/Interpreter/repl.swift
@@ -4,7 +4,7 @@
 
 :print_decl String
 // CHECK: struct String
-// CHECK: extension String : ExpressibleByStringInterpolation
+// CHECK: extension String : _ExpressibleByStringInterpolation
 
 false // CHECK: Bool = false
 (1,2) // CHECK: (Int, Int) = (1, 2)
diff --git a/test/SILOptimizer/prespecialize.swift b/test/SILOptimizer/prespecialize.swift
index 96b9d08..b5f416b 100644
--- a/test/SILOptimizer/prespecialize.swift
+++ b/test/SILOptimizer/prespecialize.swift
@@ -11,7 +11,7 @@
 // CHECK: function_ref @_TTSgq5GVs14CountableRangeSi_GS_Si_s10Collections___TFesRxs10Collectionwx8IteratorzGVs16IndexingIteratorx_wx8_ElementzWxS0_7Element_rS_12makeIteratorfT_GS1_x_
 //
 // function_ref specialized IndexingIterator.next() -> A._Element?
-// CHECK: function_ref @_TTSgq5GVs14CountableRangeSi_GS_Si_s13IndexableBases___TFVs16IndexingIterator4nextfT_GSqwx8_Element_
+// CHECK: function_ref @_TTSgq5GVs14CountableRangeSi_GS_Si_s14_IndexableBases___TFVs16IndexingIterator4nextfT_GSqwx8_Element_
 //
 // Look for generic specialization <Swift.Int> of Swift.Array.subscript.getter : (Swift.Int) -> A
 // CHECK: function_ref {{@_TTSgq5Si___TFSag9subscriptFSix|@_TTSg5Si___TFSaap9subscriptFSix}}
diff --git a/validation-test/stdlib/CollectionDiagnostics.swift b/validation-test/stdlib/CollectionDiagnostics.swift
index 94a85db..7bf4cd9 100644
--- a/validation-test/stdlib/CollectionDiagnostics.swift
+++ b/validation-test/stdlib/CollectionDiagnostics.swift
@@ -8,7 +8,7 @@
 //
 
 // expected-error@+3 {{type 'CollectionWithBadSubSequence' does not conform to protocol 'Collection'}}
-// expected-error@+2 {{type 'CollectionWithBadSubSequence' does not conform to protocol 'IndexableBase'}}
+// expected-error@+2 {{type 'CollectionWithBadSubSequence' does not conform to protocol '_IndexableBase'}}
 // expected-error@+1 {{type 'CollectionWithBadSubSequence' does not conform to protocol 'Sequence'}}
 struct CollectionWithBadSubSequence : Collection {
   var startIndex: MinimalIndex {
@@ -23,7 +23,7 @@
     fatalError("unreachable")
   }
 
-  // expected-note@+3 {{possibly intended match 'CollectionWithBadSubSequence.SubSequence' (aka 'OpaqueValue<Int8>') does not conform to 'IndexableBase'}}
+  // expected-note@+3 {{possibly intended match 'CollectionWithBadSubSequence.SubSequence' (aka 'OpaqueValue<Int8>') does not conform to 'Sequence'}}
   // expected-note@+2 {{possibly intended match}}
   // expected-note@+1 {{possibly intended match}}
   typealias SubSequence = OpaqueValue<Int8>
@@ -66,7 +66,7 @@
 
 
 // expected-warning@+2 {{'Indexable' is deprecated: it will be removed in Swift 4.0.  Please use 'Collection' instead}}
-// expected-error@+1 {{type 'BadIndexable1' does not conform to protocol 'IndexableBase'}}
+// expected-error@+1 {{type 'BadIndexable1' does not conform to protocol '_IndexableBase'}}
 struct BadIndexable1 : Indexable {
   func index(after i: Int) -> Int { return i + 1 }
   var startIndex: Int { return 0 }
@@ -78,7 +78,7 @@
 }
 
 // expected-warning@+2 {{'Indexable' is deprecated: it will be removed in Swift 4.0.  Please use 'Collection' instead}}
-// expected-error@+1 {{type 'BadIndexable2' does not conform to protocol 'IndexableBase'}}
+// expected-error@+1 {{type 'BadIndexable2' does not conform to protocol '_IndexableBase'}}
 struct BadIndexable2 : Indexable {
   var startIndex: Int { return 0 }
   var endIndex: Int { return 0 }
@@ -112,6 +112,6 @@
   // This is a poor error message; it would be better to get a message
   // that index(before:) was missing.
   //
-  // expected-error@+1 {{'index(after:)' has different argument names from those required by protocol 'BidirectionalIndexable' ('index(before:)'}}
+  // expected-error@+1 {{'index(after:)' has different argument names from those required by protocol '_BidirectionalIndexable' ('index(before:)'}}
   func index(after i: Int) -> Int { return 0 }
 }