Skip to content

testsuite: Update and un-xfail unsafe-fn-autoderef #6482

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

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/test/compile-fail/unsafe-fn-autoderef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
type rec = {f: int};
fn f(p: *rec) -> int {
struct Rec {
f: int
}

fn f(p: *Rec) -> int {

// Test that * ptrs do not autoderef. There is a deeper reason for
// prohibiting this, beyond making unsafe things annoying (which doesn't
Expand All @@ -25,7 +27,7 @@ fn f(p: *rec) -> int {
// are prohibited by various checks, such as that the enum is
// instantiable and so forth).

return p.f; //~ ERROR attempted access of field `f` on type `*rec`
return p.f; //~ ERROR attempted access of field `f` on type `*Rec`
}

fn main() {
Expand Down