diff options
| author | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2017-11-09 20:17:51 +0200 |
|---|---|---|
| committer | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2017-11-09 20:21:59 +0200 |
| commit | 5901f1c8b52315f705dac1d072f438139338b195 (patch) | |
| tree | dba2d0c6d521334c7f1103220db534e26bdf4791 /src/test | |
| parent | 6e2977499bc9075fcc50f03e155303db53583f90 (diff) | |
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.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/issue-45801.rs | 35 |
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() {} |
