diff options
| author | Josh Triplett <josh@joshtriplett.org> | 2025-01-07 14:12:07 +0200 |
|---|---|---|
| committer | Josh Triplett <josh@joshtriplett.org> | 2025-01-07 14:30:02 +0200 |
| commit | bb6bbfa13f97e6ef30ecd63c835c99cf7762bd6e (patch) | |
| tree | 72903e70f117fddc546a875d4fff4285c11c00d1 /compiler/rustc_const_eval/src/interpret/operand.rs | |
| parent | fb546ee09b226bc4dd4b712d35a372d923c4fa54 (diff) | |
| download | rust-bb6bbfa13f97e6ef30ecd63c835c99cf7762bd6e.tar.gz rust-bb6bbfa13f97e6ef30ecd63c835c99cf7762bd6e.zip | |
Avoid naming variables `str`
This renames variables named `str` to other names, to make sure `str` always refers to a type. It's confusing to read code where `str` (or another standard type name) is used as an identifier. It also produces misleading syntax highlighting.
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret/operand.rs')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/operand.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs index b861ffb6110..5d905cff1f2 100644 --- a/compiler/rustc_const_eval/src/interpret/operand.rs +++ b/compiler/rustc_const_eval/src/interpret/operand.rs @@ -704,8 +704,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { pub fn read_str(&self, mplace: &MPlaceTy<'tcx, M::Provenance>) -> InterpResult<'tcx, &str> { let len = mplace.len(self)?; let bytes = self.read_bytes_ptr_strip_provenance(mplace.ptr(), Size::from_bytes(len))?; - let str = std::str::from_utf8(bytes).map_err(|err| err_ub!(InvalidStr(err)))?; - interp_ok(str) + let s = std::str::from_utf8(bytes).map_err(|err| err_ub!(InvalidStr(err)))?; + interp_ok(s) } /// Read from a local of the current frame. Convenience method for [`InterpCx::local_at_frame_to_op`]. |
