Skip to content

Commit 4e8504a

Browse files
committed
Add lifetime elision to foreign function declarations
fixes rust-lang#35851, fixes rust-lang#43567
1 parent c240751 commit 4e8504a

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/librustc/middle/resolve_lifetime.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,17 +1084,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
10841084
// `fn(...) -> R` and `Trait(...) -> R` (both types and bounds).
10851085
hir::map::NodeTy(_) | hir::map::NodeTraitRef(_) => None,
10861086

1087-
// Foreign `fn` decls are terrible because we messed up,
1088-
// and their return types get argument type elision.
1089-
// And now too much code out there is abusing this rule.
1090-
hir::map::NodeForeignItem(_) => {
1091-
let arg_scope = Scope::Elision {
1092-
elide: arg_elide,
1093-
s: self.scope
1094-
};
1095-
self.with(arg_scope, |_, this| this.visit_ty(output));
1096-
return;
1097-
}
1087+
hir::map::NodeForeignItem(_) => None,
10981088

10991089
// Everything else (only closures?) doesn't
11001090
// actually enjoy elision in return types.

0 commit comments

Comments
 (0)