Skip to content

Commit e94ab4b

Browse files
committed
generate code using fqt for bool
1 parent e6673ce commit e94ab4b

File tree

11 files changed

+130
-111
lines changed

11 files changed

+130
-111
lines changed

src/item.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use proc_macro2::Ident;
44
#[cfg(not(feature = "nightly"))]
55
use {
6-
proc_macro2::{Span, TokenStream, TokenTree},
7-
quote::ToTokens,
6+
proc_macro2::{Span, TokenStream},
7+
quote::{quote, ToTokens},
88
syn::{punctuated::Punctuated, spanned::Spanned, Attribute, Meta, Result, Token, Variant},
99
};
1010

@@ -252,7 +252,9 @@ impl Representation {
252252
Representation::ISize => "isize",
253253
};
254254

255-
TokenTree::from(Ident::new(ident, Span::call_site())).into()
255+
let ident = Ident::new(ident, Span::call_site());
256+
257+
quote! {::core::primitive::#ident}
256258
}
257259
}
258260

src/test/basic.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn struct_() -> Result<()> {
8989
#[automatically_derived]
9090
impl<T> ::core::cmp::PartialEq for Test<T> {
9191
#[inline]
92-
fn eq(&self, __other: &Self) -> bool {
92+
fn eq(&self, __other: &Self) -> ::core::primitive::bool {
9393
match (self, __other) {
9494
(Test { field: ref __field_field }, Test { field: ref __other_field_field }) =>
9595
true && ::core::cmp::PartialEq::eq(__field_field, __other_field_field),
@@ -192,7 +192,7 @@ fn tuple() -> Result<()> {
192192
#[automatically_derived]
193193
impl<T> ::core::cmp::PartialEq for Test<T> {
194194
#[inline]
195-
fn eq(&self, __other: &Self) -> bool {
195+
fn eq(&self, __other: &Self) -> ::core::primitive::bool {
196196
match (self, __other) {
197197
(Test(ref __field_0), Test(ref __other_field_0)) =>
198198
true && ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
@@ -229,7 +229,7 @@ fn enum_() -> Result<()> {
229229
};
230230
#[cfg(not(feature = "nightly"))]
231231
let ord = quote! {
232-
const fn __discriminant<T>(__this: &Test<T>) -> isize {
232+
const fn __discriminant<T>(__this: &Test<T>) -> ::core::primitive::isize {
233233
match __this {
234234
Test::A { field: ref __field_field } => 0,
235235
Test::B { } => 1,
@@ -374,7 +374,7 @@ fn enum_() -> Result<()> {
374374
#[automatically_derived]
375375
impl<T> ::core::cmp::PartialEq for Test<T> {
376376
#[inline]
377-
fn eq(&self, __other: &Self) -> bool {
377+
fn eq(&self, __other: &Self) -> ::core::primitive::bool {
378378
if ::core::mem::discriminant(self) == ::core::mem::discriminant(__other) {
379379
match (self, __other) {
380380
(Test::A { field: ref __field_field }, Test::A { field: ref __other_field_field }) =>

src/test/bound.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ fn check_trait_bounds() -> Result<()> {
296296
where T: ::core::cmp::PartialEq
297297
{
298298
#[inline]
299-
fn eq(&self, __other: &Self) -> bool {
299+
fn eq(&self, __other: &Self) -> ::core::primitive::bool {
300300
match (self, __other) {
301301
(Test(ref __field_0, ref __field_1), Test(ref __other_field_0, ref __other_field_1)) =>
302302
true
@@ -457,7 +457,7 @@ fn check_multiple_trait_bounds() -> Result<()> {
457457
U: ::core::cmp::PartialEq
458458
{
459459
#[inline]
460-
fn eq(&self, __other: &Self) -> bool {
460+
fn eq(&self, __other: &Self) -> ::core::primitive::bool {
461461
match (self, __other) {
462462
(Test(ref __field_0, ref __field_1), Test(ref __other_field_0, ref __other_field_1)) =>
463463
true

0 commit comments

Comments
 (0)