summaryrefslogtreecommitdiffstats
path: root/vendor/gimli/src/write
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:43 +0000
commit3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 (patch)
treedaf049b282ab10e8c3d03e409b3cd84ff3f7690c /vendor/gimli/src/write
parentAdding debian version 1.68.2+dfsg1-1. (diff)
downloadrustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.tar.xz
rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.zip
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gimli/src/write')
-rw-r--r--vendor/gimli/src/write/line.rs5
-rw-r--r--vendor/gimli/src/write/loc.rs3
-rw-r--r--vendor/gimli/src/write/op.rs15
-rw-r--r--vendor/gimli/src/write/range.rs3
-rw-r--r--vendor/gimli/src/write/section.rs2
-rw-r--r--vendor/gimli/src/write/unit.rs17
-rw-r--r--vendor/gimli/src/write/writer.rs5
7 files changed, 18 insertions, 32 deletions
diff --git a/vendor/gimli/src/write/line.rs b/vendor/gimli/src/write/line.rs
index 310170d9a..c88b735bc 100644
--- a/vendor/gimli/src/write/line.rs
+++ b/vendor/gimli/src/write/line.rs
@@ -94,8 +94,6 @@ impl LineProgram {
/// Panics if `comp_dir` is empty or contains a null byte.
///
/// Panics if `comp_file` is empty or contains a null byte.
- #[allow(clippy::too_many_arguments)]
- #[allow(clippy::new_ret_no_self)]
pub fn new(
encoding: Encoding,
line_encoding: LineEncoding,
@@ -261,7 +259,7 @@ impl LineProgram {
} else {
let entry = self.files.entry(key);
let index = entry.index();
- entry.or_insert(FileInfo::default());
+ entry.or_default();
index
};
FileId::new(index)
@@ -1723,7 +1721,6 @@ mod tests {
// Test that the address/line advance is correct. We don't test for optimality.
#[test]
- #[allow(clippy::useless_vec)]
fn test_advance() {
let encoding = Encoding {
format: Format::Dwarf32,
diff --git a/vendor/gimli/src/write/loc.rs b/vendor/gimli/src/write/loc.rs
index ea0ecb1cf..6dfe45a6c 100644
--- a/vendor/gimli/src/write/loc.rs
+++ b/vendor/gimli/src/write/loc.rs
@@ -436,6 +436,7 @@ mod tests {
};
use crate::LittleEndian;
use std::collections::HashMap;
+ use std::sync::Arc;
#[test]
fn test_loc_list() {
@@ -508,7 +509,7 @@ mod tests {
DebugInfoOffset(0).into(),
read::EndianSlice::default(),
),
- abbreviations: read::Abbreviations::default(),
+ abbreviations: Arc::new(read::Abbreviations::default()),
name: None,
comp_dir: None,
low_pc: 0,
diff --git a/vendor/gimli/src/write/op.rs b/vendor/gimli/src/write/op.rs
index c70eec2dd..287083b3e 100644
--- a/vendor/gimli/src/write/op.rs
+++ b/vendor/gimli/src/write/op.rs
@@ -279,12 +279,8 @@ impl Expression {
}
offsets.push(offset);
for (operation, offset) in self.operations.iter().zip(offsets.iter().copied()) {
- let refs = match refs {
- Some(ref mut refs) => Some(&mut **refs),
- None => None,
- };
debug_assert_eq!(w.len(), offset);
- operation.write(w, refs, encoding, unit_offsets, &offsets)?;
+ operation.write(w, refs.as_deref_mut(), encoding, unit_offsets, &offsets)?;
}
Ok(())
}
@@ -630,7 +626,7 @@ impl Operation {
}
w.write_uleb128(entry_offset(base)?)?;
w.write_udata(value.len() as u64, 1)?;
- w.write(&value)?;
+ w.write(value)?;
}
Operation::FrameOffset(offset) => {
w.write_u8(constants::DW_OP_fbreg.0)?;
@@ -770,7 +766,7 @@ impl Operation {
Operation::ImplicitValue(ref data) => {
w.write_u8(constants::DW_OP_implicit_value.0)?;
w.write_uleb128(data.len() as u64)?;
- w.write(&data)?;
+ w.write(data)?;
}
Operation::ImplicitPointer { entry, byte_offset } => {
if encoding.version >= 5 {
@@ -872,7 +868,7 @@ pub(crate) mod convert {
let mut offsets = Vec::new();
let mut offset = 0;
let mut from_operations = from_expression.clone().operations(encoding);
- while let Some(_) = from_operations.next()? {
+ while from_operations.next()?.is_some() {
offsets.push(offset);
offset = from_operations.offset_from(&from_expression);
}
@@ -1071,6 +1067,7 @@ mod tests {
};
use crate::LittleEndian;
use std::collections::HashMap;
+ use std::sync::Arc;
#[test]
fn test_operation() {
@@ -1578,7 +1575,7 @@ mod tests {
DebugInfoOffset(0).into(),
read::EndianSlice::new(&[], LittleEndian),
),
- abbreviations: read::Abbreviations::default(),
+ abbreviations: Arc::new(read::Abbreviations::default()),
name: None,
comp_dir: None,
low_pc: 0,
diff --git a/vendor/gimli/src/write/range.rs b/vendor/gimli/src/write/range.rs
index b44ce1b7b..c707e1eab 100644
--- a/vendor/gimli/src/write/range.rs
+++ b/vendor/gimli/src/write/range.rs
@@ -315,6 +315,7 @@ mod tests {
};
use crate::LittleEndian;
use std::collections::HashMap;
+ use std::sync::Arc;
#[test]
fn test_range() {
@@ -375,7 +376,7 @@ mod tests {
DebugInfoOffset(0).into(),
read::EndianSlice::default(),
),
- abbreviations: read::Abbreviations::default(),
+ abbreviations: Arc::new(read::Abbreviations::default()),
name: None,
comp_dir: None,
low_pc: 0,
diff --git a/vendor/gimli/src/write/section.rs b/vendor/gimli/src/write/section.rs
index e8f3378cd..db5eb9a28 100644
--- a/vendor/gimli/src/write/section.rs
+++ b/vendor/gimli/src/write/section.rs
@@ -111,7 +111,7 @@ impl<W: Writer + Clone> Sections<W> {
debug_loclists: DebugLocLists(section.clone()),
debug_str: DebugStr(section.clone()),
debug_frame: DebugFrame(section.clone()),
- eh_frame: EhFrame(section.clone()),
+ eh_frame: EhFrame(section),
debug_info_refs: Vec::new(),
debug_loc_refs: Vec::new(),
debug_loclists_refs: Vec::new(),
diff --git a/vendor/gimli/src/write/unit.rs b/vendor/gimli/src/write/unit.rs
index bf85ff421..23027bc2c 100644
--- a/vendor/gimli/src/write/unit.rs
+++ b/vendor/gimli/src/write/unit.rs
@@ -365,7 +365,6 @@ impl Unit {
&mut unit_refs,
self,
&mut offsets,
- abbrevs,
line_program,
line_strings,
strings,
@@ -605,7 +604,6 @@ impl DebuggingInformationEntry {
}
/// Write the entry to the given sections.
- #[allow(clippy::too_many_arguments)]
fn write<W: Writer>(
&self,
w: &mut DebugInfo<W>,
@@ -613,7 +611,6 @@ impl DebuggingInformationEntry {
unit_refs: &mut Vec<(DebugInfoOffset, UnitEntryId)>,
unit: &Unit,
offsets: &mut UnitOffsets,
- abbrevs: &mut AbbreviationTable,
line_program: Option<DebugLineOffset>,
line_strings: &DebugLineStrOffsets,
strings: &DebugStrOffsets,
@@ -654,7 +651,6 @@ impl DebuggingInformationEntry {
unit_refs,
unit,
offsets,
- abbrevs,
line_program,
line_strings,
strings,
@@ -1128,7 +1124,6 @@ impl AttributeValue {
}
/// Write the attribute value to the given sections.
- #[allow(clippy::cyclomatic_complexity, clippy::too_many_arguments)]
fn write<W: Writer>(
&self,
w: &mut DebugInfo<W>,
@@ -1155,7 +1150,7 @@ impl AttributeValue {
AttributeValue::Block(ref val) => {
debug_assert_form!(constants::DW_FORM_block);
w.write_uleb128(val.len() as u64)?;
- w.write(&val)?;
+ w.write(val)?;
}
AttributeValue::Data1(val) => {
debug_assert_form!(constants::DW_FORM_data1);
@@ -1308,7 +1303,7 @@ impl AttributeValue {
}
AttributeValue::String(ref val) => {
debug_assert_form!(constants::DW_FORM_string);
- w.write(&val)?;
+ w.write(val)?;
w.write_u8(0)?;
}
AttributeValue::Encoding(val) => {
@@ -1558,7 +1553,6 @@ pub(crate) mod convert {
/// Create a unit by reading the data in the input sections.
///
/// Does not add entry attributes.
- #[allow(clippy::too_many_arguments)]
pub(crate) fn convert_entries<R: Reader<Offset = usize>>(
from_header: read::UnitHeader<R>,
unit_id: UnitId,
@@ -1931,9 +1925,9 @@ mod tests {
use crate::LittleEndian;
use std::collections::HashMap;
use std::mem;
+ use std::sync::Arc;
#[test]
- #[allow(clippy::cyclomatic_complexity)]
fn test_unit_table() {
let mut strings = StringTable::default();
@@ -2542,7 +2536,7 @@ mod tests {
let unit = read::Unit {
header: from_unit,
- abbreviations: read::Abbreviations::default(),
+ abbreviations: Arc::new(read::Abbreviations::default()),
name: None,
comp_dir: None,
low_pc: 0,
@@ -2578,7 +2572,6 @@ mod tests {
}
#[test]
- #[allow(clippy::cyclomatic_complexity)]
fn test_unit_ref() {
let mut units = UnitTable::default();
let unit_id1 = units.add(Unit::new(
@@ -3015,7 +3008,7 @@ mod tests {
let unit = read::Unit {
header: from_unit,
- abbreviations: read::Abbreviations::default(),
+ abbreviations: Arc::new(read::Abbreviations::default()),
name: None,
comp_dir: None,
low_pc: 0,
diff --git a/vendor/gimli/src/write/writer.rs b/vendor/gimli/src/write/writer.rs
index 0785d1686..1ce3641fc 100644
--- a/vendor/gimli/src/write/writer.rs
+++ b/vendor/gimli/src/write/writer.rs
@@ -93,9 +93,7 @@ pub trait Writer {
constants::DW_EH_PE_sdata2 => self.write_sdata(val as i64, 2),
constants::DW_EH_PE_sdata4 => self.write_sdata(val as i64, 4),
constants::DW_EH_PE_sdata8 => self.write_sdata(val as i64, 8),
- _ => {
- return Err(Error::UnsupportedPointerEncoding(format));
- }
+ _ => Err(Error::UnsupportedPointerEncoding(format)),
}
}
@@ -334,7 +332,6 @@ mod tests {
use std::{i64, u64};
#[test]
- #[allow(clippy::cyclomatic_complexity)]
fn test_writer() {
let mut w = write::EndianVec::new(LittleEndian);
w.write_address(Address::Constant(0x1122_3344), 4).unwrap();