Skip to content

Commit a3a004c

Browse files
author
Ariel Ben-Yehuda
committed
---
yaml --- r: 224364 b: refs/heads/beta c: e99b53e h: refs/heads/master v: v3
1 parent d3de15a commit a3a004c

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
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 7f9953b9745dec2d67ed735dff461795bd48863a
26+
refs/heads/beta: e99b53e1c16b6ab7dcac7ccc841fb9cb9fc75381
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 938f5d7af401e2d8238522fed4a612943b6e77fd
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/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)