-
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.
Rollup merge of #77554 - varkor:mangle-int-char, r=eddyb
Support signed integers and `char` in v0 mangling Likely we want more tests, to check the output is correct too: however, I wasn't sure what kind of test we needed, so I just added one similar to that added in #77452 for now. r? @eddyb
- Loading branch information
Showing
9 changed files
with
227 additions
and
13 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,38 @@ | ||
// build-fail | ||
// compile-flags: -Z symbol-mangling-version=v0 | ||
|
||
#![feature(min_const_generics, rustc_attrs)] | ||
|
||
pub struct Unsigned<const F: u8>; | ||
|
||
#[rustc_symbol_name] | ||
//~^ ERROR symbol-name(_RMCs4fqI2P2rA04_25const_generics_demanglingINtB0_8UnsignedKhb_E) | ||
//~| ERROR demangling(<const_generics_demangling[317d481089b8c8fe]::Unsigned<11: u8>>) | ||
//~| ERROR demangling-alt(<const_generics_demangling::Unsigned<11>>) | ||
impl Unsigned<11> {} | ||
|
||
pub struct Signed<const F: i16>; | ||
|
||
#[rustc_symbol_name] | ||
//~^ ERROR symbol-name(_RMs_Cs4fqI2P2rA04_25const_generics_demanglingINtB2_6SignedKsn98_E) | ||
//~| ERROR demangling(<const_generics_demangling[317d481089b8c8fe]::Signed<-152: i16>>) | ||
//~| ERROR demangling-alt(<const_generics_demangling::Signed<-152>>) | ||
impl Signed<-152> {} | ||
|
||
pub struct Bool<const F: bool>; | ||
|
||
#[rustc_symbol_name] | ||
//~^ ERROR symbol-name(_RMs0_Cs4fqI2P2rA04_25const_generics_demanglingINtB3_4BoolKb1_E) | ||
//~| ERROR demangling(<const_generics_demangling[317d481089b8c8fe]::Bool<true: bool>>) | ||
//~| ERROR demangling-alt(<const_generics_demangling::Bool<true>>) | ||
impl Bool<true> {} | ||
|
||
pub struct Char<const F: char>; | ||
|
||
#[rustc_symbol_name] | ||
//~^ ERROR symbol-name(_RMs1_Cs4fqI2P2rA04_25const_generics_demanglingINtB3_4CharKc2202_E) | ||
//~| ERROR demangling(<const_generics_demangling[317d481089b8c8fe]::Char<'∂': char>>) | ||
//~| ERROR demangling-alt(<const_generics_demangling::Char<'∂'>>) | ||
impl Char<'∂'> {} | ||
|
||
fn main() {} |
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,74 @@ | ||
error: symbol-name(_RMCs4fqI2P2rA04_25const_generics_demanglingINtB0_8UnsignedKhb_E) | ||
--> $DIR/const-generics-demangling.rs:8:1 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling(<const_generics_demangling[317d481089b8c8fe]::Unsigned<11: u8>>) | ||
--> $DIR/const-generics-demangling.rs:8:1 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling-alt(<const_generics_demangling::Unsigned<11>>) | ||
--> $DIR/const-generics-demangling.rs:8:1 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: symbol-name(_RMs_Cs4fqI2P2rA04_25const_generics_demanglingINtB2_6SignedKsn98_E) | ||
--> $DIR/const-generics-demangling.rs:16:1 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling(<const_generics_demangling[317d481089b8c8fe]::Signed<-152: i16>>) | ||
--> $DIR/const-generics-demangling.rs:16:1 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling-alt(<const_generics_demangling::Signed<-152>>) | ||
--> $DIR/const-generics-demangling.rs:16:1 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: symbol-name(_RMs0_Cs4fqI2P2rA04_25const_generics_demanglingINtB3_4BoolKb1_E) | ||
--> $DIR/const-generics-demangling.rs:24:1 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling(<const_generics_demangling[317d481089b8c8fe]::Bool<true: bool>>) | ||
--> $DIR/const-generics-demangling.rs:24:1 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling-alt(<const_generics_demangling::Bool<true>>) | ||
--> $DIR/const-generics-demangling.rs:24:1 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: symbol-name(_RMs1_Cs4fqI2P2rA04_25const_generics_demanglingINtB3_4CharKc2202_E) | ||
--> $DIR/const-generics-demangling.rs:32:1 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling(<const_generics_demangling[317d481089b8c8fe]::Char<'∂': char>>) | ||
--> $DIR/const-generics-demangling.rs:32:1 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling-alt(<const_generics_demangling::Char<'∂'>>) | ||
--> $DIR/const-generics-demangling.rs:32:1 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 12 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,87 @@ | ||
// check-pass | ||
// revisions: legacy v0 | ||
//[legacy]compile-flags: -Z symbol-mangling-version=legacy --crate-type=lib | ||
//[v0]compile-flags: -Z symbol-mangling-version=v0 --crate-type=lib | ||
|
||
#![feature(min_const_generics)] | ||
|
||
// `char` | ||
pub struct Char<const F: char>; | ||
|
||
impl Char<'A'> { | ||
pub fn foo() {} | ||
} | ||
|
||
impl<const F: char> Char<F> { | ||
pub fn bar() {} | ||
} | ||
|
||
// `i8` | ||
pub struct I8<const F: i8>; | ||
|
||
impl I8<{std::i8::MIN}> { | ||
pub fn foo() {} | ||
} | ||
|
||
impl I8<{std::i8::MAX}> { | ||
pub fn foo() {} | ||
} | ||
|
||
impl<const F: i8> I8<F> { | ||
pub fn bar() {} | ||
} | ||
|
||
// `i16` | ||
pub struct I16<const F: i16>; | ||
|
||
impl I16<{std::i16::MIN}> { | ||
pub fn foo() {} | ||
} | ||
|
||
impl<const F: i16> I16<F> { | ||
pub fn bar() {} | ||
} | ||
|
||
// `i32` | ||
pub struct I32<const F: i32>; | ||
|
||
impl I32<{std::i32::MIN}> { | ||
pub fn foo() {} | ||
} | ||
|
||
impl<const F: i32> I32<F> { | ||
pub fn bar() {} | ||
} | ||
|
||
// `i64` | ||
pub struct I64<const F: i64>; | ||
|
||
impl I64<{std::i64::MIN}> { | ||
pub fn foo() {} | ||
} | ||
|
||
impl<const F: i64> I64<F> { | ||
pub fn bar() {} | ||
} | ||
|
||
// `i128` | ||
pub struct I128<const F: i128>; | ||
|
||
impl I128<{std::i128::MIN}> { | ||
pub fn foo() {} | ||
} | ||
|
||
impl<const F: i128> I128<F> { | ||
pub fn bar() {} | ||
} | ||
|
||
// `isize` | ||
pub struct ISize<const F: isize>; | ||
|
||
impl ISize<3> { | ||
pub fn foo() {} | ||
} | ||
|
||
impl<const F: isize> ISize<F> { | ||
pub fn bar() {} | ||
} |
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