You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New to rust, I can't debug it, but I tried the following changes to main without figuring it out:
fn main() {
let args: ~[~str] = core::os::args();
assert!(args.len()>1);
/* This works */
io::println( args[1] );
/* This works too */
io::println( sha1( ~"xyz" ) );
/* This gives a compile error:
"moving out of immutable vec content" */
io::println( sha1( args[1] ) );
}
This is because it passes by-value, which will move values with destructors. It has to be passed as a slice or copied because os::args is immutable. I rewrote the FFI tutorial but it hasn't been regenerated by the documentation bot yet. Until then you can use https://github.com/mozilla/rust/blob/incoming/doc/tutorial-ffi.md
Don't lint if it has always inline attribute
Don't trigger the lint `trivially_copy_pass_by_ref` if it has `#[inline(always)]` attribute.
Note: I am not particularly familiar with `inline` impacts, so I implemented this the way that if only `#[inline]` attribute is here (without `always`), the lint will still trigger. Also, it will still trigger if it has `#[inline(never)]`.
Just tell me if it sounds too much conservative.
Fixes: rust-lang#5876
changelog: none
New to rust, I can't debug it, but I tried the following changes to main without figuring it out:
My rust compiled from git commit 5f13e9c
The text was updated successfully, but these errors were encountered: