Reason about nested free variables that appear in a function
signature. In a nutshell, the idea is to (1) report an error if, for a region pointer `'a T`, the lifetime `'a` is longer than any lifetimes that appear in `T` (in other words, if a borrowed pointer outlives any portion of its contents) and then (2) use this to assume that in a function like `fn(self: &'a &'b T)`, the relationship `'a <= 'b` holds. This is needed for #5656. Fixes #5728.
This commit is contained in:
parent
5606fc0c90
commit
3322595e89
27 changed files with 1027 additions and 347 deletions
|
@ -301,7 +301,11 @@ pub fn slice_shift_char<'a>(s: &'a str) -> (char, &'a str) {
|
|||
|
||||
/// Prepend a char to a string
|
||||
pub fn unshift_char(s: &mut ~str, ch: char) {
|
||||
*s = from_char(ch) + *s;
|
||||
// This could be more efficient.
|
||||
let mut new_str = ~"";
|
||||
new_str.push_char(ch);
|
||||
new_str.push_str(*s);
|
||||
*s = new_str;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue