summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-11-13 17:42:13 +0000
committerAriel Ben-Yehuda <ariel.byd@gmail.com>2017-11-14 14:54:34 +0200
commitb23c76e1dfe9af3d427cf94f0dead6b8c8c93fc4 (patch)
tree266b204e79d0637ce96934cd8b921abc0c111fbf /src/test/compile-fail
parenta8d6ab7e9814b22aca64559aad07403c1175fc82 (diff)
downloadrust-b23c76e1dfe9af3d427cf94f0dead6b8c8c93fc4.tar.gz
rust-b23c76e1dfe9af3d427cf94f0dead6b8c8c93fc4.zip
Backported merge of #45890 - arielb1:self-first, r=eddyb
check::method - unify receivers before normalizing method signatures

Normalizing method signatures can unify inference variables, which can
cause receiver unification to fail. Unify the receivers first to avoid
that.

Fixes #36701.
Fixes #45801.
Fixes #45855.

r? @eddyb

beta-nominating because #43880 made this ICE happen in more cases (the code in that issue ICEs post-#43880 only, but the unit test here ICEs on all versions).
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/issue-45801.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-45801.rs b/src/test/compile-fail/issue-45801.rs
new file mode 100644
index 00000000000..7823a7d6ba8
--- /dev/null
+++ b/src/test/compile-fail/issue-45801.rs
@@ -0,0 +1,35 @@
+// 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 Params;
+
+pub trait Plugin<E: ?Sized> {
+    type Error;
+}
+
+pub trait Pluggable {
+    fn get_ref<P: Plugin<Self>>(&mut self) -> Option<P::Error> {
+        None
+    }
+}
+
+struct Foo;
+impl Plugin<Foo> for Params {
+    type Error = ();
+}
+
+impl<T: Copy> Pluggable for T {}
+
+fn handle(req: &mut i32) {
+    req.get_ref::<Params>();
+    //~^ ERROR the trait bound `Params: Plugin<i32>` is not satisfied
+}
+
+fn main() {}