forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#75675 - davidtwco:symbol-mangling-impl-para…
…ms, r=eddyb mangling: mangle impl params w/ v0 scheme This PR modifies v0 symbol mangling to include all generic parameters from impl blocks (not just those used in the self type) - an alternative fix to rust-lang#75326. ``` original: _RNCNvXCs4fqI2P2rA04_19impl_param_manglingINtB4_3FooppENtNtNtNtCsfnEnqCNU58Z_4core4iter6traits8iterator8Iterator4next0B4_ // |------------ B4_ ----------------| // _R (N C (N v (X (C ((s 4fqI2p2rA04_) 19impl_param_mangling)) (I (N t B4_ 3Foo) pp E) (N t (N t (N t (N t (C ((s fnEnqCNU58Z_) 4core)) 4iter) 6traits) 8iterator) 8Iterator)) 4next) 0) B4_ modified: _RNvXINICs4fqI2P2rA04_11issue_753260pppEINtB5_3FooppENtNtNtNtCsfnEnqCNU58Z_4core4iter6traits8iterator8Iterator4nextB5_ // _R (N v (X (I (N I (C ((s 4fqI2P2rA04_) 11issue_75326)) 0) ppp E) (I (N t B5_ 3Foo) pp E) (N t (N t (N t (N t (C ((s fnEnqCNU58Z_) 4core)) 4iter) 6traits) 8iterator) 8Iterator)) 4next) B5_ // | ^ | // | | | // | new impl namespace | ``` ~~Submitted as a draft as after some discussion w/ @eddyb, I'm going to do some investigation into (yet more alternative) changes to polymorphization that might remove the necessity for this.~~ r? @eddyb
- Loading branch information
Showing
8 changed files
with
159 additions
and
44 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
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,20 @@ | ||
error: symbol-name(_ZN72_$LT$issue_75326..Foo$LT$I$C$E$GT$$u20$as$u20$issue_75326..Iterator2$GT$4next17SYMBOL_HASH) | ||
--> $DIR/issue-75326.rs:43:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling(<issue_75326::Foo<I,E> as issue_75326::Iterator2>::next::SYMBOL_HASH) | ||
--> $DIR/issue-75326.rs:43:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling-alt(<issue_75326::Foo<I,E> as issue_75326::Iterator2>::next) | ||
--> $DIR/issue-75326.rs:43:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
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,58 @@ | ||
// build-fail | ||
// ignore-tidy-linelength | ||
// revisions: legacy v0 | ||
//[legacy]compile-flags: -Z symbol-mangling-version=legacy | ||
//[v0]compile-flags: -Z symbol-mangling-version=v0 | ||
//[legacy]normalize-stderr-32bit: "h[\d\w]+" -> "SYMBOL_HASH" | ||
//[legacy]normalize-stderr-64bit: "h[\d\w]+" -> "SYMBOL_HASH" | ||
|
||
#![feature(rustc_attrs)] | ||
|
||
pub(crate) struct Foo<I, E>(I, E); | ||
|
||
pub trait Iterator2 { | ||
type Item; | ||
|
||
fn next(&mut self) -> Option<Self::Item>; | ||
|
||
fn find<P>(&mut self, predicate: P) -> Option<Self::Item> | ||
where | ||
Self: Sized, | ||
P: FnMut(&Self::Item) -> bool, | ||
{ | ||
unimplemented!() | ||
} | ||
} | ||
|
||
struct Bar; | ||
|
||
impl Iterator2 for Bar { | ||
type Item = (u32, u16); | ||
|
||
fn next(&mut self) -> Option<Self::Item> { | ||
unimplemented!() | ||
} | ||
} | ||
|
||
impl<I, T, E> Iterator2 for Foo<I, E> | ||
where | ||
I: Iterator2<Item = (T, E)>, | ||
{ | ||
type Item = T; | ||
|
||
#[rustc_symbol_name] | ||
//[legacy]~^ ERROR symbol-name(_ZN72_$LT$issue_75326..Foo$LT$I$C$E$GT$$u20$as$u20$issue_75326..Iterator2$GT$4next | ||
//[legacy]~| ERROR demangling(<issue_75326::Foo<I,E> as issue_75326::Iterator2>::next | ||
//[legacy]~| ERROR demangling-alt(<issue_75326::Foo<I,E> as issue_75326::Iterator2>::next) | ||
//[v0]~^^^^ ERROR symbol-name(_RNvXINICs4fqI2P2rA04_11issue_75326s_0pppEINtB5_3FooppENtB5_9Iterator24nextB5_) | ||
//[v0]~| ERROR demangling(<issue_75326[317d481089b8c8fe]::Foo<_, _> as issue_75326[317d481089b8c8fe]::Iterator2>::next) | ||
//[v0]~| ERROR demangling-alt(<issue_75326::Foo<_, _> as issue_75326::Iterator2>::next) | ||
fn next(&mut self) -> Option<Self::Item> { | ||
self.find(|_| true) | ||
} | ||
} | ||
|
||
fn main() { | ||
let mut a = Foo(Bar, 1u16); | ||
let _ = a.next(); | ||
} |
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,20 @@ | ||
error: symbol-name(_RNvXINICs4fqI2P2rA04_11issue_75326s_0pppEINtB5_3FooppENtB5_9Iterator24nextB5_) | ||
--> $DIR/issue-75326.rs:43:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling(<issue_75326[317d481089b8c8fe]::Foo<_, _> as issue_75326[317d481089b8c8fe]::Iterator2>::next) | ||
--> $DIR/issue-75326.rs:43:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling-alt(<issue_75326::Foo<_, _> as issue_75326::Iterator2>::next) | ||
--> $DIR/issue-75326.rs:43:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|