-
Notifications
You must be signed in to change notification settings - Fork 13.4k
don't clone types that are copy, round two. #68459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -400,7 +400,7 @@ pub trait Emitter { | |
} | ||
if sm.span_to_filename(sp_label.span.clone()).is_macros() && !always_backtrace { | ||
if let Some(use_site) = sp_label.span.macro_backtrace().last() { | ||
before_after.push((sp_label.span.clone(), use_site.call_site.clone())); | ||
before_after.push((sp_label.span, use_site.call_site)); | ||
} | ||
} | ||
} | ||
|
@@ -1184,13 +1184,13 @@ impl EmitterWriter { | |
let level_str = level.to_string(); | ||
// The failure note level itself does not provide any useful diagnostic information | ||
if *level != Level::FailureNote && !level_str.is_empty() { | ||
buffer.append(0, &level_str, Style::Level(level.clone())); | ||
buffer.append(0, &level_str, Style::Level(*level)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might want to leave it for another PR but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think at some point |
||
} | ||
// only render error codes, not lint codes | ||
if let Some(DiagnosticId::Error(ref code)) = *code { | ||
buffer.append(0, "[", Style::Level(level.clone())); | ||
buffer.append(0, &code, Style::Level(level.clone())); | ||
buffer.append(0, "]", Style::Level(level.clone())); | ||
buffer.append(0, "[", Style::Level(*level)); | ||
buffer.append(0, &code, Style::Level(*level)); | ||
buffer.append(0, "]", Style::Level(*level)); | ||
} | ||
if *level != Level::FailureNote && !level_str.is_empty() { | ||
buffer.append(0, ": ", header_style); | ||
|
@@ -1495,7 +1495,7 @@ impl EmitterWriter { | |
// Render the suggestion message | ||
let level_str = level.to_string(); | ||
if !level_str.is_empty() { | ||
buffer.append(0, &level_str, Style::Level(level.clone())); | ||
buffer.append(0, &level_str, Style::Level(*level)); | ||
buffer.append(0, ": ", Style::HeaderMsg); | ||
} | ||
self.msg_to_buffer( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -691,7 +691,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { | |
let root_place_projection = self.infcx.tcx.intern_place_elems(root_place.projection); | ||
|
||
if self.access_place_error_reported.contains(&( | ||
Place { local: root_place.local.clone(), projection: root_place_projection }, | ||
Place { local: *root_place.local, projection: root_place_projection }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @matthewjasper Why is there a reference to a |
||
borrow_span, | ||
)) { | ||
debug!( | ||
|
@@ -702,7 +702,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { | |
} | ||
|
||
self.access_place_error_reported.insert(( | ||
Place { local: root_place.local.clone(), projection: root_place_projection }, | ||
Place { local: *root_place.local, projection: root_place_projection }, | ||
borrow_span, | ||
)); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -883,7 +883,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { | |
// Check is_empty() first because it's the common case, and doing that | ||
// way we avoid the clone() call. | ||
if !self.access_place_error_reported.is_empty() | ||
&& self.access_place_error_reported.contains(&(place_span.0.clone(), place_span.1)) | ||
&& self.access_place_error_reported.contains(&(*place_span.0, place_span.1)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @oli-obk @spastorino Maybe we need to consider passing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That doesn't work if there are subslices of the projection involved. We do have a PlaceRef type for exactly that use case though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, except in the cases @oli-obk mentions I'd change most of the uses to take |
||
{ | ||
debug!( | ||
"access_place: suppressing error place_span=`{:?}` kind=`{:?}`", | ||
|
@@ -911,7 +911,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { | |
if conflict_error || mutability_error { | ||
debug!("access_place: logging error place_span=`{:?}` kind=`{:?}`", place_span, kind); | ||
|
||
self.access_place_error_reported.insert((place_span.0.clone(), place_span.1)); | ||
self.access_place_error_reported.insert((*place_span.0, place_span.1)); | ||
} | ||
} | ||
|
||
|
@@ -1011,10 +1011,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { | |
// the 2018 edition so we emit it as a warning. We buffer | ||
// these sepately so that we only emit a warning if borrow | ||
// checking was otherwise successful. | ||
this.reservation_warnings.insert( | ||
bi, | ||
(place_span.0.clone(), place_span.1, location, bk, borrow.clone()), | ||
); | ||
this.reservation_warnings | ||
.insert(bi, (*place_span.0, place_span.1, location, bk, borrow.clone())); | ||
|
||
// Don't suppress actual errors. | ||
Control::Continue | ||
|
Uh oh!
There was an error while loading. Please reload this page.