Skip to content

Commit 817d2f2

Browse files
committed
fix(pattern_type_mismatch)): Fix mismatch with ref/deref
1 parent a7d39b8 commit 817d2f2

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

src/debuginfo.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,18 @@ impl<'gcc, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
280280
let pos = span.lo();
281281
let DebugLoc { file, line, col } = self.lookup_debug_loc(pos);
282282
let loc = match file.name {
283-
rustc_span::FileName::Real(ref name) => match name.clone() {
284-
rustc_span::RealFileName::LocalPath(name) => {
283+
rustc_span::FileName::Real(ref name) => match *name {
284+
rustc_span::RealFileName::LocalPath(ref name) => {
285285
if let Some(name) = name.to_str() {
286286
self.context.new_location(name, line as i32, col as i32)
287287
} else {
288288
Location::null()
289289
}
290290
}
291-
rustc_span::RealFileName::Remapped { ref local_path, virtual_name: _unused } => {
291+
rustc_span::RealFileName::Remapped {
292+
ref local_path,
293+
virtual_name: ref _unused,
294+
} => {
292295
if let Some(name) = local_path.as_ref() {
293296
if let Some(name) = name.to_str() {
294297
self.context.new_location(name, line as i32, col as i32)

src/declare.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,19 +181,7 @@ fn declare_raw_fn<'gcc>(
181181
.map(|(index, param)| cx.context.new_parameter(None, *param, format!("param{}", index))) // TODO(antoyo): set name.
182182
.collect();
183183
#[cfg(not(feature = "master"))]
184-
let name = mangle_name(name);
185-
186-
#[cfg(not(feature = "master"))]
187-
let func = cx.context.new_function(
188-
None,
189-
cx.linkage.get(),
190-
return_type,
191-
&params,
192-
name.clone(),
193-
variadic,
194-
);
195-
196-
#[cfg(feature = "master")]
184+
let name = &mangle_name(name);
197185
let func =
198186
cx.context.new_function(None, cx.linkage.get(), return_type, &params, name, variadic);
199187
cx.functions.borrow_mut().insert(name.to_string(), func);

src/intrinsic/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
164164
let tp_ty = fn_args.type_at(0);
165165
let ptr = args[0].immediate();
166166
// The reference was changed to clone to comply to clippy.
167-
let load = if let PassMode::Cast { cast: ty, pad_i32: _ } = fn_abi.ret.mode.clone()
168-
{
167+
let load = if let PassMode::Cast { cast: ref ty, pad_i32: _ } = fn_abi.ret.mode {
169168
let gcc_ty = ty.gcc_type(self);
170169
self.volatile_load(gcc_ty, ptr)
171170
} else {
@@ -386,7 +385,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
386385

387386
if !fn_abi.ret.is_ignore() {
388387
// The reference was changed to clone to comply to clippy.
389-
if let PassMode::Cast { cast: ty, .. } = fn_abi.ret.mode.clone() {
388+
if let PassMode::Cast { cast: ref ty, .. } = fn_abi.ret.mode {
390389
let ptr_llty = self.type_ptr_to(ty.gcc_type(self));
391390
let ptr = self.pointercast(result.llval, ptr_llty);
392391
self.store(llval, ptr, result.align);

0 commit comments

Comments
 (0)