Skip to content

Ch19-01 Ambiguous wording on how Rust can tell if code is safe. #2317

@Daniel-Worrall

Description

@Daniel-Worrall

With context, I am able to parse this sentence, but it is ambiguous, and it is better to reword it.

Although the code might be okay, as far as Rust is able to tell, it’s not!

This can have 2 meanings.
The correct form:

Although the code is okay, Rust is unable to tell that it isn't okay.

The incorrect form:

Rust is able to tell that the code is okay, but it isn't.

I do not propose the correct form as the change, just that it illustrates the two meanings that this sentence can imply.

The rest of the paragraph for context:

Unsafe Rust exists because, by nature, static analysis is conservative. When the compiler tries to determine whether or not code upholds the guarantees, it’s better for it to reject some valid programs rather than accept some invalid programs. Although the code might be okay, as far as Rust is able to tell, it’s not! In these cases, you can use unsafe code to tell the compiler, “Trust me, I know what I’m doing.” The downside is that you use it at your own risk: if you use unsafe code incorrectly, problems due to memory unsafety, such as null pointer dereferencing, can occur.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions