Skip to content

Commit 374d380

Browse files
committed
---
yaml --- r: 91638 b: refs/heads/auto c: 4059b5c h: refs/heads/master v: v3
1 parent 28f2101 commit 374d380

File tree

84 files changed

+241
-371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+241
-371
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 681ea93d52dd74a5626b9b9d714dd264b0d7ebc7
16+
refs/heads/auto: 4059b5c4b3b8a57a645982b0770d25f0283dfb06
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
*.cps
3131
*.log
3232
*.pdf
33+
*.epub
3334
*.html
3435
*.pg
3536
*.toc

branches/auto/mk/clean.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ clean-misc:
5353
$(Q)rm -Rf tmp/*
5454
$(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz dist
5555
$(Q)rm -Rf $(foreach ext, \
56-
html aux cp fn ky log pdf pg toc tp vr cps, \
56+
html aux cp fn ky log pdf pg toc tp vr cps epub, \
5757
$(wildcard doc/*.$(ext)))
5858
$(Q)find doc/std doc/extra -mindepth 1 | xargs rm -Rf
5959
$(Q)rm -Rf doc/version.md

branches/auto/mk/docs.mk

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,20 @@ doc/rust.tex: rust.md doc/version.md
6464
--from=markdown --to=latex \
6565
--output=$@
6666

67+
DOCS += doc/rust.epub
68+
doc/rust.epub: rust.md doc/version_info.html doc/rust.css doc/manual.inc
69+
@$(call E, pandoc: $@)
70+
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
71+
"$(CFG_PANDOC)" \
72+
--standalone --toc \
73+
--section-divs \
74+
--number-sections \
75+
--from=markdown --to=epub \
76+
--css=rust.css --include-in-header=doc/manual.inc \
77+
--include-before-body=doc/version_info.html \
78+
--output=$@
79+
80+
6781
DOCS += doc/tutorial.tex
6882
doc/tutorial.tex: tutorial.md doc/version.md
6983
@$(call E, pandoc: $@)
@@ -98,6 +112,17 @@ doc/tutorial.html: tutorial.md doc/version_info.html doc/rust.css
98112
--include-before-body=doc/version_info.html \
99113
--output=$@
100114

115+
DOCS += doc/tutorial.epub
116+
doc/tutorial.epub: tutorial.md doc/version_info.html doc/rust.css
117+
@$(call E, pandoc: $@)
118+
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
119+
$(CFG_PANDOC) --standalone --toc \
120+
--section-divs --number-sections \
121+
--from=markdown --to=epub --css=rust.css \
122+
--include-before-body=doc/version_info.html \
123+
--output=$@
124+
125+
101126
DOCS_L10N += doc/l10n/ja/tutorial.html
102127
doc/l10n/ja/tutorial.html: doc/l10n/ja/tutorial.md doc/version_info.html doc/rust.css
103128
@$(call E, pandoc: $@)

branches/auto/src/libextra/getopts.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ pub struct Matches {
142142
}
143143

144144
/// The type returned when the command line does not conform to the
145-
/// expected format. Pass this value to <fail_str> to get an error message.
145+
/// expected format. Call the `to_err_msg` method to retrieve the
146+
/// error as a string.
146147
#[deriving(Clone, Eq, ToStr)]
147148
#[allow(missing_doc)]
148149
pub enum Fail_ {

branches/auto/src/librustuv/addrinfo.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ mod test {
191191
use super::super::local_loop;
192192

193193
#[test]
194+
#[ignore(cfg(target_os="android"))] // cannot give tcp/ip permission without help of apk
194195
fn getaddrinfo_test() {
195196
match GetAddrInfoRequest::run(local_loop(), Some("localhost"), None, None) {
196197
Ok(infos) => {

branches/auto/src/libstd/iter.rs

Lines changed: 80 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ the rest of the rust manuals.
6565
*/
6666

6767
use cmp;
68-
use num::{Zero, One, Integer, CheckedAdd, CheckedSub, Saturating};
68+
use num::{Zero, One, Integer, CheckedAdd, CheckedSub, Saturating, ToPrimitive};
6969
use option::{Option, Some, None};
7070
use ops::{Add, Mul, Sub};
7171
use cmp::{Eq, Ord};
@@ -1829,7 +1829,8 @@ pub fn range<A: Add<A, A> + Ord + Clone + One>(start: A, stop: A) -> Range<A> {
18291829
Range{state: start, stop: stop, one: One::one()}
18301830
}
18311831

1832-
impl<A: Add<A, A> + Ord + Clone> Iterator<A> for Range<A> {
1832+
// FIXME: #10414: Unfortunate type bound
1833+
impl<A: Add<A, A> + Ord + Clone + ToPrimitive> Iterator<A> for Range<A> {
18331834
#[inline]
18341835
fn next(&mut self) -> Option<A> {
18351836
if self.state < self.stop {
@@ -1841,13 +1842,42 @@ impl<A: Add<A, A> + Ord + Clone> Iterator<A> for Range<A> {
18411842
}
18421843
}
18431844

1844-
// FIXME: #8606 Implement size_hint() on Range
1845-
// Blocked on #8605 Need numeric trait for converting to `Option<uint>`
1845+
#[inline]
1846+
fn size_hint(&self) -> (uint, Option<uint>) {
1847+
// This first checks if the elements are representable as i64. If they aren't, try u64 (to
1848+
// handle cases like range(huge, huger)). We don't use uint/int because the difference of
1849+
// the i64/u64 might lie within their range.
1850+
let bound = match self.state.to_i64() {
1851+
Some(a) => {
1852+
let sz = self.stop.to_i64().map(|b| b.checked_sub(&a));
1853+
match sz {
1854+
Some(Some(bound)) => bound.to_uint(),
1855+
_ => None,
1856+
}
1857+
},
1858+
None => match self.state.to_u64() {
1859+
Some(a) => {
1860+
let sz = self.stop.to_u64().map(|b| b.checked_sub(&a));
1861+
match sz {
1862+
Some(Some(bound)) => bound.to_uint(),
1863+
_ => None
1864+
}
1865+
},
1866+
None => None
1867+
}
1868+
};
1869+
1870+
match bound {
1871+
Some(b) => (b, Some(b)),
1872+
// Standard fallback for unbounded/unrepresentable bounds
1873+
None => (0, None)
1874+
}
1875+
}
18461876
}
18471877

18481878
/// `Integer` is required to ensure the range will be the same regardless of
18491879
/// the direction it is consumed.
1850-
impl<A: Integer + Ord + Clone> DoubleEndedIterator<A> for Range<A> {
1880+
impl<A: Integer + Ord + Clone + ToPrimitive> DoubleEndedIterator<A> for Range<A> {
18511881
#[inline]
18521882
fn next_back(&mut self) -> Option<A> {
18531883
if self.stop > self.state {
@@ -1868,11 +1898,12 @@ pub struct RangeInclusive<A> {
18681898

18691899
/// Return an iterator over the range [start, stop]
18701900
#[inline]
1871-
pub fn range_inclusive<A: Add<A, A> + Ord + Clone + One>(start: A, stop: A) -> RangeInclusive<A> {
1901+
pub fn range_inclusive<A: Add<A, A> + Ord + Clone + One + ToPrimitive>(start: A, stop: A)
1902+
-> RangeInclusive<A> {
18721903
RangeInclusive{range: range(start, stop), done: false}
18731904
}
18741905

1875-
impl<A: Add<A, A> + Eq + Ord + Clone> Iterator<A> for RangeInclusive<A> {
1906+
impl<A: Add<A, A> + Eq + Ord + Clone + ToPrimitive> Iterator<A> for RangeInclusive<A> {
18761907
#[inline]
18771908
fn next(&mut self) -> Option<A> {
18781909
match self.range.next() {
@@ -1904,7 +1935,8 @@ impl<A: Add<A, A> + Eq + Ord + Clone> Iterator<A> for RangeInclusive<A> {
19041935
}
19051936
}
19061937

1907-
impl<A: Sub<A, A> + Integer + Ord + Clone> DoubleEndedIterator<A> for RangeInclusive<A> {
1938+
impl<A: Sub<A, A> + Integer + Ord + Clone + ToPrimitive> DoubleEndedIterator<A>
1939+
for RangeInclusive<A> {
19081940
#[inline]
19091941
fn next_back(&mut self) -> Option<A> {
19101942
if self.range.stop > self.range.state {
@@ -2184,6 +2216,7 @@ mod tests {
21842216

21852217
use cmp;
21862218
use uint;
2219+
use num;
21872220

21882221
#[test]
21892222
fn test_counter_from_iter() {
@@ -2801,12 +2834,51 @@ mod tests {
28012834

28022835
#[test]
28032836
fn test_range() {
2837+
/// A mock type to check Range when ToPrimitive returns None
2838+
struct Foo;
2839+
2840+
impl ToPrimitive for Foo {
2841+
fn to_i64(&self) -> Option<i64> { None }
2842+
fn to_u64(&self) -> Option<u64> { None }
2843+
}
2844+
2845+
impl Add<Foo, Foo> for Foo {
2846+
fn add(&self, _: &Foo) -> Foo {
2847+
Foo
2848+
}
2849+
}
2850+
2851+
impl Ord for Foo {
2852+
fn lt(&self, _: &Foo) -> bool {
2853+
false
2854+
}
2855+
}
2856+
2857+
impl Clone for Foo {
2858+
fn clone(&self) -> Foo {
2859+
Foo
2860+
}
2861+
}
2862+
2863+
impl num::One for Foo {
2864+
fn one() -> Foo {
2865+
Foo
2866+
}
2867+
}
2868+
28042869
assert_eq!(range(0i, 5).collect::<~[int]>(), ~[0i, 1, 2, 3, 4]);
2870+
assert_eq!(range(-10i, -1).collect::<~[int]>(), ~[-10, -9, -8, -7, -6, -5, -4, -3, -2]);
28052871
assert_eq!(range(0i, 5).invert().collect::<~[int]>(), ~[4, 3, 2, 1, 0]);
28062872
assert_eq!(range(200, -5).collect::<~[int]>(), ~[]);
28072873
assert_eq!(range(200, -5).invert().collect::<~[int]>(), ~[]);
28082874
assert_eq!(range(200, 200).collect::<~[int]>(), ~[]);
28092875
assert_eq!(range(200, 200).invert().collect::<~[int]>(), ~[]);
2876+
2877+
assert_eq!(range(0i, 100).size_hint(), (100, Some(100)));
2878+
// this test is only meaningful when sizeof uint < sizeof u64
2879+
assert_eq!(range(uint::max_value - 1, uint::max_value).size_hint(), (1, Some(1)));
2880+
assert_eq!(range(-10i, -1).size_hint(), (9, Some(9)));
2881+
assert_eq!(range(Foo, Foo).size_hint(), (0, None));
28102882
}
28112883

28122884
#[test]

branches/auto/src/libstd/libc.rs

Lines changed: 1 addition & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -3387,8 +3387,7 @@ pub mod funcs {
33873387
LPSYSTEM_INFO};
33883388
use libc::types::os::arch::extra::{HANDLE, LPHANDLE};
33893389

3390-
#[cfg(target_arch = "x86")]
3391-
extern "stdcall" {
3390+
extern "system" {
33923391
pub fn GetEnvironmentVariableW(n: LPCWSTR,
33933392
v: LPWSTR,
33943393
nsize: DWORD)
@@ -3494,114 +3493,6 @@ pub mod funcs {
34943493
-> LPVOID;
34953494
pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
34963495
}
3497-
3498-
#[cfg(target_arch = "x86_64")]
3499-
extern {
3500-
pub fn GetEnvironmentVariableW(n: LPCWSTR,
3501-
v: LPWSTR,
3502-
nsize: DWORD)
3503-
-> DWORD;
3504-
pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
3505-
-> BOOL;
3506-
pub fn GetEnvironmentStringsA() -> LPTCH;
3507-
pub fn FreeEnvironmentStringsA(env_ptr: LPTCH) -> BOOL;
3508-
pub fn GetModuleFileNameW(hModule: HMODULE,
3509-
lpFilename: LPWSTR,
3510-
nSize: DWORD)
3511-
-> DWORD;
3512-
pub fn CreateDirectoryW(lpPathName: LPCWSTR,
3513-
lpSecurityAttributes:
3514-
LPSECURITY_ATTRIBUTES)
3515-
-> BOOL;
3516-
pub fn CopyFileW(lpExistingFileName: LPCWSTR,
3517-
lpNewFileName: LPCWSTR,
3518-
bFailIfExists: BOOL)
3519-
-> BOOL;
3520-
pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
3521-
pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
3522-
pub fn GetCurrentDirectoryW(nBufferLength: DWORD,
3523-
lpBuffer: LPWSTR)
3524-
-> DWORD;
3525-
pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
3526-
pub fn GetLastError() -> DWORD;
3527-
pub fn FindFirstFileW(fileName: *u16, findFileData: HANDLE)
3528-
-> HANDLE;
3529-
pub fn FindNextFileW(findFile: HANDLE, findFileData: HANDLE)
3530-
-> BOOL;
3531-
pub fn FindClose(findFile: HANDLE) -> BOOL;
3532-
pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,
3533-
hSourceHandle: HANDLE,
3534-
hTargetProcessHandle: HANDLE,
3535-
lpTargetHandle: LPHANDLE,
3536-
dwDesiredAccess: DWORD,
3537-
bInheritHandle: BOOL,
3538-
dwOptions: DWORD)
3539-
-> BOOL;
3540-
pub fn CloseHandle(hObject: HANDLE) -> BOOL;
3541-
pub fn OpenProcess(dwDesiredAccess: DWORD,
3542-
bInheritHandle: BOOL,
3543-
dwProcessId: DWORD)
3544-
-> HANDLE;
3545-
pub fn GetCurrentProcess() -> HANDLE;
3546-
pub fn CreateProcessA(lpApplicationName: LPCTSTR,
3547-
lpCommandLine: LPTSTR,
3548-
lpProcessAttributes:
3549-
LPSECURITY_ATTRIBUTES,
3550-
lpThreadAttributes:
3551-
LPSECURITY_ATTRIBUTES,
3552-
bInheritHandles: BOOL,
3553-
dwCreationFlags: DWORD,
3554-
lpEnvironment: LPVOID,
3555-
lpCurrentDirectory: LPCTSTR,
3556-
lpStartupInfo: LPSTARTUPINFO,
3557-
lpProcessInformation:
3558-
LPPROCESS_INFORMATION)
3559-
-> BOOL;
3560-
pub fn WaitForSingleObject(hHandle: HANDLE,
3561-
dwMilliseconds: DWORD)
3562-
-> DWORD;
3563-
pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint)
3564-
-> BOOL;
3565-
pub fn GetExitCodeProcess(hProcess: HANDLE,
3566-
lpExitCode: LPDWORD)
3567-
-> BOOL;
3568-
pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
3569-
pub fn VirtualAlloc(lpAddress: LPVOID,
3570-
dwSize: SIZE_T,
3571-
flAllocationType: DWORD,
3572-
flProtect: DWORD)
3573-
-> LPVOID;
3574-
pub fn VirtualFree(lpAddress: LPVOID,
3575-
dwSize: SIZE_T,
3576-
dwFreeType: DWORD)
3577-
-> BOOL;
3578-
pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL;
3579-
pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
3580-
-> BOOL;
3581-
pub fn VirtualProtect(lpAddress: LPVOID,
3582-
dwSize: SIZE_T,
3583-
flNewProtect: DWORD,
3584-
lpflOldProtect: LPDWORD)
3585-
-> BOOL;
3586-
pub fn VirtualQuery(lpAddress: LPCVOID,
3587-
lpBuffer: LPMEMORY_BASIC_INFORMATION,
3588-
dwLength: SIZE_T)
3589-
-> SIZE_T;
3590-
pub fn CreateFileMappingW(hFile: HANDLE,
3591-
lpAttributes: LPSECURITY_ATTRIBUTES,
3592-
flProtect: DWORD,
3593-
dwMaximumSizeHigh: DWORD,
3594-
dwMaximumSizeLow: DWORD,
3595-
lpName: LPCTSTR)
3596-
-> HANDLE;
3597-
pub fn MapViewOfFile(hFileMappingObject: HANDLE,
3598-
dwDesiredAccess: DWORD,
3599-
dwFileOffsetHigh: DWORD,
3600-
dwFileOffsetLow: DWORD,
3601-
dwNumberOfBytesToMap: SIZE_T)
3602-
-> LPVOID;
3603-
pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
3604-
}
36053496
}
36063497

36073498
pub mod msvcrt {

0 commit comments

Comments
 (0)