Skip to content

Commit

Permalink
Don't delete any lifetimes with bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
trevyn committed Jan 19, 2024
1 parent 0943a6b commit de2575f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 2 additions & 1 deletion compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2567,8 +2567,9 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
debug!(?param.ident, ?param.ident.span, ?use_span);

let elidable = matches!(use_ctxt, LifetimeCtxt::Ref);
let deletion_span =
if param.bounds.is_empty() { deletion_span() } else { None };

let deletion_span = deletion_span();
self.r.lint_buffer.buffer_lint_with_diagnostic(
lint::builtin::SINGLE_USE_LIFETIMES,
param.id,
Expand Down
5 changes: 0 additions & 5 deletions tests/ui/single-use-lifetime/issue-117965.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ note: the lint level is defined here
|
LL | #![deny(single_use_lifetimes)]
| ^^^^^^^^^^^^^^^^^^^^
help: elide the single-use lifetime
|
LL - pub fn get<'b: 'a>(&'b self) -> &'a str {
LL + pub fn get(&self) -> &'a str {
|

error: aborting due to 1 previous error

0 comments on commit de2575f

Please sign in to comment.