-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error compiling problem case #4 from nll-rfc #46361
Comments
You need to pass Output with -Z borrowck=compare -Znll
|
You can now use |
With some small tweaks (unrelated to NLL), the example compiles now. #![feature(nll)]
struct List<T> {
value: T,
next: Option<Box<List<T>>>,
}
fn to_refs<T>(mut list: &mut List<T>) -> Vec<&mut T> {
let mut result = vec![];
loop {
result.push(&mut list.value);
if let Some(n) = list.next.as_mut() {
list = n;
} else {
return result;
}
}
}
fn main() {
println!("Hello World!");
} |
We don't have a test specifically targeting this case, I don't think. It'd be good to make one. It should go in this directory: https://github.com/rust-lang/rust/tree/master/src/test/run-pass/nll |
Mentoring instructionsAdd a modified version of the example from this example into |
I'll add the test. |
…nikomatsakis NLL test for mutating &mut references As mentioned in rust-lang#46361. cc @nikomatsakis?
…nikomatsakis NLL test for mutating &mut references As mentioned in rust-lang#46361. cc @nikomatsakis?
Closed by #47609 |
keywords: copy-vs-move, copy vs move, orphaned borrow, overwriting reference |
UPDATE: This example works now, but needs someone to add a test. See mentoring instructions below.
I'm trying to compile some examples using nonlexical lifetimes. To do so, I'm compiling rustc using the
master
branch, and the-Z nll
compiler option.By compiling "Problem case 4: mutating &mut references" from nll-rfc, I get some errors.
Program
Output of `rustc -g -Zverbose -Znll nll-problem-case-4.rs`:
My questions are:
rustc
with./configure --enable-debug --enable-debuginfo
, but I still don't see thedebug!("mir_borrowck done");
message from the compiler.The text was updated successfully, but these errors were encountered: