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

Invalid help suggestion #56714

Closed
bjorn3 opened this issue Dec 11, 2018 · 3 comments
Closed

Invalid help suggestion #56714

bjorn3 opened this issue Dec 11, 2018 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug.

Comments

@bjorn3
Copy link
Member

bjorn3 commented Dec 11, 2018

error[E0609]: no field `opts` on type `*mut rustc::session::Session`
   --> src/lib.rs:143:54
    |
143 |             (sess as *const Session as *mut Session).opts.cli_forced_codegen_units = Some(1);
    |                                                      ^^^^
help: `sess as *const Session as *mut Session` is a native pointer; try dereferencing it
    |
143 |             (sess as *const Session as *mut Session).(*sess as *const Session as *mut Session).opts.cli_forced_codegen_units = Some(1);
    | 
@oli-obk
Copy link
Contributor

oli-obk commented Dec 11, 2018

Can you provide a minimal repro as a regression test?

@oli-obk oli-obk added the A-diagnostics Area: Messages for errors, warnings, and lints label Dec 11, 2018
@jonas-schievink
Copy link
Contributor

(they should also be called raw pointers, not native, unless that terminology has changed recently)

@bjorn3
Copy link
Member Author

bjorn3 commented Dec 11, 2018

struct Session {
    opts: u8
}

fn main() {
    let sess: &Session = &Session { opts: 0 };
    (sess as *const Session as *mut Session).opts = 42;
}

Edit: smaller repro

@oli-obk oli-obk added the C-bug Category: This is a bug. label Dec 11, 2018
Centril added a commit to Centril/rust that referenced this issue Dec 23, 2018
…zackmdavis

Correct strings for raw pointer deref and array access suggestions

Fixes rust-lang#56714.
Fixes rust-lang#56963.

r? @zackmdavis
Centril added a commit to Centril/rust that referenced this issue Dec 23, 2018
…zackmdavis

Correct strings for raw pointer deref and array access suggestions

Fixes rust-lang#56714.
Fixes rust-lang#56963.

r? @zackmdavis
Centril added a commit to Centril/rust that referenced this issue Dec 23, 2018
…zackmdavis

Correct strings for raw pointer deref and array access suggestions

Fixes rust-lang#56714.
Fixes rust-lang#56963.

r? @zackmdavis
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 C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants