Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2198fae
Make `NonUseContext::AscribeUserTy` carry `ty::Variance`
obeis May 8, 2023
b64e911
Add test.
cjgillot May 10, 2023
d0d4e02
Iteratively replace pointers.
cjgillot May 10, 2023
aeac555
Do not see through copies of mutable pointers.
cjgillot May 10, 2023
9fb1c73
Avoid shadowing.
cjgillot May 10, 2023
a2fe993
Only warn single-use lifetime when the binders match.
cjgillot May 10, 2023
ccd8ad7
Note base types of coercion
compiler-errors May 11, 2023
eadf3bb
Update cargo
heiher May 11, 2023
616fb42
Update browser-ui-test version to 0.16.0
GuillaumeGomez May 10, 2023
0630283
Migrate to 0.16.0 browser-ui-test version
GuillaumeGomez May 10, 2023
8e55400
Convert some GUI tests color checks to use original format
GuillaumeGomez May 11, 2023
cac7e42
Fix backtrace normalization in ice-bug-report-url.rs
uweigand May 10, 2023
3851a4b
Improve error for `self: Box<self>`
clubby789 May 11, 2023
90ce53a
Usage of atomic counters for llvm code coverage
Dushistov May 11, 2023
e1746af
Rollup merge of #111366 - obeis:ascribe-user-type-variance, r=lcnr
matthiaskrgr May 11, 2023
1c5586a
Rollup merge of #111439 - uweigand:backtrace-normalize, r=compiler-er…
matthiaskrgr May 11, 2023
e4444d1
Rollup merge of #111441 - cjgillot:issue-111422, r=JakobDegen
matthiaskrgr May 11, 2023
2651fff
Rollup merge of #111444 - cjgillot:issue-111400, r=oli-obk
matthiaskrgr May 11, 2023
41ab9c8
Rollup merge of #111451 - compiler-errors:note-cast-origin, r=b-naber
matthiaskrgr May 11, 2023
c58dd49
Rollup merge of #111456 - loongarch-rs:bump-cargo, r=weihanglo
matthiaskrgr May 11, 2023
3a5077c
Rollup merge of #111459 - GuillaumeGomez:update-browser-ui-test, r=no…
matthiaskrgr May 11, 2023
ae2f6f2
Rollup merge of #111460 - clubby789:lowercase-box-self, r=compiler-er…
matthiaskrgr May 11, 2023
b203279
Rollup merge of #111469 - Dushistov:fix-coverage-data-race, r=wesleyw…
matthiaskrgr May 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only warn single-use lifetime when the binders match.
  • Loading branch information
cjgillot committed May 10, 2023
commit a2fe9935ea6b2cef2cc9b3aca6d1fee3ae15524b
16 changes: 11 additions & 5 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
if let Some(&(_, res)) = rib.bindings.get(&normalized_ident) {
self.record_lifetime_res(lifetime.id, res, LifetimeElisionCandidate::Named);

if let LifetimeRes::Param { param, .. } = res {
if let LifetimeRes::Param { param, binder } = res {
match self.lifetime_uses.entry(param) {
Entry::Vacant(v) => {
debug!("First use of {:?} at {:?}", res, ident.span);
Expand All @@ -1496,10 +1496,16 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
LifetimeRibKind::Item
| LifetimeRibKind::AnonymousReportError
| LifetimeRibKind::ElisionFailure => Some(LifetimeUseSet::Many),
// An anonymous lifetime is legal here, go ahead.
LifetimeRibKind::AnonymousCreateParameter { .. } => {
Some(LifetimeUseSet::One { use_span: ident.span, use_ctxt })
}
// An anonymous lifetime is legal here, and bound to the right
// place, go ahead.
LifetimeRibKind::AnonymousCreateParameter {
binder: anon_binder,
..
} => Some(if binder == anon_binder {
LifetimeUseSet::One { use_span: ident.span, use_ctxt }
} else {
LifetimeUseSet::Many
}),
// Only report if eliding the lifetime would have the same
// semantics.
LifetimeRibKind::Elided(r) => Some(if res == r {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/associated-inherent-types/issue-109790.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
#![deny(single_use_lifetimes)]

struct Foo<T>(T);

Expand Down