Skip to content

Commit c0dda7f

Browse files
author
Ariel Ben-Yehuda
committed
---
yaml --- r: 228876 b: refs/heads/try c: e99b53e h: refs/heads/master v: v3
1 parent 27e5949 commit c0dda7f

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 7f9953b9745dec2d67ed735dff461795bd48863a
4+
refs/heads/try: e99b53e1c16b6ab7dcac7ccc841fb9cb9fc75381
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_typeck/check/dropck.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use middle::infer;
1414
use middle::region;
1515
use middle::subst::{self, Subst};
1616
use middle::ty::{self, Ty};
17+
use util::nodemap::FnvHashSet;
1718

1819
use syntax::ast;
1920
use syntax::codemap::{self, Span};
@@ -268,7 +269,7 @@ pub fn check_safety_of_destructor_if_necessary<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>
268269
rcx: rcx,
269270
span: span,
270271
parent_scope: parent_scope,
271-
breadcrumbs: vec![]
272+
breadcrumbs: FnvHashSet()
272273
},
273274
TypeContext::Root,
274275
typ,
@@ -331,7 +332,7 @@ enum TypeContext {
331332
struct DropckContext<'a, 'b: 'a, 'tcx: 'b> {
332333
rcx: &'a mut Rcx<'b, 'tcx>,
333334
/// types that have already been traversed
334-
breadcrumbs: Vec<Ty<'tcx>>,
335+
breadcrumbs: FnvHashSet<Ty<'tcx>>,
335336
/// span for error reporting
336337
span: Span,
337338
/// the scope reachable dtorck types must outlive
@@ -358,15 +359,13 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'b, 'tcx>(
358359

359360
let opt_phantom_data_def_id = tcx.lang_items.phantom_data();
360361

361-
// FIXME(arielb1): don't be O(n^2)
362-
if cx.breadcrumbs.contains(&ty) {
362+
if !cx.breadcrumbs.insert(ty) {
363363
debug!("iterate_over_potentially_unsafe_regions_in_type \
364364
{}ty: {} scope: {:?} - cached",
365365
(0..depth).map(|_| ' ').collect::<String>(),
366366
ty, cx.parent_scope);
367367
return Ok(()); // we already visited this type
368368
}
369-
cx.breadcrumbs.push(ty);
370369
debug!("iterate_over_potentially_unsafe_regions_in_type \
371370
{}ty: {} scope: {:?}",
372371
(0..depth).map(|_| ' ').collect::<String>(),

0 commit comments

Comments
 (0)