mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-24 12:54:00 +00:00
Do not introduce bindings for types and consts in HRTB.
This commit is contained in:
parent
7fe2c4b00d
commit
4d871a25bf
@ -1981,7 +1981,12 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let res = Res::Def(def_kind, def_id.to_def_id());
|
||||
|
||||
let res = match kind {
|
||||
ItemRibKind(..) | AssocItemRibKind => Res::Def(def_kind, def_id.to_def_id()),
|
||||
NormalRibKind => Res::Err,
|
||||
_ => bug!("Unexpected rib kind {:?}", kind),
|
||||
};
|
||||
self.r.record_partial_res(param.id, PartialRes::new(res));
|
||||
rib.bindings.insert(ident, res);
|
||||
}
|
||||
|
7
src/test/ui/higher-rank-trait-bounds/hrtb-wrong-kind.rs
Normal file
7
src/test/ui/higher-rank-trait-bounds/hrtb-wrong-kind.rs
Normal file
@ -0,0 +1,7 @@
|
||||
fn a() where for<T> T: Copy {}
|
||||
//~^ ERROR only lifetime parameters can be used in this context
|
||||
|
||||
fn b() where for<const C: usize> [(); C]: Copy {}
|
||||
//~^ ERROR only lifetime parameters can be used in this context
|
||||
|
||||
fn main() {}
|
14
src/test/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr
Normal file
14
src/test/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr
Normal file
@ -0,0 +1,14 @@
|
||||
error: only lifetime parameters can be used in this context
|
||||
--> $DIR/hrtb-wrong-kind.rs:1:18
|
||||
|
|
||||
LL | fn a() where for<T> T: Copy {}
|
||||
| ^
|
||||
|
||||
error: only lifetime parameters can be used in this context
|
||||
--> $DIR/hrtb-wrong-kind.rs:4:24
|
||||
|
|
||||
LL | fn b() where for<const C: usize> [(); C]: Copy {}
|
||||
| ^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
Loading…
Reference in New Issue
Block a user