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.
This commit is contained in:
Ariel Ben-Yehuda 2017-03-01 18:42:26 +02:00
parent e1cb9ba221
commit e294fd5ecb
11 changed files with 133 additions and 129 deletions

View file

@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub struct List<T> {
head: T,
}
impl Drop for List<i32> { //~ ERROR E0366
fn drop(&mut self) {
panic!()
}
}
fn main() {
List { head: 0 };
}