-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto 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).
- Loading branch information
Showing
2 changed files
with
56 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |