diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2017-07-12 06:58:45 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-12 06:58:45 -0600 |
| commit | e5288c9d6c54c4014b12c4ed02028f1e16c2356b (patch) | |
| tree | d1b15e18e12a5e6055fc175b0c41fbeecf085071 /src/test/debuginfo/enum-thinlto.rs | |
| parent | 1a7dc0a2cb8ddf8c767dafb288069ceed7ab92e3 (diff) | |
| parent | 728d26c8861265c15d997117be31ca2b9d3fa44b (diff) | |
| download | rust-e5288c9d6c54c4014b12c4ed02028f1e16c2356b.tar.gz rust-e5288c9d6c54c4014b12c4ed02028f1e16c2356b.zip | |
Rollup merge of #43011 - qnighy:unsized-tuple-impls, r=aturon
Implement Eq/Hash/Debug etc. for unsized tuples.
As I mentioned in [the comment in #18469](https://github.com/rust-lang/rust/issues/18469#issuecomment-306767422), the implementations of `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `Debug`, `Hash` can be generalized to unsized tuples.
This is consistent with the `derive` behavior for unsized structs.
```rust
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Default, Hash)]
struct MyTuple<X, Y, Z: ?Sized>(X, Y, Z);
fn f(x: &MyTuple<i32, i32, [i32]>) {
x == x;
x < x;
println!("{:?}", x);
}
```
Questions:
- Need an RFC?
- Need a feature gate? I don't think it does because the unsized tuple coercion #42527 is feature-gated.
- I changed `builder.field($name);` into `builder.field(&$name);` in the `Debug` implementation to pass compilation. This won't affect the behavior because `Debug for &'a T` is a mere redirection to `Debug for T`. However, I don't know if it affects code size / performance.
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions
