Skip to content

Commit e26ee49

Browse files
author
Ariel Ben-Yehuda
committed
---
yaml --- r: 235947 b: refs/heads/stable c: e99b53e h: refs/heads/master i: 235945: 2ded9ab 235943: 869864a v: v3
1 parent c7f86b9 commit e26ee49

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
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 7f9953b9745dec2d67ed735dff461795bd48863a
32+
refs/heads/stable: e99b53e1c16b6ab7dcac7ccc841fb9cb9fc75381
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

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