about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-10-02 04:22:55 +0000
committerbors <bors@rust-lang.org>2018-10-02 04:22:55 +0000
commite812ca472a2a5284e9f15cd9af32285d7ff3fd39 (patch)
tree95573240736e7f0488f9de0ebba124cc96c82c2f /src/test
parent2d1065bc2a4a79e553e87cb18faf48aa7df1858f (diff)
parentb95d0489d96cc7e8f9e0a800cf9fa0907a8840c5 (diff)
downloadrust-e812ca472a2a5284e9f15cd9af32285d7ff3fd39.tar.gz
rust-e812ca472a2a5284e9f15cd9af32285d7ff3fd39.zip
Auto merge of #54701 - arielb1:outlives-later, r=nikomatsakis
normalize param-env type-outlives predicates last

The normalization of type-outlives predicates can depend on misc.
environment predicates, but not the other way around. Inferred lifetime
bounds can propagate type-outlives bounds far and wide, so their
normalization needs to work well.

Fixes #54467

r? @nikomatsakis
beta-nominating because this is required for inferred_outlives_bounds, which is in beta
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/issue-54467.rs54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-54467.rs b/src/test/run-pass/issue-54467.rs
new file mode 100644
index 00000000000..4fc44952e3a
--- /dev/null
+++ b/src/test/run-pass/issue-54467.rs
@@ -0,0 +1,54 @@
+// Copyright 2018 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 trait Stream {
+    type Item;
+    type Error;
+}
+
+pub trait ParseError<I> {
+    type Output;
+}
+
+impl ParseError<char> for u32 {
+    type Output = ();
+}
+
+impl Stream for () {
+    type Item = char;
+    type Error = u32;
+}
+
+pub struct Lex<'a, I>
+    where I: Stream,
+          I::Error: ParseError<char>,
+          <<I as Stream>::Error as ParseError<char>>::Output: 'a
+{
+    x: &'a <I::Error as ParseError<char>>::Output
+}
+
+pub struct Reserved<'a, I> where
+    I: Stream<Item=char> + 'a,
+    I::Error: ParseError<I::Item>,
+    <<I as Stream>::Error as ParseError<char>>::Output: 'a
+
+{
+    x: Lex<'a, I>
+}
+
+fn main() {
+    let r: Reserved<()> = Reserved {
+        x: Lex {
+            x: &()
+        }
+    };
+
+    let _v = r.x.x;
+}