<p dir="auto">I'm trying to have <code class="notranslate">std</code> imported conditionally for testing only, as I use <code class="notranslate">core</code> in my OS kernel, and found this issue. This code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#![feature(core)]

#![feature(no_std)]
#![no_std]
extern crate std;

extern crate core;

#[derive(Copy)]
pub enum Kind {
    None = 0,
    Reserved = 1,
}"><pre class="notranslate"><code class="notranslate">#![feature(core)]

#![feature(no_std)]
#![no_std]
extern crate std;

extern crate core;

#[derive(Copy)]
pub enum Kind {
    None = 0,
    Reserved = 1,
}
</code></pre></div>
<p dir="auto">With this <code class="notranslate">Cargo.toml</code> (where <code class="notranslate">../lib/libcore</code> is from the exact same commit as the compiler):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[package]
name = &quot;example&quot;
version = &quot;0.0.1&quot;
authors = [&quot;Virtlink &lt;info@example.com&gt;&quot;]

[dependencies.core]
path = &quot;../lib/libcore&quot;"><pre class="notranslate"><code class="notranslate">[package]
name = "example"
version = "0.0.1"
authors = ["Virtlink &lt;info@example.com&gt;"]

[dependencies.core]
path = "../lib/libcore"
</code></pre></div>
<p dir="auto">Gives me these errors:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="   Compiling example v0.0.1 (file:///home/virtlink/projects/example)
src/lib.rs:1:1: 1:1 error: duplicate entry for `const_ptr` [E0152]
src/lib.rs:1 #![feature(core)]
             ^
src/lib.rs:1:1: 1:1 error: duplicate entry for `mut_ptr` [E0152]
src/lib.rs:1 #![feature(core)]
             ^
src/lib.rs:1:1: 1:1 error: duplicate entry for `i8` [E0152]
src/lib.rs:1 #![feature(core)]
             ^

...

src/lib.rs:1:1: 1:1 error: duplicate entry for `non_zero` [E0152]
src/lib.rs:1 #![feature(core)]
             ^
src/lib.rs:1:1: 1:1 error: duplicate entry for `debug_trait` [E0152]
src/lib.rs:1 #![feature(core)]
             ^
error: aborting due to 58 previous errors
Could not compile `example`."><pre class="notranslate"><code class="notranslate">   Compiling example v0.0.1 (file:///home/virtlink/projects/example)
src/lib.rs:1:1: 1:1 error: duplicate entry for `const_ptr` [E0152]
src/lib.rs:1 #![feature(core)]
             ^
src/lib.rs:1:1: 1:1 error: duplicate entry for `mut_ptr` [E0152]
src/lib.rs:1 #![feature(core)]
             ^
src/lib.rs:1:1: 1:1 error: duplicate entry for `i8` [E0152]
src/lib.rs:1 #![feature(core)]
             ^

...

src/lib.rs:1:1: 1:1 error: duplicate entry for `non_zero` [E0152]
src/lib.rs:1 #![feature(core)]
             ^
src/lib.rs:1:1: 1:1 error: duplicate entry for `debug_trait` [E0152]
src/lib.rs:1 #![feature(core)]
             ^
error: aborting due to 58 previous errors
Could not compile `example`.
</code></pre></div>
<p dir="auto">However, if I remove the local <code class="notranslate">libcore</code> dependency from <code class="notranslate">Cargo.toml</code> then it works fine:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[package]
name = &quot;example&quot;
version = &quot;0.0.1&quot;
authors = [&quot;Virtlink &lt;info@example.com&gt;&quot;]"><pre class="notranslate"><code class="notranslate">[package]
name = "example"
version = "0.0.1"
authors = ["Virtlink &lt;info@example.com&gt;"]
</code></pre></div>
<p dir="auto">I expected there to be no difference between using a local copy of <code class="notranslate">core</code> and using the built-in <code class="notranslate">core</code>.</p>
<p dir="auto">I can't remove <code class="notranslate">extern crate core</code>, due to issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="66024897" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/23982" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/23982/hovercard" href="https://github.com/rust-lang/rust/issues/23982">#23982</a>, and I <a href="http://stackoverflow.com/q/28031806" rel="nofollow">can't use the built-in <code class="notranslate">core</code></a> as I'm using a <em>custom target</em> for my Rust kernel.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="rustc 1.0.0-nightly (c89de2c56 2015-03-28) (built 2015-03-29)
binary: rustc
commit-hash: c89de2c56baeb61e7cc434924dcc8bedd32b26b8
commit-date: 2015-03-28
build-date: 2015-03-29
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly"><pre class="notranslate"><code class="notranslate">rustc 1.0.0-nightly (c89de2c56 2015-03-28) (built 2015-03-29)
binary: rustc
commit-hash: c89de2c56baeb61e7cc434924dcc8bedd32b26b8
commit-date: 2015-03-28
build-date: 2015-03-29
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
</code></pre></div>
<p dir="auto">In <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="10626373" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/4789" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/4789/hovercard" href="https://github.com/rust-lang/rust/issues/4789">#4789</a> discussion was started about redesigning the traits related to numbers and I think the first step is to design and document the traits we think are required and why.</p>
<p dir="auto">We probably also depend on <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="9273827" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/4183" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/4183/hovercard" href="https://github.com/rust-lang/rust/issues/4183">#4183</a> and some other bugs for the actual implementation?</p>
<p dir="auto">(I have an initial sketch/RFC here, based on the work in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="10626373" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/4789" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/4789/hovercard" href="https://github.com/rust-lang/rust/issues/4789">#4789</a> etc. <a href="https://gist.github.com/JensNockert/4719287">https://gist.github.com/JensNockert/4719287</a>)</p>