1 // Copyright 2012-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 // ignore-tidy-linelength
12 // compile-flags:-Zprint-trans-items=eager
17 use std::ops::{Index, IndexMut, Add, Deref};
19 pub struct Indexable {
23 impl Index<usize> for Indexable {
26 //~ TRANS_ITEM fn overloaded_operators::{{impl}}[0]::index[0]
27 fn index(&self, index: usize) -> &Self::Output {
36 impl IndexMut<usize> for Indexable {
37 //~ TRANS_ITEM fn overloaded_operators::{{impl}}[1]::index_mut[0]
38 fn index_mut(&mut self, index: usize) -> &mut Self::Output {
48 //~ TRANS_ITEM fn overloaded_operators::{{impl}}[2]::eq[0]
49 //~ TRANS_ITEM fn overloaded_operators::{{impl}}[2]::ne[0]
51 pub struct Equatable(u32);
54 impl Add<u32> for Equatable {
57 //~ TRANS_ITEM fn overloaded_operators::{{impl}}[3]::add[0]
58 fn add(self, rhs: u32) -> u32 {
63 impl Deref for Equatable {
66 //~ TRANS_ITEM fn overloaded_operators::{{impl}}[4]::deref[0]
67 fn deref(&self) -> &Self::Target {
72 //~ TRANS_ITEM drop-glue i8