Skip to content

Commit 2591dbd

Browse files
committed
---
yaml --- r: 271659 b: refs/heads/master c: 157ba00 h: refs/heads/master i: 271657: ce014f9 271655: 7239514
1 parent 6d1c44f commit 2591dbd

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: a18e12494f2c6e219a7107b3a827c55dc360aa8b
2+
refs/heads/master: 157ba0038dea24f06d594b6e1190fcd0eb431018
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
44
refs/heads/try: 49312a405e14a449b98fe0056b12a40ac128be4a
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/src/librustc/ty/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
12021202
}
12031203
}
12041204

1205+
/// Construct a parameter environment given an item, impl item, or trait item
12051206
pub fn for_item(cx: &'a TyCtxt<'tcx>, id: NodeId) -> ParameterEnvironment<'a, 'tcx> {
12061207
match cx.map.find(id) {
12071208
Some(ast_map::NodeImplItem(ref impl_item)) => {

trunk/src/libstd/sys/windows/net.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,27 @@ fn last_error() -> io::Error {
6161
}
6262

6363
/// Checks if the signed integer is the Windows constant `SOCKET_ERROR` (-1)
64-
/// and if so, returns the last error from the Windows socket interface. This
64+
/// and if so, returns the last error from the Windows socket interface. . This
6565
/// function must be called before another call to the socket API is made.
66-
pub fn cvt<T: One + PartialEq + Neg<Output=T>>(t: T) -> io::Result<T> {
67-
if t == -T::one() {
66+
pub fn cvt<T: One + Neg<Output=T> + PartialEq>(t: T) -> io::Result<T> {
67+
let one: T = T::one();
68+
if t == -one {
6869
Err(last_error())
6970
} else {
7071
Ok(t)
7172
}
7273
}
7374

74-
/// A variant of `cvt` for `getaddrinfo` which return 0 for a success.
75+
/// Provides the functionality of `cvt` for the return values of `getaddrinfo`
76+
/// and similar, meaning that they return an error if the return value is 0.
7577
pub fn cvt_gai(err: c_int) -> io::Result<()> {
76-
if err == 0 {
77-
Ok(())
78-
} else {
79-
Err(last_error())
80-
}
78+
if err == 0 { return Ok(()) }
79+
cvt(err).map(|_| ())
8180
}
8281

83-
/// Just to provide the same interface as sys/unix/net.rs
82+
/// Provides the functionality of `cvt` for a closure.
8483
pub fn cvt_r<T, F>(mut f: F) -> io::Result<T>
85-
where T: One + PartialEq + Neg<Output=T>, F: FnMut() -> T
84+
where F: FnMut() -> T, T: One + Neg<Output=T> + PartialEq
8685
{
8786
cvt(f())
8887
}

0 commit comments

Comments
 (0)