also reset anon-param-mode for fn()
types
This commit is contained in:
parent
9acb351f57
commit
da69bbce68
2 changed files with 41 additions and 11 deletions
|
@ -1033,17 +1033,22 @@ impl<'a> LoweringContext<'a> {
|
|||
_ => None,
|
||||
}),
|
||||
|this| {
|
||||
hir::TyBareFn(P(hir::BareFnTy {
|
||||
generic_params: this.lower_generic_params(
|
||||
&f.generic_params,
|
||||
&NodeMap(),
|
||||
ImplTraitContext::Disallowed,
|
||||
),
|
||||
unsafety: this.lower_unsafety(f.unsafety),
|
||||
abi: f.abi,
|
||||
decl: this.lower_fn_decl(&f.decl, None, false),
|
||||
arg_names: this.lower_fn_args_to_names(&f.decl),
|
||||
}))
|
||||
this.with_anonymous_lifetime_mode(
|
||||
AnonymousLifetimeMode::PassThrough,
|
||||
|this| {
|
||||
hir::TyBareFn(P(hir::BareFnTy {
|
||||
generic_params: this.lower_generic_params(
|
||||
&f.generic_params,
|
||||
&NodeMap(),
|
||||
ImplTraitContext::Disallowed,
|
||||
),
|
||||
unsafety: this.lower_unsafety(f.unsafety),
|
||||
abi: f.abi,
|
||||
decl: this.lower_fn_decl(&f.decl, None, false),
|
||||
arg_names: this.lower_fn_args_to_names(&f.decl),
|
||||
}))
|
||||
},
|
||||
)
|
||||
},
|
||||
),
|
||||
TyKind::Never => hir::TyNever,
|
||||
|
|
25
src/test/ui/rust-2018/issue-51008-1.rs
Normal file
25
src/test/ui/rust-2018/issue-51008-1.rs
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Regression test for #51008 -- the anonymous lifetime in `&i32` was
|
||||
// being incorrectly considered part of the "elided lifetimes" from
|
||||
// the impl.
|
||||
//
|
||||
// run-pass
|
||||
|
||||
#![feature(rust_2018_preview)]
|
||||
|
||||
trait A {
|
||||
|
||||
}
|
||||
|
||||
impl<F> A for F where F: PartialEq<fn(&i32)> { }
|
||||
|
||||
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue