<p dir="auto">I get this error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="src/lib.rs:57:7: 57:10 warning: unused variable: `enc`, #[warn(unused_variables)] on by default
src/lib.rs:57   let enc = EncodingOverride::lookup(&quot;ascii&quot;.as_bytes());
                    ^~~
rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/CodeGen/LexicalScopes.cpp:179: llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(llvm::MDNode*): Assertion `DISubprogram(Scope).describes(MF-&gt;getFunction())' failed.
Could not compile `rust_url_capi`."><pre class="notranslate"><code class="notranslate">src/lib.rs:57:7: 57:10 warning: unused variable: `enc`, #[warn(unused_variables)] on by default
src/lib.rs:57   let enc = EncodingOverride::lookup("ascii".as_bytes());
                    ^~~
rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/CodeGen/LexicalScopes.cpp:179: llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(llvm::MDNode*): Assertion `DISubprogram(Scope).describes(MF-&gt;getFunction())' failed.
Could not compile `rust_url_capi`.
</code></pre></div>
<p dir="auto">It seems to be a compiler bug.<br>
It occurs at this line, since commenting it seems to fix the problem:<br>
<a href="https://github.com/valenting/rust-url-capi/blob/64c0a049bbffdb2676d39e0bc97ba0c5abb66ba6/src/lib.rs#L57">https://github.com/valenting/rust-url-capi/blob/64c0a049bbffdb2676d39e0bc97ba0c5abb66ba6/src/lib.rs#L57</a></p>
<p dir="auto">My guess is that the problem occurs because from rust_url_capi lib.rs:57-&gt; rust-url encoding.rs:44 -&gt; rust-encoding label.rs:13</p>
<h3 dir="auto">STR</h3>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![crate_type = &quot;staticlib&quot;]
#![feature(core)]
#![feature(lang_items)]
#![feature(no_std)]
#![no_std]

extern crate core;

mod lang_items {
    use core::fmt::Arguments;

    #[lang = &quot;stack_exhausted&quot;]
    extern &quot;C&quot; fn stack_exhausted() { }

    #[lang = &quot;eh_personality&quot;]
    extern &quot;C&quot; fn eh_personality() { }

    #[lang = &quot;panic_fmt&quot;]
    fn panic_fmt(_: &amp;Arguments, _: &amp;(&amp;'static str, usize)) -&gt; !  {
        loop  {}
    }
}

pub enum Input {
    Floating,
}

pub mod low {
    use super::Mode;

    pub enum Pin {
        _0,
    }

    pub struct Cr(u32);

    impl Cr {
        pub fn set(&amp;mut self, pin: Pin, mode: Mode) {
            self.0 |= mode.value() &lt;&lt; (4 * pin as u8)
        }
    }
}

pub mod high {
    use super::Mode;

    pub enum Pin {
        _8,
    }

    pub struct Cr(u32);

    impl Cr {
        pub fn set(&amp;mut self, pin: Pin, mode: Mode) {
            self.0 |= mode.value() &lt;&lt; (4 * pin as u8)
        }
    }
}

pub enum Mode { Input(Input) }

impl Mode {
    fn value(&amp;self) -&gt; u32 {
        match *self {
            Mode::Input(Input::Floating) =&gt; 4,
        }
    }
}"><pre class="notranslate"><span class="pl-c1">#!<span class="pl-kos">[</span>crate_type = <span class="pl-s">"staticlib"</span><span class="pl-kos">]</span></span>
<span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>core<span class="pl-kos">)</span><span class="pl-kos">]</span></span>
<span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>lang_items<span class="pl-kos">)</span><span class="pl-kos">]</span></span>
<span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>no_std<span class="pl-kos">)</span><span class="pl-kos">]</span></span>
<span class="pl-c1">#!<span class="pl-kos">[</span>no_std<span class="pl-kos">]</span></span>

<span class="pl-k">extern</span> <span class="pl-k">crate</span> core<span class="pl-kos">;</span>

<span class="pl-k">mod</span> lang_items <span class="pl-kos">{</span>
    <span class="pl-k">use</span> core<span class="pl-kos">::</span>fmt<span class="pl-kos">::</span><span class="pl-v">Arguments</span><span class="pl-kos">;</span>

    <span class="pl-c1">#<span class="pl-kos">[</span>lang = <span class="pl-s">"stack_exhausted"</span><span class="pl-kos">]</span></span>
    <span class="pl-k">extern</span> <span class="pl-s">"C"</span> <span class="pl-k">fn</span> <span class="pl-en">stack_exhausted</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>

    <span class="pl-c1">#<span class="pl-kos">[</span>lang = <span class="pl-s">"eh_personality"</span><span class="pl-kos">]</span></span>
    <span class="pl-k">extern</span> <span class="pl-s">"C"</span> <span class="pl-k">fn</span> <span class="pl-en">eh_personality</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>

    <span class="pl-c1">#<span class="pl-kos">[</span>lang = <span class="pl-s">"panic_fmt"</span><span class="pl-kos">]</span></span>
    <span class="pl-k">fn</span> <span class="pl-en">panic_fmt</span><span class="pl-kos">(</span>_<span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-smi">Arguments</span><span class="pl-kos">,</span> _<span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-c1">'</span><span class="pl-ent">static</span> <span class="pl-smi">str</span><span class="pl-kos">,</span> <span class="pl-smi">usize</span><span class="pl-kos">)</span><span class="pl-kos">)</span> -&gt; !  <span class="pl-kos">{</span>
        <span class="pl-k">loop</span>  <span class="pl-kos">{</span><span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">pub</span> <span class="pl-k">enum</span> <span class="pl-smi">Input</span> <span class="pl-kos">{</span>
    <span class="pl-v">Floating</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span>

<span class="pl-k">pub</span> <span class="pl-k">mod</span> low <span class="pl-kos">{</span>
    <span class="pl-k">use</span> <span class="pl-k">super</span><span class="pl-kos">::</span><span class="pl-v">Mode</span><span class="pl-kos">;</span>

    <span class="pl-k">pub</span> <span class="pl-k">enum</span> <span class="pl-smi">Pin</span> <span class="pl-kos">{</span>
        _0<span class="pl-kos">,</span>
    <span class="pl-kos">}</span>

    <span class="pl-k">pub</span> <span class="pl-k">struct</span> <span class="pl-smi">Cr</span><span class="pl-kos">(</span><span class="pl-smi">u32</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-k">impl</span> <span class="pl-smi">Cr</span> <span class="pl-kos">{</span>
        <span class="pl-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">set</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">self</span><span class="pl-kos">,</span> <span class="pl-s1">pin</span><span class="pl-kos">:</span> <span class="pl-smi">Pin</span><span class="pl-kos">,</span> <span class="pl-s1">mode</span><span class="pl-kos">:</span> <span class="pl-smi">Mode</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
            <span class="pl-smi">self</span><span class="pl-kos">.</span><span class="pl-c1">0</span> |= mode<span class="pl-kos">.</span><span class="pl-en">value</span><span class="pl-kos">(</span><span class="pl-kos">)</span> &lt;&lt; <span class="pl-kos">(</span><span class="pl-c1">4</span> <span class="pl-c1">*</span> pin <span class="pl-k">as</span> <span class="pl-smi">u8</span><span class="pl-kos">)</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">pub</span> <span class="pl-k">mod</span> high <span class="pl-kos">{</span>
    <span class="pl-k">use</span> <span class="pl-k">super</span><span class="pl-kos">::</span><span class="pl-v">Mode</span><span class="pl-kos">;</span>

    <span class="pl-k">pub</span> <span class="pl-k">enum</span> <span class="pl-smi">Pin</span> <span class="pl-kos">{</span>
        _8<span class="pl-kos">,</span>
    <span class="pl-kos">}</span>

    <span class="pl-k">pub</span> <span class="pl-k">struct</span> <span class="pl-smi">Cr</span><span class="pl-kos">(</span><span class="pl-smi">u32</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-k">impl</span> <span class="pl-smi">Cr</span> <span class="pl-kos">{</span>
        <span class="pl-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">set</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">self</span><span class="pl-kos">,</span> <span class="pl-s1">pin</span><span class="pl-kos">:</span> <span class="pl-smi">Pin</span><span class="pl-kos">,</span> <span class="pl-s1">mode</span><span class="pl-kos">:</span> <span class="pl-smi">Mode</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
            <span class="pl-smi">self</span><span class="pl-kos">.</span><span class="pl-c1">0</span> |= mode<span class="pl-kos">.</span><span class="pl-en">value</span><span class="pl-kos">(</span><span class="pl-kos">)</span> &lt;&lt; <span class="pl-kos">(</span><span class="pl-c1">4</span> <span class="pl-c1">*</span> pin <span class="pl-k">as</span> <span class="pl-smi">u8</span><span class="pl-kos">)</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">pub</span> <span class="pl-k">enum</span> <span class="pl-smi">Mode</span> <span class="pl-kos">{</span> <span class="pl-v">Input</span><span class="pl-kos">(</span><span class="pl-smi">Input</span><span class="pl-kos">)</span> <span class="pl-kos">}</span>

<span class="pl-k">impl</span> <span class="pl-smi">Mode</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">value</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-smi">self</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">u32</span> <span class="pl-kos">{</span>
        <span class="pl-k">match</span> <span class="pl-c1">*</span><span class="pl-smi">self</span> <span class="pl-kos">{</span>
            <span class="pl-smi">Mode</span><span class="pl-kos">::</span><span class="pl-v">Input</span><span class="pl-kos">(</span><span class="pl-smi">Input</span><span class="pl-kos">::</span><span class="pl-v">Floating</span><span class="pl-kos">)</span> =&gt; <span class="pl-c1">4</span><span class="pl-kos">,</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Output</h3>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/CodeGen/LexicalScopes.cpp:179: llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(llvm::MDNode*): Assertion `DISubprogram(Scope).describes(MF-&gt;getFunction())' failed."><pre class="notranslate">rustc<span class="pl-kos">:</span> /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/<span class="pl-v">CodeGen</span>/<span class="pl-v">LexicalScopes</span><span class="pl-kos">.</span><span class="pl-c1">cpp</span><span class="pl-kos">:</span><span class="pl-c1">179</span><span class="pl-kos">:</span> llvm<span class="pl-kos">::</span><span class="pl-v">LexicalScope</span><span class="pl-c1">*</span> llvm<span class="pl-kos">::</span><span class="pl-smi">LexicalScopes</span><span class="pl-kos">::</span>getOrCreateRegularScope<span class="pl-kos">(</span>llvm<span class="pl-kos">::</span><span class="pl-v">MDNode</span><span class="pl-c1">*</span><span class="pl-kos">)</span><span class="pl-kos">:</span> <span class="pl-v">Assertion</span> `<span class="pl-v">DISubprogram</span><span class="pl-kos">(</span><span class="pl-v">Scope</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">describes</span><span class="pl-kos">(</span><span class="pl-v">MF</span>-&gt;<span class="pl-en">getFunction</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-c1">'</span> failed<span class="pl-kos">.</span></pre></div>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/michaelwoerister/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/michaelwoerister">@michaelwoerister</a> Same error message as <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="44545253" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/17677" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/17677/hovercard" href="https://github.com/rust-lang/rust/issues/17677">#17677</a>, but I don't know if it's the same bug, this one needs <code class="notranslate">-O</code>.</p>