-
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 #52546 - nikomatsakis:issue-52050, r=pnkfelix
do not overwrite child def-id in place but rather remove/insert When inserting a node N into the tree of impls, we sometimes find than an existing node C should be replaced with N. We used to overwrite C in place with the new def-id N -- but since the lists of def-ids are separated by simplified type, that could lead to N being inserted in the wrong place. This meant we might miss conflicts. We are now not trying to be so smart -- we remove C and then add N later. Fixes #52050 r? @aturon -- do you still remember this code at all? :)
- Loading branch information
Showing
3 changed files
with
121 additions
and
22 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
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,42 @@ | ||
// Copyright 2015 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. | ||
|
||
#![feature(specialization)] | ||
|
||
// Regression test for #52050: when inserting the blanket impl `I` | ||
// into the tree, we had to replace the child node for `Foo`, which | ||
// led to the struture of the tree being messed up. | ||
|
||
use std::iter::Iterator; | ||
|
||
trait IntoPyDictPointer { } | ||
|
||
struct Foo { } | ||
|
||
impl Iterator for Foo { | ||
type Item = (); | ||
fn next(&mut self) -> Option<()> { | ||
None | ||
} | ||
} | ||
|
||
impl IntoPyDictPointer for Foo { } | ||
|
||
impl<I> IntoPyDictPointer for I | ||
where | ||
I: Iterator, | ||
{ | ||
} | ||
|
||
impl IntoPyDictPointer for () //~ ERROR conflicting implementations | ||
{ | ||
} | ||
|
||
fn main() { } |