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:
parent
e1cb9ba221
commit
e294fd5ecb
11 changed files with 133 additions and 129 deletions
23
src/test/compile-fail/issue-38868.rs
Normal file
23
src/test/compile-fail/issue-38868.rs
Normal 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 };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue