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

Transmute size errors use incorrect/dummy span. #7316

Closed
huonw opened this issue Jun 23, 2013 · 6 comments
Closed

Transmute size errors use incorrect/dummy span. #7316

huonw opened this issue Jun 23, 2013 · 6 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@huonw
Copy link
Member

huonw commented Jun 23, 2013

// nothing here

fn main() {
    unsafe { std::cast::transmute::<u64, u8>(1) };
}
transmute-span.rs:1:0: 1:0 error: transmute called on types with different sizes: u64 (64 bits) to u8 (8 bits)
transmute-span.rs:1 // nothing here
                    ^
@huonw
Copy link
Member Author

huonw commented Jun 23, 2013

Nominating for production ready.

@emberian
Copy link
Member

emberian commented Aug 5, 2013

Still relevant.

@jdm
Copy link
Contributor

jdm commented Aug 5, 2013

This is marked easy. Is that actually the case?

@jdm
Copy link
Contributor

jdm commented Aug 5, 2013

Looks like it may be:

                let sp = match ccx.tcx.items.get_copy(&ref_id.get()) {
                    ast_map::node_expr(e) => e.span,
                    _ => fail!("transmute has non-expr arg"),
                };

We're in trans_intrinsic, and item is an ast::foreign_item that has a span property. It's worth a shot.

@ghost ghost assigned jdm Aug 5, 2013
@jdm
Copy link
Contributor

jdm commented Aug 5, 2013

This is just #1972 again, isn't it? transmute is an inlined item from libstd, so we freak out like usual. Nothing easy about this.

@catamorphism
Copy link
Contributor

Main bug is #1972, which is already on a milestone. Closing as dup.

flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 15, 2021
Add new lint: `rc_mutex`

changelog: Add new lint `rc_mutex`.

It lints on `Rc<Mutex<T>>`.

`Rc<Mutex<T>>` should be corrected to `Rc<RefCell<T>>`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

4 participants