Make the Ruby DSL use a unique filename for each implicit file.
diff --git a/ruby/lib/google/protobuf/descriptor_dsl.rb b/ruby/lib/google/protobuf/descriptor_dsl.rb
index 3c1b8e4..ba1a255 100644
--- a/ruby/lib/google/protobuf/descriptor_dsl.rb
+++ b/ruby/lib/google/protobuf/descriptor_dsl.rb
@@ -7,7 +7,24 @@
 module Google
   module Protobuf
     module Internal
+      class AtomicCounter
+        def initialize
+          @n = 0
+          @mu = Mutex.new
+        end
+
+        def get_and_increment
+          n = @n
+          @mu.synchronize {
+            @n += 1
+          }
+          return n
+        end
+      end
+
       class Builder
+        @@file_number = AtomicCounter.new
+
         def initialize(pool)
           @pool = pool
           @default_file = nil  # Constructed lazily
@@ -42,7 +59,9 @@
         end
 
         private def internal_default_file
-          @default_file ||= FileBuilder.new(@pool, "ruby_default_file.proto")
+          number = @@file_number.get_and_increment
+          filename = "ruby_default_file#{number}.proto"
+          @default_file ||= FileBuilder.new(@pool, filename)
         end
       end