<p dir="auto">The current orphan rules in the coherence check are stricter than they need to be.  For example, if I have</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="struct Foo"><pre class="notranslate"><code class="notranslate">struct Foo
</code></pre></div>
<p dir="auto">then I cannot have an impl like the following</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="impl ToStr for @Foo"><pre class="notranslate"><code class="notranslate">impl ToStr for @Foo
</code></pre></div>
<p dir="auto">The goal of the orphan rules is to guarantee that we can detect duplicate trait implementations so as to enforce coherence. To this end, it is only necessary to ensure that we could find any potentially conflicting impl. If we enforce the rule that the "for" type must "involve" some nominal type from the current crate, that is adequate for this purpose.  For example <code class="notranslate">@Foo</code> should be ok but also <code class="notranslate">Option&lt;Foo&gt;</code>.</p>
<p dir="auto">"is_whitespace" and "maybe_digit" should be implemented using the libicu binding in module "std::unicode::icu".<br>
libicu is battle tested, we should not replicate their effort.</p>
<p dir="auto">See <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2635253" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/1370" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/1370/hovercard" href="https://github.com/rust-lang/rust/issues/1370">#1370</a></p>