<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/thestinger/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/thestinger">@thestinger</a> found this odd bug. This code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="enum Foo { C { a: int, b: int } }
struct C { a: int, b: int }
fn main() { }"><pre class="notranslate"><code class="notranslate">enum Foo { C { a: int, b: int } }
struct C { a: int, b: int }
fn main() { }
</code></pre></div>
<p dir="auto">properly errors out with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="test.rs:2:0: 2:27 error: duplicate definition of type C
test.rs:2 struct C { a: int, b: int }
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
test.rs:1:11: 1:31 note: first definition of type C here:
test.rs:1 enum Foo { C { a: int, b: int } }
                     ^~~~~~~~~~~~~~~~~~~~"><pre class="notranslate"><code class="notranslate">test.rs:2:0: 2:27 error: duplicate definition of type C
test.rs:2 struct C { a: int, b: int }
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
test.rs:1:11: 1:31 note: first definition of type C here:
test.rs:1 enum Foo { C { a: int, b: int } }
                     ^~~~~~~~~~~~~~~~~~~~
</code></pre></div>
<p dir="auto">However, if you swap the enum and struct definition, it compiles fine with rust HEAD:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="struct C { a: int, b: int }
enum Foo { C { a: int, b: int } }
fn main() { }"><pre class="notranslate"><code class="notranslate">struct C { a: int, b: int }
enum Foo { C { a: int, b: int } }
fn main() { }
</code></pre></div>
<p dir="auto">Using std::net::lookup_host seems to duplicate each IP in the result set.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="prompt&gt; ./main rust-lang.org
V4(72.8.141.90:0)
V4(72.8.141.90:0)

prompt&gt; ./main google.com | sort
V4(74.125.28.100:0)
V4(74.125.28.100:0)
V4(74.125.28.101:0)
V4(74.125.28.101:0)
V4(74.125.28.102:0)
V4(74.125.28.102:0)
V4(74.125.28.113:0)
V4(74.125.28.113:0)
V4(74.125.28.138:0)
V4(74.125.28.138:0)
V4(74.125.28.139:0)
V4(74.125.28.139:0)
V6([2607:f8b0:400e:c04::66]:0)
V6([2607:f8b0:400e:c04::66]:0)"><pre class="notranslate"><code class="notranslate">prompt&gt; ./main rust-lang.org
V4(72.8.141.90:0)
V4(72.8.141.90:0)

prompt&gt; ./main google.com | sort
V4(74.125.28.100:0)
V4(74.125.28.100:0)
V4(74.125.28.101:0)
V4(74.125.28.101:0)
V4(74.125.28.102:0)
V4(74.125.28.102:0)
V4(74.125.28.113:0)
V4(74.125.28.113:0)
V4(74.125.28.138:0)
V4(74.125.28.138:0)
V4(74.125.28.139:0)
V4(74.125.28.139:0)
V6([2607:f8b0:400e:c04::66]:0)
V6([2607:f8b0:400e:c04::66]:0)
</code></pre></div>
<p dir="auto">The documentation snippet (<a href="https://doc.rust-lang.org/std/net/fn.lookup_host.html" rel="nofollow">https://doc.rust-lang.org/std/net/fn.lookup_host.html</a>) is enough to reproduce.</p>
<p dir="auto">I also have a simple gist here:  <a href="https://gist.github.com/nieksand/9c42100be6dc52df3305">https://gist.github.com/nieksand/9c42100be6dc52df3305</a></p>
<p dir="auto">I'm using the latest Rust from master branch on MacOS X 10.9.5.  I have not checked on other platforms.  I see this for any hostname that I try, so I don't think it's a problem on the nameserver side.</p>
<p dir="auto">Expected behavior is seeing each IP address listed only once.</p>