Skip to content

Commit e43c6b9

Browse files
committed
---
yaml --- r: 105406 b: refs/heads/master c: eb68bee h: refs/heads/master v: v3
1 parent 4552796 commit e43c6b9

File tree

7 files changed

+104
-22
lines changed

7 files changed

+104
-22
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: 5026d114a0bbe27f2052af9fbadebacac80e1955
2+
refs/heads/master: eb68beec4b809c1e091ce678a2c18347701497c2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b8601a3d8b91ad3b653d143307611f2f5c75617e
55
refs/heads/try: db814977d07bd798feb24f6b74c00800ef458a13

trunk/src/libgetopts/lib.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,27 +98,34 @@ use std::vec;
9898

9999
/// Name of an option. Either a string or a single char.
100100
#[deriving(Clone, Eq)]
101-
#[allow(missing_doc)]
102101
pub enum Name {
102+
/// A string representing the long name of an option.
103+
/// For example: "help"
103104
Long(~str),
105+
/// A char representing the short name of an option.
106+
/// For example: 'h'
104107
Short(char),
105108
}
106109

107110
/// Describes whether an option has an argument.
108111
#[deriving(Clone, Eq)]
109-
#[allow(missing_doc)]
110112
pub enum HasArg {
113+
/// The option requires an argument.
111114
Yes,
115+
/// The option is just a flag, therefore no argument.
112116
No,
117+
/// The option argument is optional and it could or not exist.
113118
Maybe,
114119
}
115120

116121
/// Describes how often an option may occur.
117122
#[deriving(Clone, Eq)]
118-
#[allow(missing_doc)]
119123
pub enum Occur {
124+
/// The option occurs once.
120125
Req,
126+
/// The option could or not occur.
121127
Optional,
128+
/// The option occurs once or multiple times.
122129
Multi,
123130
}
124131

@@ -176,12 +183,16 @@ pub struct Matches {
176183
/// expected format. Call the `to_err_msg` method to retrieve the
177184
/// error as a string.
178185
#[deriving(Clone, Eq, Show)]
179-
#[allow(missing_doc)]
180186
pub enum Fail_ {
187+
/// The option requires an argument but none was passed.
181188
ArgumentMissing(~str),
189+
/// The passed option is not declared among the possible options.
182190
UnrecognizedOption(~str),
191+
/// A required option is not present.
183192
OptionMissing(~str),
193+
/// A single occurence option is being used multiple times.
184194
OptionDuplicated(~str),
195+
/// There's an argument being passed to a non-argument option.
185196
UnexpectedArgument(~str),
186197
}
187198

trunk/src/librustc/middle/typeck/check/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,11 +2317,13 @@ fn check_expr_with_unifier(fcx: @FnCtxt,
23172317
fcx.type_error_message(
23182318
expr.span,
23192319
|actual| {
2320-
format!("attempted to take value of method `{}` on type `{}` \
2321-
(try writing an anonymous function)",
2320+
format!("attempted to take value of method `{}` on type `{}`",
23222321
token::get_name(field), actual)
23232322
},
23242323
expr_t, None);
2324+
2325+
tcx.sess.span_note(expr.span,
2326+
"maybe a missing `()` to call it? If not, try an anonymous function.");
23252327
}
23262328

23272329
None => {

trunk/src/libstd/option.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,10 @@ impl<T> Option<T> {
311311
/// Fails if the value equals `None`.
312312
#[inline]
313313
pub fn take_unwrap(&mut self) -> T {
314-
if self.is_none() {
315-
fail!("called `Option::take_unwrap()` on a `None` value")
314+
match self.take() {
315+
Some(x) => x,
316+
None => fail!("called `Option::take_unwrap()` on a `None` value")
316317
}
317-
self.take().unwrap()
318318
}
319319

320320
/// Gets an immutable reference to the value inside an option.

trunk/src/libtime/lib.rs

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,51 @@ pub fn tzset() {
187187
}
188188
}
189189

190+
/// Holds a calendar date and time broken down into its components (year, month, day, and so on),
191+
/// also called a broken-down time value.
190192
#[deriving(Clone, Eq, Encodable, Decodable, Show)]
191193
pub struct Tm {
192-
tm_sec: i32, // seconds after the minute ~[0-60]
193-
tm_min: i32, // minutes after the hour ~[0-59]
194-
tm_hour: i32, // hours after midnight ~[0-23]
195-
tm_mday: i32, // days of the month ~[1-31]
196-
tm_mon: i32, // months since January ~[0-11]
197-
tm_year: i32, // years since 1900
198-
tm_wday: i32, // days since Sunday ~[0-6]
199-
tm_yday: i32, // days since January 1 ~[0-365]
200-
tm_isdst: i32, // Daylight Savings Time flag
201-
tm_gmtoff: i32, // offset from UTC in seconds
202-
tm_zone: ~str, // timezone abbreviation
203-
tm_nsec: i32, // nanoseconds
194+
/// Seconds after the minute – [0, 60]
195+
tm_sec: i32,
196+
197+
/// Minutes after the hour – [0, 59]
198+
tm_min: i32,
199+
200+
/// Hours after midnight – [0, 23]
201+
tm_hour: i32,
202+
203+
/// Day of the month – [1, 31]
204+
tm_mday: i32,
205+
206+
/// Months since January – [0, 11]
207+
tm_mon: i32,
208+
209+
/// Years since 1900
210+
tm_year: i32,
211+
212+
/// Days since Sunday – [0, 6]. 0 = Sunday, 1 = Monday, …, 6 = Saturday.
213+
tm_wday: i32,
214+
215+
/// Days since January 1 – [0, 365]
216+
tm_yday: i32,
217+
218+
/// Daylight Saving Time flag.
219+
///
220+
/// This value is positive if Daylight Saving Time is in effect, zero if Daylight Saving Time
221+
/// is not in effect, and negative if this information is not available.
222+
tm_isdst: i32,
223+
224+
/// Identifies the time zone that was used to compute this broken-down time value, including any
225+
/// adjustment for Daylight Saving Time. This is the number of seconds east of UTC. For example,
226+
/// for U.S. Pacific Daylight Time, the value is -7*60*60 = -25200.
227+
tm_gmtoff: i32,
228+
229+
/// Abbreviated name for the time zone that was used to compute this broken-down time value.
230+
/// For example, U.S. Pacific Daylight Time is "PDT".
231+
tm_zone: ~str,
232+
233+
/// Nanoseconds after the second – [0, 10<sup>9</sup> - 1]
234+
tm_nsec: i32,
204235
}
205236

206237
pub fn empty_tm() -> Tm {
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Tests to make sure that parens are needed for method calls without arguments.
12+
// outputs text to make sure either an anonymous function is provided or
13+
// open-close '()' parens are given
14+
15+
16+
struct Point {
17+
x: int,
18+
y: int
19+
}
20+
impl Point {
21+
fn new() -> Point {
22+
Point{x:0, y:0}
23+
}
24+
fn get_x(&self) -> int {
25+
self.x
26+
}
27+
}
28+
29+
fn main() {
30+
let point: Point = Point::new();
31+
let px: int = point.get_x;//~ ERROR attempted to take value of method `get_x` on type `Point`
32+
//~^ NOTE maybe a missing `()` to call it? If not, try an anonymous function.
33+
}
34+

trunk/src/test/run-pass/tcp-stress.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
// ignore-android needs extra network permissions
1414
// exec-env:RUST_LOG=debug
1515

16+
#[feature(phase)];
17+
#[phase(syntax, link)]
18+
extern crate log;
19+
1620
use std::libc;
1721
use std::io::net::ip::{Ipv4Addr, SocketAddr};
1822
use std::io::net::tcp::{TcpListener, TcpStream};

0 commit comments

Comments
 (0)