Diagnostic and cause
링크Assignment to imported binding
- 계열
- topaz
- 단계
- resolve
- 코드
TPZ3015
원인과 조건
Assigning to a selected import binding produces TPZ3015.
관련 규칙 · Trigger and repair →대응
Copy the value into your own let mut binding, or call an operation exported by the producing module.
Compiler phase: resolve.
Compiler explanation: The program attempts to assign to a binding imported from another module.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
⟨value⟩is an imported binding and cannot be assigned Source⟨value⟩.is an exported binding viewed through a namespace and cannot be assigned Source⟨value⟩
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ3015]:
valueis an imported binding and cannot be assigned
The assignment targets a name introduced by a selected import. Importing a binding does not make it mutable in the importing module.
Trigger and repair
Assigning to a selected import binding produces TPZ3015.
Response
링크Copy the value into your own let mut binding, or call an operation exported by the producing module.
Reproduction and verification
링크Rejected program
링크import lib { value }value = 2
표준 출력 없음.export let value = 1
기대 결과
The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.
Corrected program
링크import lib { value }let mut localValue = valuelocalValue = 2
export let value = 1
기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
This program applies the repair described above. The verification status records whether it has been run.