Skip to content

Commit 5f94bbd

Browse files
committed
---
yaml --- r: 3036 b: refs/heads/master c: f6d7d75 h: refs/heads/master v: v3
1 parent 8dce9b9 commit 5f94bbd

File tree

4 files changed

+40
-69
lines changed

4 files changed

+40
-69
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 1d1010cac090e1b2d79500e32144a2e87c39e13e
2+
refs/heads/master: f6d7d756993c9dbba9134683397fff600deb3f00

trunk/src/comp/middle/typeck.rs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,21 +2287,13 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
22872287
alt (anon_obj.with_obj) {
22882288
case (none) { }
22892289
case (some(?e)) {
2290-
// This had better have object type. TOOD: report an
2290+
// This had better have object type. TODO: report an
22912291
// error if the user is trying to extend a non-object
22922292
// with_obj.
22932293
check_expr(fcx, e);
22942294
}
22952295
}
22962296

2297-
// Typecheck the methods.
2298-
for (@ast::method method in anon_obj.methods) {
2299-
check_method(fcx.ccx, method);
2300-
}
2301-
2302-
auto t = next_ty_var(fcx);
2303-
2304-
23052297
// FIXME: These next three functions are largely ripped off from
23062298
// similar ones in collect::. Is there a better way to do this?
23072299

@@ -2328,11 +2320,28 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
23282320
anon_obj.methods);
23292321
}
23302322

2331-
auto methods = get_anon_obj_method_types(fcx.ccx, anon_obj);
2323+
auto method_types = get_anon_obj_method_types(fcx.ccx, anon_obj);
23322324
auto ot = ty::mk_obj(fcx.ccx.tcx,
2333-
ty::sort_methods(methods));
2325+
ty::sort_methods(method_types));
23342326
write::ty_only_fixup(fcx, a.id, ot);
23352327

2328+
// Write the methods into the node type table. (This happens in
2329+
// collect::convert for regular objects.)
2330+
auto i = 0u;
2331+
while (i < vec::len[@ast::method](anon_obj.methods)) {
2332+
write::ty_only(fcx.ccx.tcx, anon_obj.methods.(i).node.ann.id,
2333+
ty::method_ty_to_fn_ty(fcx.ccx.tcx,
2334+
method_types.(i)));
2335+
i += 1u;
2336+
}
2337+
2338+
// Typecheck the methods.
2339+
for (@ast::method method in anon_obj.methods) {
2340+
check_method(fcx.ccx, method);
2341+
}
2342+
2343+
auto t = next_ty_var(fcx);
2344+
23362345
// Now remove the info from the stack.
23372346
vec::pop[obj_info](fcx.ccx.obj_infos);
23382347
}

trunk/src/rt/rust.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,6 @@ rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
120120
// indent-tabs-mode: nil
121121
// c-basic-offset: 4
122122
// buffer-file-coding-system: utf-8-unix
123-
// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
123+
// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
124124
// End:
125125
//

trunk/src/rt/rust_log.cpp

Lines changed: 18 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ size_t parse_logging_spec(char* spec, log_directive* dirs) {
176176
}
177177

178178
void update_module_map(const mod_entry* map, log_directive* dirs,
179-
size_t n_dirs, size_t *n_matches) {
179+
size_t n_dirs) {
180180
for (const mod_entry* cur = map; cur->name; cur++) {
181181
size_t level = default_log_level, longest_match = 0;
182182
for (size_t d = 0; d < n_dirs; d++) {
@@ -187,28 +187,18 @@ void update_module_map(const mod_entry* map, log_directive* dirs,
187187
}
188188
}
189189
*cur->state = level;
190-
(*n_matches)++;
191190
}
192191
}
193192

194193
void update_crate_map(const cratemap* map, log_directive* dirs,
195-
size_t n_dirs, size_t *n_matches) {
194+
size_t n_dirs) {
196195
// First update log levels for this crate
197-
update_module_map(map->entries, dirs, n_dirs, n_matches);
196+
update_module_map(map->entries, dirs, n_dirs);
198197
// Then recurse on linked crates
199198
// FIXME this does double work in diamond-shaped deps. could keep
200199
// a set of visited addresses, if it turns out to be actually slow
201200
for (size_t i = 0; map->children[i]; i++) {
202-
update_crate_map(map->children[i], dirs, n_dirs, n_matches);
203-
}
204-
}
205-
206-
void print_crate_log_map(const cratemap* map) {
207-
for (const mod_entry* cur = map->entries; cur->name; cur++) {
208-
printf(" %s\n", cur->name);
209-
}
210-
for (size_t i = 0; map->children[i]; i++) {
211-
print_crate_log_map(map->children[i]);
201+
update_crate_map(map->children[i], dirs, n_dirs);
212202
}
213203
}
214204

@@ -228,61 +218,33 @@ size_t log_rt_kern;
228218
size_t log_rt_backtrace;
229219

230220
static const mod_entry _rt_module_map[] =
231-
{{"::rt::mem", &log_rt_mem},
232-
{"::rt::comm", &log_rt_comm},
233-
{"::rt::task", &log_rt_task},
234-
{"::rt::dom", &log_rt_dom},
235-
{"::rt::trace", &log_rt_trace},
236-
{"::rt::cache", &log_rt_cache},
237-
{"::rt::upcall", &log_rt_upcall},
238-
{"::rt::timer", &log_rt_timer},
239-
{"::rt::gc", &log_rt_gc},
240-
{"::rt::stdlib", &log_rt_stdlib},
241-
{"::rt::kern", &log_rt_kern},
242-
{"::rt::backtrace", &log_rt_backtrace},
221+
{{"rt::mem", &log_rt_mem},
222+
{"rt::comm", &log_rt_comm},
223+
{"rt::task", &log_rt_task},
224+
{"rt::dom", &log_rt_dom},
225+
{"rt::trace", &log_rt_trace},
226+
{"rt::cache", &log_rt_cache},
227+
{"rt::upcall", &log_rt_upcall},
228+
{"rt::timer", &log_rt_timer},
229+
{"rt::gc", &log_rt_gc},
230+
{"rt::stdlib", &log_rt_stdlib},
231+
{"rt::kern", &log_rt_kern},
232+
{"rt::backtrace", &log_rt_backtrace},
243233
{NULL, NULL}};
244234

245235
void update_log_settings(void* crate_map, char* settings) {
246236
char* buffer = NULL;
247237
log_directive dirs[256];
248238
size_t n_dirs = 0;
249-
250239
if (settings) {
251-
252-
if (strcmp(settings, "::help") == 0 ||
253-
strcmp(settings, "?") == 0) {
254-
printf("\nCrate log map:\n\n");
255-
print_crate_log_map((const cratemap*)crate_map);
256-
printf("\n");
257-
exit(1);
258-
}
259-
260240
size_t buflen = strlen(settings) + 1;
261241
buffer = (char*)malloc(buflen);
262242
strncpy(buffer, settings, buflen);
263243
n_dirs = parse_logging_spec(buffer, &dirs[0]);
264244
}
265245

266-
size_t n_matches = 0;
267-
update_module_map(_rt_module_map, &dirs[0], n_dirs, &n_matches);
268-
update_crate_map((const cratemap*)crate_map, &dirs[0],
269-
n_dirs, &n_matches);
270-
271-
if (n_matches < n_dirs) {
272-
printf("warning: got %d RUST_LOG specs, enabled %d flags.",
273-
n_dirs, n_matches);
274-
}
246+
update_module_map(_rt_module_map, &dirs[0], n_dirs);
247+
update_crate_map((const cratemap*)crate_map, &dirs[0], n_dirs);
275248

276249
free(buffer);
277250
}
278-
279-
//
280-
// Local Variables:
281-
// mode: C++
282-
// fill-column: 78;
283-
// indent-tabs-mode: nil
284-
// c-basic-offset: 4
285-
// buffer-file-coding-system: utf-8-unix
286-
// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
287-
// End:
288-
//

0 commit comments

Comments
 (0)