From 67646be880cd3a6c5f5a41e87bfb5f3be3f91b29 Mon Sep 17 00:00:00 2001 From: Keiichi Watanabe Date: Mon, 20 Jul 2015 12:17:43 +0900 Subject: [PATCH] Fix iteration of destructor checker. Don't add a type to breadcrumbs vector when it is reference, pointer, or bare functions. Fixes #25750 --- src/librustc_typeck/check/dropck.rs | 1 + src/test/run-pass/issue-25750.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/test/run-pass/issue-25750.rs diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index 7d911cf8b03bc..8c9afbdc87347 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -525,6 +525,7 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'tcx>( // and bare functions don't own instances // of the types appearing within them. walker.skip_current_subtree(); + breadcrumbs.pop(); } _ => {} }; diff --git a/src/test/run-pass/issue-25750.rs b/src/test/run-pass/issue-25750.rs new file mode 100644 index 0000000000000..2ed48af03f94c --- /dev/null +++ b/src/test/run-pass/issue-25750.rs @@ -0,0 +1,15 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn foo() -> Option<(Box, Box)> { + None +} + +fn main() {}