<p dir="auto">Sorry, the best testcase I have right now is Servo master. If you run the binary under gdb and try to break anywhere in the <code class="notranslate">compositing</code> crate, the symbols just don't exist. You can't break by filename either. You can break on mangled symbols, but there are no source positions. Other crates (like <code class="notranslate">script</code>, for example) work perfectly fine.</p>
<h2 dir="auto">Reproduce Steps</h2>
<ol dir="auto">
<li>Create a project using <code class="notranslate">cargo new test_rust</code></li>
<li>Edit the <code class="notranslate">lib.rs</code> file to:</li>
</ol>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pub trait HasArea {                                                             
    fn area(&amp;self) -&gt; f64 {                                                     
        0f64                                                                    
    }                                                                           
}  
pub fn print_area&lt;T: HasArea&gt;(shape: T) -&gt; f64{                                 
    shape.area()                                                                
} 
fn main() {
    struct Square {                                                             
        side: f64,                                                              
    }                                                                                  
    impl HasArea for Square {                                                   
         fn area(&amp;self) -&gt; f64 {                                                 
            self.side * self.side                                               
         }                                                                       
    }                                                                                

    let s = Square {                                                            
        side: 20f64,                                                            
    };                                                                          

    let b = print_area(s);                                                          
    println!(&quot;Area: {}&quot;, b);                                                    
}  "><pre class="notranslate"><span class="pl-k">pub</span> <span class="pl-k">trait</span> <span class="pl-smi">HasArea</span> <span class="pl-kos">{</span>                                                             
    <span class="pl-k">fn</span> <span class="pl-en">area</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">f64</span> <span class="pl-kos">{</span>                                                     
        <span class="pl-c1">0f64</span>                                                                    
    <span class="pl-kos">}</span>                                                                           
<span class="pl-kos">}</span>  
<span class="pl-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">print_area</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">:</span> <span class="pl-smi">HasArea</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">shape</span><span class="pl-kos">:</span> <span class="pl-smi">T</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">f64</span><span class="pl-kos">{</span>                                 
    shape<span class="pl-kos">.</span><span class="pl-en">area</span><span class="pl-kos">(</span><span class="pl-kos">)</span>                                                                
<span class="pl-kos">}</span> 
<span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">struct</span> <span class="pl-smi">Square</span> <span class="pl-kos">{</span>                                                             
        <span class="pl-c1">side</span><span class="pl-kos">:</span> <span class="pl-smi">f64</span><span class="pl-kos">,</span>                                                              
    <span class="pl-kos">}</span>                                                                                  
    <span class="pl-k">impl</span> <span class="pl-smi">HasArea</span> <span class="pl-k">for</span> <span class="pl-smi">Square</span> <span class="pl-kos">{</span>                                                   
         <span class="pl-k">fn</span> <span class="pl-en">area</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">f64</span> <span class="pl-kos">{</span>                                                 
            <span class="pl-smi">self</span><span class="pl-kos">.</span><span class="pl-c1">side</span> <span class="pl-c1">*</span> <span class="pl-smi">self</span><span class="pl-kos">.</span><span class="pl-c1">side</span>                                               
         <span class="pl-kos">}</span>                                                                       
    <span class="pl-kos">}</span>                                                                                

    <span class="pl-k">let</span> s = <span class="pl-smi">Square</span> <span class="pl-kos">{</span>                                                            
        <span class="pl-c1">side</span><span class="pl-kos">:</span> <span class="pl-c1">20f64</span><span class="pl-kos">,</span>                                                            
    <span class="pl-kos">}</span><span class="pl-kos">;</span>                                                                          

    <span class="pl-k">let</span> b = <span class="pl-en">print_area</span><span class="pl-kos">(</span>s<span class="pl-kos">)</span><span class="pl-kos">;</span>                                                          
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"Area: {}"</span>, b<span class="pl-kos">)</span><span class="pl-kos">;</span>                                                    
<span class="pl-kos">}</span>  </pre></div>
<p dir="auto">Basically, it defines a trait and a generic method which accepts it as an argument.<br>
3. Run <code class="notranslate">rustc -g src/lib.rs</code> to compile it and run <code class="notranslate">gdb lib</code> to debug. It could step into the <code class="notranslate">print_area()</code> function and the result is correct as well.<br>
4. If I move the <code class="notranslate">main()</code> function into a standalone file <code class="notranslate">main.rs</code> and referece this library using <code class="notranslate">external crate test_rust</code>, call <code class="notranslate">cargo build</code> to build the library(I already set the debug flag in <code class="notranslate">Cargo.toml</code>) and run <code class="notranslate">rustc -g -extern test_rust=target/libXXXX main.rs</code>. I could not debug into the <code class="notranslate">print_area()</code> function, though the running result is correct. In gdb, it just goes to next line instead of going to the function definition.</p>
<p dir="auto">Please note if I don't use generic for the function, both cases are working as expected.</p>
<h2 dir="auto">OS</h2>
<p dir="auto">Archlinux x86_64</p>
<h2 dir="auto">Rust version</h2>
<p dir="auto">rustc 0.13.0-nightly (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/81eeec0941f936f0f3de881c3991a74f32fe0625/hovercard" href="https://github.com/rust-lang/rust/commit/81eeec0941f936f0f3de881c3991a74f32fe0625"><tt>81eeec0</tt></a> 2014-11-21 23:16:48 +0000)<br>
binary: rustc<br>
commit-hash: <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/81eeec0941f936f0f3de881c3991a74f32fe0625/hovercard" href="https://github.com/rust-lang/rust/commit/81eeec0941f936f0f3de881c3991a74f32fe0625"><tt>81eeec0</tt></a><br>
commit-date: 2014-11-21 23:16:48 +0000<br>
host: x86_64-unknown-linux-gnu<br>
release: 0.13.0-nightly</p>