のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

Error: ファイルが見つかりません "c:\rustc\4560ea788cb760f0a34127156c78e2552949f734\src\libstd\rt.rs"

c:\rustc...\src\libstd\rt.rsが開けないらしい。

'rt.rs' を開くことができません: ファイル (Error: ファイルが見つかりません (c:\rustc\4560ea788cb760f0a34127156c78e2552949f734\src\libstd\rt.rs)) を読み取ることができません。

以下の設定を、lauch.jsonへ追加したところ、治った。

"sourceFileMap": {
    "/rustc/4560ea788cb760f0a34127156c78e2552949f734": 
    "${env:HOME}${env:USERPROFILE}\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust"
            }

情報元は、以下のページです。 github.com

vsCode Cannot find or open the PDB file.

-------------------------------------------------------------------
You may only use the C/C++ Extension for Visual Studio Code with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
Loaded 'C:\Users\m_fuj\Documents\GitHub\progrust\ch02\target\debug\ch02.exe'. Symbols loaded.
Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\ucrtbase.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\vcruntime140.dll'. Cannot find or open the PDB file.
The thread 12804 has exited with code 0 (0x0).
Usage gcd Number ...
The thread 7044 has exited with code 1 (0x1).
The thread 4608 has exited with code 1 (0x1).
The program '[14288] ch02.exe' has exited with code 1 (0x1).

前)

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(Windows) 起動",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "${workspaceFolder}/target/debug/ch02",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false
        }
    ]
}

以下を追加すると、ワーニングは消える。

           "logging": {
                "moduleLoad": false
            }

後)

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(Windows) 起動",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "${workspaceFolder}/target/debug/ch02",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "logging": {
                "moduleLoad": false
            }
        }
    ]
}
-------------------------------------------------------------------
You may only use the C/C++ Extension for Visual Studio Code with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
The thread 11280 has exited with code 0 (0x0).
Usage gcd Number ...
The thread 3004 has exited with code 1 (0x1).
The thread 11964 has exited with code 1 (0x1).
The program '[9280] ch02.exe' has exited with code 1 (0x1).

情報元は、以下の場所: stackoverflow.com

expected &{integer}, found integer

assert_eq!(m1.get("b"), Some(&3));
 ✕   assert_eq!(m1.get("b"), Some(3));
 ✕   assert_eq!(m1.get("b"), &3);
 ✕   assert_eq!(m1.get("b"), 3);
 〇   assert_eq!(m1.get("c"), None);
PS > cargo run --example ch05_04_hash_map    
   Compiling ex05 v0.1.0 (\rustbook\ch05\ex05)
error[E0308]: mismatched types                                                                       
  --> examples\ch05_04_hash_map.rs:11:5
   |
11 |      assert_eq!(m1.get("b"), Some(3));
   |     ^^^^^^^^^^^^^^^^^^^^^^ 
   |     expected &{integer}, found integer
   |
   = note: expected type `std::option::Option<&{integer}>`
              found type `std::option::Option<{integer}>`
error[E0308]: mismatched types
  --> examples\ch05_04_hash_map.rs:12:5
   |
12 |     assert_eq!(m1.get("b"), &3);
   |    ^^^^^^^^^^^^^^^^^^^
   |     expected enum `std::option::Option`, found &{integer}
   |     help: try using a variant of the expected type: `Some(*right_val)`
   |
   = note: expected type `std::option::Option<&{integer}>`
              found type `&{integer}`
error[E0308]: mismatched types
  --> examples\ch05_04_hash_map.rs:13:5
   |
13 |     assert_eq!(m1.get("b"), 3);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
   |     expected enum `std::option::Option`, found integer
   |
   = note: expected type `std::option::Option<&{integer}>`
              found type `{integer}`

教科書は、

実践Rust入門[言語仕様から開発手法まで]

実践Rust入門[言語仕様から開発手法まで]