From e294fd5ecbd097e343dc31b3df27bbf81dbea6de Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Wed, 1 Mar 2017 18:42:26 +0200 Subject: convert AdtDef::destructor to on-demand This removes the Cell from AdtDef. Also, moving destructor validity checking to on-demand (forced during item-type checking) ensures that invalid destructors can't cause ICEs. Fixes #38868. Fixes #40132. --- src/test/compile-fail/issue-38868.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/compile-fail/issue-38868.rs (limited to 'src/test') diff --git a/src/test/compile-fail/issue-38868.rs b/src/test/compile-fail/issue-38868.rs new file mode 100644 index 00000000000..c7e1da7094f --- /dev/null +++ b/src/test/compile-fail/issue-38868.rs @@ -0,0 +1,23 @@ +// Copyright 2017 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. + +pub struct List { + head: T, +} + +impl Drop for List { //~ ERROR E0366 + fn drop(&mut self) { + panic!() + } +} + +fn main() { + List { head: 0 }; +} -- cgit 1.4.1-3-g733a5