Skip to content

functions in extern blocks are not recognized as unsafe #4865

@Vlad-Shcherbina

Description

@Vlad-Shcherbina

To reproduce

  1. Add the following to VSCode's settings.json:
           "[Default Dark+]": {  // or whatever theme you use
                "rules": {
                    "operator.unsafe": "#f00",
                    "function.unsafe": "#f00",
                }
            }
  2. Open the following program:
    unsafe fn u() {}
    
    extern "system" {
        fn e();
    }
    
    pub fn f() {
        unsafe {
            u();
            e();
        }
    }

Expected result

Function names in both invocations should be red.

Reference:

A function declared in an extern block is implicitly unsafe.

Actual result

u is red, but e is not:
image


rust-analyzer version: 2020-06-08 (d696776)

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