slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.67k stars 611 forks source link

I just used the slint-rust-template and got a bunch of errors from the start. #6705

Closed 6p5ra closed 3 weeks ago

6p5ra commented 3 weeks ago

I ran everything as specified in the template's readme.

cargo build and then cargo run.

In the PROBLEMS tab of my IDE VS Code, I got a huge list of errors:

[{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [5]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "5",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "unresolved import `slint`\nuse of undeclared crate or module `slint`",
    "source": "rustc",
    "startLineNumber": 1,
    "startColumn": 5,
    "endLineNumber": 1,
    "endColumn": 10
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [0]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "0",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "failed to resolve: use of undeclared crate or module `winapi`\nuse of undeclared crate or module `winapi`",
    "source": "rustc",
    "startLineNumber": 2,
    "startColumn": 5,
    "endLineNumber": 2,
    "endColumn": 11
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [1]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "1",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "failed to resolve: use of undeclared crate or module `winapi`\nuse of undeclared crate or module `winapi`",
    "source": "rustc",
    "startLineNumber": 3,
    "startColumn": 5,
    "endLineNumber": 3,
    "endColumn": 11
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [2]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "2",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "failed to resolve: use of undeclared crate or module `winapi`\nuse of undeclared crate or module `winapi`",
    "source": "rustc",
    "startLineNumber": 4,
    "startColumn": 5,
    "endLineNumber": 4,
    "endColumn": 11
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [3]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "3",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "failed to resolve: use of undeclared crate or module `winapi`\nuse of undeclared crate or module `winapi`",
    "source": "rustc",
    "startLineNumber": 5,
    "startColumn": 5,
    "endLineNumber": 5,
    "endColumn": 11
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [4]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "4",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "failed to resolve: use of undeclared crate or module `winapi`\nuse of undeclared crate or module `winapi`",
    "source": "rustc",
    "startLineNumber": 6,
    "startColumn": 5,
    "endLineNumber": 6,
    "endColumn": 11
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [6]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "6",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "failed to resolve: use of undeclared crate or module `slint`\nuse of undeclared crate or module `slint`",
    "source": "rustc",
    "startLineNumber": 10,
    "startColumn": 1,
    "endLineNumber": 10,
    "endColumn": 6
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [12]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "12",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "failed to resolve: use of undeclared type `WifiLister`\nuse of undeclared type `WifiLister`",
    "source": "rustc",
    "startLineNumber": 22,
    "startColumn": 14,
    "endLineNumber": 22,
    "endColumn": 24
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [13]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "13",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "cannot find function, tuple struct or tuple variant `WlanOpenHandle` in this scope\nnot found in this scope",
    "source": "rustc",
    "startLineNumber": 28,
    "startColumn": 22,
    "endLineNumber": 28,
    "endColumn": 36
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [7]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "7",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "cannot find value `ERROR_SUCCESS` in this scope\nnot found in this scope",
    "source": "rustc",
    "startLineNumber": 30,
    "startColumn": 22,
    "endLineNumber": 30,
    "endColumn": 35
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [8]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "8",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "cannot find type `WLAN_INTERFACE_INFO_LIST` in this scope\nnot found in this scope",
    "source": "rustc",
    "startLineNumber": 35,
    "startColumn": 40,
    "endLineNumber": 35,
    "endColumn": 64
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [14]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "14",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "cannot find function, tuple struct or tuple variant `WlanEnumInterfaces` in this scope\nnot found in this scope",
    "source": "rustc",
    "startLineNumber": 36,
    "startColumn": 22,
    "endLineNumber": 36,
    "endColumn": 40
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [9]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "9",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "cannot find value `ERROR_SUCCESS` in this scope\nnot found in this scope",
    "source": "rustc",
    "startLineNumber": 38,
    "startColumn": 22,
    "endLineNumber": 38,
    "endColumn": 35
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [10]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "10",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "cannot find type `WLAN_AVAILABLE_NETWORK_LIST` in this scope\nnot found in this scope",
    "source": "rustc",
    "startLineNumber": 46,
    "startColumn": 42,
    "endLineNumber": 46,
    "endColumn": 69
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [15]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "15",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "cannot find function, tuple struct or tuple variant `WlanGetAvailableNetworkList` in this scope\nnot found in this scope",
    "source": "rustc",
    "startLineNumber": 47,
    "startColumn": 26,
    "endLineNumber": 47,
    "endColumn": 53
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [11]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "11",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "cannot find value `ERROR_SUCCESS` in this scope\nnot found in this scope",
    "source": "rustc",
    "startLineNumber": 55,
    "startColumn": 26,
    "endLineNumber": 55,
    "endColumn": 39
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [16]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "16",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "no field `dot11Ssid` on type `&_`\nunknown field",
    "source": "rustc",
    "startLineNumber": 63,
    "startColumn": 37,
    "endLineNumber": 63,
    "endColumn": 46
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [17]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "17",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "cannot find function, tuple struct or tuple variant `WlanFreeMemory` in this scope\nnot found in this scope",
    "source": "rustc",
    "startLineNumber": 68,
    "startColumn": 13,
    "endLineNumber": 68,
    "endColumn": 27
},{
    "resource": "/c:/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs",
    "owner": "rustc",
    "code": {
        "value": "Click for full compiler diagnostic",
        "target": {
            "$mid": 1,
            "path": "/diagnostic message [18]",
            "scheme": "rust-analyzer-diagnostics-view",
            "query": "18",
            "fragment": "file:///c%3A/Users/ozhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/model.rs"
        }
    },
    "severity": 8,
    "message": "cannot find function, tuple struct or tuple variant `WlanFreeMemory` in this scope\nnot found in this scope",
    "source": "rustc",
    "startLineNumber": 71,
    "startColumn": 9,
    "endLineNumber": 71,
    "endColumn": 23
}]
ogoffart commented 3 weeks ago

cargo build and then cargo run.

But that worked fine, right?

In the PROBLEMS tab of my IDE VS Code, I got a huge list of errors:

I've never seen that. But it seems like rust-analyzer report errors in the doctest from the dependencies. These can't work because they require dev-dependencies that are not loaded transitively, by design. So this is, i'd say, a bug of rust analyzer that it tries to compile the doctest in dependencies.

ogoffart commented 3 weeks ago

I don't think this is related to a problem in Slint. Looks like a bug in rust-analyzer to me.

6p5ra commented 3 weeks ago

I don't think this is related to a problem in Slint. Looks like a bug in rust-analyzer to me.

Yes, you are absolutely correct. Reinstalling rust on the system fixed the problem. Thanks for the response.