1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Regression test for #22040.
15 trait Expr: Debug + PartialEq {
16 fn print_element_count(&self);
19 //#[derive(PartialEq)]
22 elements: Vec<Box<Expr+ 'x>>,
25 impl<'x> PartialEq for SExpr<'x> {
26 fn eq(&self, other:&SExpr<'x>) -> bool {
27 println!("L1: {} L2: {}", self.elements.len(), other.elements.len());
28 let result = self.elements.len() == other.elements.len();
30 println!("Got compare {}", result);
36 fn new() -> SExpr<'x> { return SExpr{elements: Vec::new(),}; }
39 impl <'x> Expr for SExpr<'x> {
40 fn print_element_count(&self) {
41 println!("element count: {}", self.elements.len());
46 let a: Box<Expr> = Box::new(SExpr::new()); //~ ERROR trait `Expr` is not object-safe
47 let b: Box<Expr> = Box::new(SExpr::new()); //~ ERROR trait `Expr` is not object-safe