diff options
| author | bors <bors@rust-lang.org> | 2017-06-07 10:09:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-06-07 10:09:11 +0000 |
| commit | 37b1f6c4f147382cfb8d66e4cce2b9d5a094d8c1 (patch) | |
| tree | 96fa8f2179e8c2d0ed768f9f8dde7dc07caaacd8 /src/test/run-pass | |
| parent | 89fceaa5b09792efb1ef3ab872f6e351f351f0f2 (diff) | |
| parent | ec7195f31f420384bad0c1978a54b1e9e4d8f4c0 (diff) | |
| download | rust-37b1f6c4f147382cfb8d66e4cce2b9d5a094d8c1.tar.gz rust-37b1f6c4f147382cfb8d66e4cce2b9d5a094d8c1.zip | |
Auto merge of #42482 - eddyb:issue-42467, r=nikomatsakis
rustc: T: 'empty always holds for all types. Fixes #42467 by special-casing `ReEmpty` to always hold, even for parameters. The reason this is the case is that `ReEmpty` is the result of inferring a region variable with no constraints attached to it, so there is no lifetime a type would contain which would be strictly shorter. r? @nikomatsakis
Diffstat (limited to 'src/test/run-pass')
| -rw-r--r-- | src/test/run-pass/issue-42467.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-42467.rs b/src/test/run-pass/issue-42467.rs new file mode 100644 index 00000000000..1b2ee959b2d --- /dev/null +++ b/src/test/run-pass/issue-42467.rs @@ -0,0 +1,32 @@ +// 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. + +struct Foo<T>(T); + +struct IntoIter<T>(T); + +impl<'a, T: 'a> Iterator for IntoIter<T> { + type Item = (); + + fn next(&mut self) -> Option<()> { + None + } +} + +impl<T> IntoIterator for Foo<T> { + type Item = (); + type IntoIter = IntoIter<T>; + + fn into_iter(self) -> IntoIter<T> { + IntoIter(self.0) + } +} + +fn main() {} |
