Skip to content

Commit a0f0a70

Browse files
committed
core: Clean up comments and exports
1 parent 93a0821 commit a0f0a70

File tree

6 files changed

+135
-38
lines changed

6 files changed

+135
-38
lines changed

src/libcore/libc.rs

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
//
2-
// We consider the following specs reasonably normative with respect
3-
// to interoperating with the C standard library (libc/msvcrt):
4-
//
5-
// - ISO 9899:1990 ('C95', 'ANSI C', 'Standard C'), NA1, 1995.
6-
// - ISO 9899:1999 ('C99' or 'C9x').
7-
// - ISO 9945:1988 / IEEE 1003.1-1988 ('POSIX.1').
8-
// - ISO 9945:2001 / IEEE 1003.1-2001 ('POSIX:2001', 'SUSv3').
9-
// - ISO 9945:2008 / IEEE 1003.1-2008 ('POSIX:2008', 'SUSv4').
10-
//
11-
// Despite having several names each, these are *reasonably* coherent
12-
// point-in-time, list-of-definition sorts of specs. You can get each under a
13-
// variety of names but will wind up with the same definition in each case.
14-
//
15-
// Our interface to these libraries is complicated by the non-universality of
16-
// conformance to any of them. About the only thing universally supported is
17-
// the first (C95), beyond that definitions quickly become absent on various
18-
// platforms.
19-
//
20-
// We therefore wind up dividing our module-space up (mostly for the sake of
21-
// sanity while editing, filling-in-details and eliminating duplication) into
22-
// definitions common-to-all (held in modules named c95, c99, posix88, posix01
23-
// and posix08) and definitions that appear only on *some* platforms (named
24-
// 'extra'). This would be things like significant OSX foundation kit, or
25-
// win32 library kernel32.dll, or various fancy glibc, linux or BSD
26-
// extensions.
27-
//
28-
// In addition to the per-platform 'extra' modules, we define a module of
29-
// "common BSD" libc routines that never quite made it into POSIX but show up
30-
// in multiple derived systems. This is the 4.4BSD r2 / 1995 release, the
31-
// final one from Berkeley after the lawsuits died down and the CSRG
32-
// dissolved.
33-
//
1+
#[doc = "
2+
Bindings for libc.
3+
4+
We consider the following specs reasonably normative with respect
5+
to interoperating with the C standard library (libc/msvcrt):
6+
7+
* ISO 9899:1990 ('C95', 'ANSI C', 'Standard C'), NA1, 1995.
8+
* ISO 9899:1999 ('C99' or 'C9x').
9+
* ISO 9945:1988 / IEEE 1003.1-1988 ('POSIX.1').
10+
* ISO 9945:2001 / IEEE 1003.1-2001 ('POSIX:2001', 'SUSv3').
11+
* ISO 9945:2008 / IEEE 1003.1-2008 ('POSIX:2008', 'SUSv4').
12+
13+
Despite having several names each, these are *reasonably* coherent
14+
point-in-time, list-of-definition sorts of specs. You can get each under a
15+
variety of names but will wind up with the same definition in each case.
16+
17+
Our interface to these libraries is complicated by the non-universality of
18+
conformance to any of them. About the only thing universally supported is
19+
the first (C95), beyond that definitions quickly become absent on various
20+
platforms.
21+
22+
We therefore wind up dividing our module-space up (mostly for the sake of
23+
sanity while editing, filling-in-details and eliminating duplication) into
24+
definitions common-to-all (held in modules named c95, c99, posix88, posix01
25+
and posix08) and definitions that appear only on *some* platforms (named
26+
'extra'). This would be things like significant OSX foundation kit, or
27+
win32 library kernel32.dll, or various fancy glibc, linux or BSD
28+
extensions.
29+
30+
In addition to the per-platform 'extra' modules, we define a module of
31+
'common BSD' libc routines that never quite made it into POSIX but show up
32+
in multiple derived systems. This is the 4.4BSD r2 / 1995 release, the
33+
final one from Berkeley after the lawsuits died down and the CSRG
34+
dissolved.
35+
"];
3436

3537
// Initial glob-exports mean that all the contents of all the modules
3638
// wind up exported, if you're interested in writing platform-specific code.

src/libcore/ptr.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
#[doc = "Unsafe pointer utility functions"]
1+
#[doc = "Unsafe pointer utility functions"];
2+
3+
export addr_of;
4+
export mut_addr_of;
5+
export offset;
6+
export mut_offset;
7+
export null;
8+
export memcpy;
9+
export memmove;
10+
211

312
#[abi = "rust-intrinsic"]
413
native mod rusti {

src/libcore/sys.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
#[doc = "Misc low level stuff"]
1+
#[doc = "Misc low level stuff"];
2+
3+
export type_desc;
4+
export get_type_desc;
5+
export last_os_error;
6+
export size_of;
7+
export align_of;
8+
export refcount;
9+
export log_str;
10+
export set_exit_status;
211

312
enum type_desc = {
413
first_param: **ctypes::c_int,

src/libcore/vec.rs

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,77 @@ import option::{some, none};
22
import uint::next_power_of_two;
33
import ptr::addr_of;
44

5+
export init_op;
6+
export is_empty;
7+
export is_not_empty;
8+
export same_length;
9+
export reserve;
10+
export len;
11+
export init_fn;
12+
export init_elt;
13+
export to_mut;
14+
export from_mut;
15+
export head;
16+
export tail;
17+
export tail_n;
18+
export init;
19+
export last;
20+
export last_opt;
21+
export slice;
22+
export split;
23+
export splitn;
24+
export rsplit;
25+
export rsplitn;
26+
export shift;
27+
export pop;
28+
export push;
29+
export grow;
30+
export grow_fn;
31+
export grow_set;
32+
export map;
33+
export map2;
34+
export filter_map;
35+
export filter;
36+
export concat;
37+
export connect;
38+
export foldl;
39+
export foldr;
40+
export any;
41+
export any2;
42+
export all;
43+
export all2;
44+
export contains;
45+
export count;
46+
export find;
47+
export find_from;
48+
export rfind;
49+
export rfind_from;
50+
export position_elt;
51+
export position;
52+
export position_from;
53+
export position_elt;
54+
export rposition;
55+
export rposition_from;
56+
export unzip;
57+
export zip;
58+
export swap;
59+
export reverse;
60+
export reversed;
61+
export enum_chars;
62+
export enum_uints;
63+
export iter;
64+
export iter2;
65+
export iteri;
66+
export riter;
67+
export riteri;
68+
export permute;
69+
export windowed;
70+
export as_buf;
71+
export as_mut_buf;
72+
export vec_len;
73+
export unsafe;
74+
export u8;
75+
576
#[abi = "rust-intrinsic"]
677
native mod rusti {
778
fn vec_len<T>(&&v: [const T]) -> ctypes::size_t;
@@ -808,6 +879,7 @@ impl vec_len<T> for [T] {
808879
}
809880

810881
mod unsafe {
882+
// FIXME: This should have crate visibility
811883
type vec_repr = {mutable fill: uint, mutable alloc: uint, data: u8};
812884

813885
#[doc = "

src/test/auxiliary/native_lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
native mod rustrt {
2+
fn last_os_error() -> str;
3+
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
use std;
2-
import sys;
1+
// xfail-fast
2+
// aux-build:native_lib.rs
33

44
// The purpose of this test is to check that we can
55
// successfully (and safely) invoke external, cdecl
66
// functions from outside the crate.
77

8+
use native_lib;
9+
810
fn main() {
9-
let foo = sys::rustrt::last_os_error();
11+
let foo = native_lib::rustrt::last_os_error();
1012
}

0 commit comments

Comments
 (0)