auto merge of #11405 : huonw/rust/moredocs, r=huonw

Various documentation changes, change the 'borrowed pointer' terminology to 'reference', fix a problem with 'make dist' on windows.
This commit is contained in:
bors 2014-01-08 07:26:41 -08:00
commit 464d1d044e
54 changed files with 337 additions and 286 deletions

View file

@ -1,7 +1,7 @@
#[feature(managed_boxes)];
fn f<T>(x: T) -> @T {
@x //~ ERROR value may contain borrowed pointers
@x //~ ERROR value may contain references
}
fn g<T:'static>(x: T) -> @T {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Testing that we can't store a borrowed pointer it task-local storage
// Testing that we can't store a reference it task-local storage
use std::local_data;

View file

@ -23,8 +23,8 @@ impl<T:Clone> foo for T {
}
fn to_foo<T:Clone>(t: T) {
// This version is ok because, although T may contain borrowed
// pointers, it never escapes the fn body. We know this because
// This version is ok because, although T may contain references
// it never escapes the fn body. We know this because
// the type of foo includes a region which will be resolved to
// the fn body itself.
let v = &3;
@ -34,15 +34,15 @@ fn to_foo<T:Clone>(t: T) {
}
fn to_foo_2<T:Clone>(t: T) -> @foo {
// Not OK---T may contain borrowed ptrs and it is going to escape
// Not OK---T may contain references and it is going to escape
// as part of the returned foo value
struct F<T> { f: T }
@F {f:t} as @foo //~ ERROR value may contain borrowed pointers; add `'static` bound
@F {f:t} as @foo //~ ERROR value may contain references; add `'static` bound
}
fn to_foo_3<T:Clone + 'static>(t: T) -> @foo {
// OK---T may escape as part of the returned foo value, but it is
// owned and hence does not contain borrowed ptrs
// owned and hence does not contain references
struct F<T> { f: T }
@F {f:t} as @foo
}

View file

@ -14,9 +14,9 @@ trait foo { fn foo(&self); }
fn to_foo<T:Clone + foo>(t: T) -> @foo {
@t as @foo
//~^ ERROR value may contain borrowed pointers; add `'static` bound
//~^ ERROR value may contain references; add `'static` bound
//~^^ ERROR cannot pack type
//~^^^ ERROR value may contain borrowed pointers
//~^^^ ERROR value may contain references
}
fn to_foo2<T:Clone + foo + 'static>(t: T) -> @foo {

View file

@ -10,7 +10,7 @@
// xfail-test #5723
// Test that you cannot escape a borrowed pointer
// Test that you cannot escape a reference
// into a trait.
struct ctxt { v: uint }
@ -29,7 +29,7 @@ fn make_gc() -> @get_ctxt {
let ctxt = ctxt { v: 22u };
let hc = has_ctxt { c: &ctxt };
return @hc as @get_ctxt;
//^~ ERROR source contains borrowed pointer
//^~ ERROR source contains reference
}
fn main() {

View file

@ -175,10 +175,10 @@ fn main() {
// managed box
let @aa = @(34, 35);
// borrowed pointer
// reference
let &bb = &(36, 37);
// contained borrowed pointer
// contained reference
let (&cc, _) = (&38, 39);
// unique pointer

View file

@ -51,7 +51,7 @@ struct AsciiArt {
priv lines: ~[~[char]],
// This struct can be quite large so we'll disable copying: developers need
// to either pass these structs around via borrowed pointers or move them.
// to either pass these structs around via references or move them.
}
impl Drop for AsciiArt {

View file

@ -9,12 +9,12 @@
// except according to those terms.
/*
# ICE when returning struct with borrowed pointer to trait
# ICE when returning struct with reference to trait
A function which takes a borrowed pointer to a trait and returns a
struct with that borrowed pointer results in an ICE.
A function which takes a reference to a trait and returns a
struct with that reference results in an ICE.
This does not occur with concrete types, only with borrowed pointers
This does not occur with concrete types, only with references
to traits.
*/