Add const generics to the HIR#58503
Conversation
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
14dfb4d to
0b4cd07
Compare
0b4cd07 to
18ce997
Compare
| #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] | ||
| pub struct ConstArg { | ||
| pub value: AnonConst, | ||
| pub span: Span, |
There was a problem hiding this comment.
This span is identical to the span in body of AnonConst, is it viable to use it instead?
Other AnonConsts don't create extra spans during lowering as far as can I see.
There was a problem hiding this comment.
(The whole ConstArg could be refactored away in that case.)
There was a problem hiding this comment.
Ugh, I see GenericArg::span wants to work in isolation without any contexts.
There was a problem hiding this comment.
Yeah, we went through the same thought process when this was implemented. If you can see a way to refactor this, I'd be all ears.
|
LGTM, r=me modulo removing abort / adding lint test (#58503 (comment)). I'll keep @eddyb assigned in case he wants to look. |
|
@bors r=petrochenkov p=1 (Increasing priority because this unblocks other work.) |
|
📌 Commit 727e204 has been approved by |
|
⌛ Testing commit 727e204 with merge 3cdf81e0294cfe7414af2cae07bd3e82d1975058... |
|
@bors retry |
| } | ||
| hir::GenericParamKind::Const { .. } => { | ||
| let def_id = self.tcx.hir().local_def_id(param.id); | ||
| let encode_info = IsolatedEncoder::encode_info_for_const_param; |
There was a problem hiding this comment.
Maybe open an issue about unifying the param encoding in metadata, the same way GenericParamDef has common fields?
Add const generics to the HIR Split out from #53645. cc @yodaldevoid r? @eddyb
|
☀️ Test successful - checks-travis, status-appveyor |
…tor, r=eddyb Refactor generic parameter encoder functions Addresses rust-lang#58503 (comment). r? @eddyb
…tor, r=eddyb Refactor generic parameter encoder functions Addresses rust-lang#58503 (comment). r? @eddyb
Split out from #53645. This work is a collaborative effort with @yodaldevoid.
r? @eddyb