Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

const_eval::cast_const should use target's int/uint types for isize/usize #23890

Closed
pnkfelix opened this issue Mar 31, 2015 · 4 comments
Closed
Labels
A-type-system Area: Type system

Comments

@pnkfelix
Copy link
Member

Spawned off of PR #23863, see discussion here

    define_casts!{
        // FIXME: This should probably be using the target's int-type, not he host's.
        ty::ty_int(ast::TyIs) => (isize, const_int, i64),
        ty::ty_int(ast::TyI8) => (i8, const_int, i64),
        ty::ty_int(ast::TyI16) => (i16, const_int, i64),
        ty::ty_int(ast::TyI32) => (i32, const_int, i64),
        ty::ty_int(ast::TyI64) => (i64, const_int, i64),
        // FIXME: This should probably be using the target's uint-type, not he host's.
        ty::ty_uint(ast::TyUs) => (usize, const_uint, u64),
        ty::ty_uint(ast::TyU8) => (u8, const_uint, u64),
        ty::ty_uint(ast::TyU16) => (u16, const_uint, u64),
        ty::ty_uint(ast::TyU32) => (u32, const_uint, u64),
        ty::ty_uint(ast::TyU64) => (u64, const_uint, u64),
        ty::ty_float(ast::TyF32) => (f32, const_float, f64),
        ty::ty_float(ast::TyF64) => (f64, const_float, f64)
    }
@pnkfelix
Copy link
Member Author

(I think the only tricky part about this is determining if there is a good regression test to catch this bug; obviously it will only be caught in cross-compilation contexts.)

@pnkfelix
Copy link
Member Author

Semi-ironically, I think this bug might be what is blocking PR #23841 from landing.

(If true, then the only "tricky part" referenced above has actually already been accomplished.)

@pnkfelix
Copy link
Member Author

see also #13768 (which #23863 does not completely address; there is clearly still some corner cases to address in the ExprCast logic).

@pnkfelix
Copy link
Member Author

cc #23897

@steveklabnik steveklabnik added the A-type-system Area: Type system label Mar 31, 2015
pnkfelix added a commit to pnkfelix/rust that referenced this issue Mar 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system
Projects
None yet
Development

No branches or pull requests

2 participants