Skip to content

Commit eb05403

Browse files
committed
---
yaml --- r: 138397 b: refs/heads/master c: 04386f4 h: refs/heads/master i: 138395: 432239b v: v3
1 parent b9f76c6 commit eb05403

File tree

5 files changed

+25
-33
lines changed

5 files changed

+25
-33
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: 2130f2221600f03129df95f3611444468806b237
2+
refs/heads/master: 04386f4217275f3a745820af476d8af2a2b4a492
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5

trunk/src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ impl<T> Option<T> {
245245
/// ```
246246
/// let mut x = Some(2u);
247247
/// match x.as_mut() {
248-
/// Some(v) => *v = 42,
248+
/// Some(&ref mut v) => *v = 42,
249249
/// None => {},
250250
/// }
251251
/// assert_eq!(x, Some(42u));

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@ pub fn lookup_in_trait<'a, 'tcx>(
174174
m_name: ast::Name, // The name `b`.
175175
trait_did: DefId, // The trait to limit the lookup to.
176176
self_ty: ty::t, // The type of `a`.
177-
supplied_tps: &'a [ty::t], // The list of types X, Y, ... .
178-
autoderef_receiver: AutoderefReceiverFlag,
179-
report_statics: StaticMethodsFlag)
177+
supplied_tps: &'a [ty::t]) // The list of types X, Y, ... .
180178
-> Option<MethodCallee> {
181179
let mut lcx = LookupContext {
182180
fcx: fcx,
@@ -189,8 +187,8 @@ pub fn lookup_in_trait<'a, 'tcx>(
189187
extension_candidates: Vec::new(),
190188
deref_args: check::DoDerefArgs,
191189
check_traits: CheckTraitsOnly,
192-
autoderef_receiver: autoderef_receiver,
193-
report_statics: report_statics,
190+
autoderef_receiver: DontAutoderefReceiver,
191+
report_statics: IgnoreStaticMethods,
194192
};
195193

196194
debug!("method lookup_in_trait(self_ty={}, self_expr={})",

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

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,9 +2117,7 @@ fn try_overloaded_call<'a>(fcx: &FnCtxt,
21172117
method_name,
21182118
function_trait,
21192119
callee_type,
2120-
[],
2121-
DontAutoderefReceiver,
2122-
IgnoreStaticMethods) {
2120+
[]) {
21232121
None => continue,
21242122
Some(method_callee) => method_callee,
21252123
};
@@ -2160,7 +2158,7 @@ fn try_overloaded_deref(fcx: &FnCtxt,
21602158
(PreferMutLvalue, Some(trait_did)) => {
21612159
method::lookup_in_trait(fcx, span, base_expr.map(|x| &*x),
21622160
token::intern("deref_mut"), trait_did,
2163-
base_ty, [], DontAutoderefReceiver, IgnoreStaticMethods)
2161+
base_ty, [])
21642162
}
21652163
_ => None
21662164
};
@@ -2170,7 +2168,7 @@ fn try_overloaded_deref(fcx: &FnCtxt,
21702168
(None, Some(trait_did)) => {
21712169
method::lookup_in_trait(fcx, span, base_expr.map(|x| &*x),
21722170
token::intern("deref"), trait_did,
2173-
base_ty, [], DontAutoderefReceiver, IgnoreStaticMethods)
2171+
base_ty, [])
21742172
}
21752173
(method, _) => method
21762174
};
@@ -2231,9 +2229,7 @@ fn try_overloaded_slice(fcx: &FnCtxt,
22312229
token::intern(method_name),
22322230
trait_did,
22332231
base_ty,
2234-
[],
2235-
DontAutoderefReceiver,
2236-
IgnoreStaticMethods)
2232+
[])
22372233
}
22382234
_ => None,
22392235
}
@@ -2256,9 +2252,7 @@ fn try_overloaded_slice(fcx: &FnCtxt,
22562252
token::intern(method_name),
22572253
trait_did,
22582254
base_ty,
2259-
[],
2260-
DontAutoderefReceiver,
2261-
IgnoreStaticMethods)
2255+
[])
22622256
}
22632257
_ => None,
22642258
}
@@ -2314,9 +2308,7 @@ fn try_overloaded_index(fcx: &FnCtxt,
23142308
token::intern("index_mut"),
23152309
trait_did,
23162310
base_ty,
2317-
[],
2318-
DontAutoderefReceiver,
2319-
IgnoreStaticMethods)
2311+
[])
23202312
}
23212313
_ => None,
23222314
};
@@ -2330,9 +2322,7 @@ fn try_overloaded_index(fcx: &FnCtxt,
23302322
token::intern("index"),
23312323
trait_did,
23322324
base_ty,
2333-
[],
2334-
DontAutoderefReceiver,
2335-
IgnoreStaticMethods)
2325+
[])
23362326
}
23372327
(method, _) => method,
23382328
};
@@ -2376,9 +2366,7 @@ fn lookup_method_for_for_loop(fcx: &FnCtxt,
23762366
token::intern("next"),
23772367
trait_did,
23782368
expr_type,
2379-
[],
2380-
DontAutoderefReceiver,
2381-
IgnoreStaticMethods);
2369+
[]);
23822370

23832371
// Regardless of whether the lookup succeeds, check the method arguments
23842372
// so that we have *some* type for each argument.
@@ -3069,13 +3057,11 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
30693057
trait_did: Option<ast::DefId>,
30703058
lhs: &'a ast::Expr,
30713059
rhs: Option<&P<ast::Expr>>,
3072-
autoderef_receiver: AutoderefReceiverFlag,
30733060
unbound_method: ||) -> ty::t {
30743061
let method = match trait_did {
30753062
Some(trait_did) => {
30763063
method::lookup_in_trait(fcx, op_ex.span, Some(lhs), opname,
3077-
trait_did, lhs_ty, &[], autoderef_receiver,
3078-
IgnoreStaticMethods)
3064+
trait_did, lhs_ty, &[])
30793065
}
30803066
None => None
30813067
};
@@ -3249,7 +3235,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
32493235
}
32503236
};
32513237
lookup_op_method(fcx, ex, lhs_resolved_t, token::intern(name),
3252-
trait_did, lhs_expr, Some(rhs), DontAutoderefReceiver, || {
3238+
trait_did, lhs_expr, Some(rhs), || {
32533239
fcx.type_error_message(ex.span, |actual| {
32543240
format!("binary operation `{}` cannot be applied to type `{}`",
32553241
ast_util::binop_to_string(op),
@@ -3266,7 +3252,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
32663252
rhs_expr: &ast::Expr,
32673253
rhs_t: ty::t) -> ty::t {
32683254
lookup_op_method(fcx, ex, rhs_t, token::intern(mname),
3269-
trait_did, rhs_expr, None, DontAutoderefReceiver, || {
3255+
trait_did, rhs_expr, None, || {
32703256
fcx.type_error_message(ex.span, |actual| {
32713257
format!("cannot apply unary operator `{}` to type `{}`",
32723258
op_str, actual)

trunk/src/librustrt/c_str.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,15 @@ impl Collection for CString {
275275
/// Return the number of bytes in the CString (not including the NUL terminator).
276276
#[inline]
277277
fn len(&self) -> uint {
278-
unsafe { libc::strlen(self.buf) as uint }
278+
let mut cur = self.buf;
279+
let mut len = 0;
280+
unsafe {
281+
while *cur != 0 {
282+
len += 1;
283+
cur = cur.offset(1);
284+
}
285+
}
286+
return len;
279287
}
280288
}
281289

0 commit comments

Comments
 (0)