Conversation
|
Nice, thanks @wesleywiser! I'll take a look as soon as I find the time. |
|
Looks great, @wesleywiser! Two things I'm wondering:
|
src/librustc_metadata/schema.rs
Outdated
|
|
||
| #[derive(RustcEncodable, RustcDecodable)] | ||
| pub struct ConstData { | ||
| pub rendered: String, |
There was a problem hiding this comment.
Is this expected to gain more fields? If no, how about making t a newtype called RenderedConst?
Also 🚨documentation police🚨 please add some docs
There was a problem hiding this comment.
I'm not aware of any additional data we need at this time. I'd be happy to change it and I'll add some docs too 👍
| [] fn item_attrs: ItemAttrs(DefId) -> Lrc<[ast::Attribute]>, | ||
| [] fn trans_fn_attrs: trans_fn_attrs(DefId) -> TransFnAttrs, | ||
| [] fn fn_arg_names: FnArgNames(DefId) -> Vec<ast::Name>, | ||
| [] fn rendered_const: RenderedConst(DefId) -> String, |
There was a problem hiding this comment.
I know this is essentially self explanatory. Still, a short doc comment would be awesome
I don't believe so. I was unable to find a failing test case for statics and all of the existing rustdoc tests pass after handling
I think I ran into some issues when I tried that but I don't remember clearly. I will investigate that tonight. |
|
@bors try |
Remove HIR inlining Fixes #49690 r? @michaelwoerister
|
|
|
☀️ Test successful - status-travis |
26b3203 to
fee5c82
Compare
|
Added docs & newtype wrapper. |
👍
You might be able to remove the metadata-based version of the |
|
☔ The latest upstream changes (presumably #49882) made this pull request unmergeable. Please resolve the merge conflicts. |
|
You'd need to move the |
src/librustc/middle/cstore.rs
Outdated
src/librustc_metadata/schema.rs
Outdated
There was a problem hiding this comment.
You could replace the u8 here and in AssociatedConst with a struct ConstQualif { mir: u8, ast_promotable: bool }.
There was a problem hiding this comment.
What does ast_promotable mean?
There was a problem hiding this comment.
The rvalue_promotable_to_static: bool field that's currently in Ast.
fee5c82 to
4a77d35
Compare
|
Implemented feedback & rebased. |
|
Thanks a lot, @wesleywiser! Very pleasing to see this go @bors r+ |
|
📌 Commit 4a77d35 has been approved by |
…ister Remove HIR inlining Fixes #49690 r? @michaelwoerister
|
☀️ Test successful - status-appveyor, status-travis |
| } else if let hir::ImplItemKind::Method(ref sig, _) = ast_item.node { | ||
| let generics = self.tcx.generics_of(def_id); | ||
| let types = generics.parent_types as usize + generics.types.len(); | ||
| let needs_inline = types > 0 || tcx.trans_fn_attrs(def_id).requests_inline() && |
There was a problem hiding this comment.
This changes the behaviour as && binds more tightly — was this intentional?
There was a problem hiding this comment.
No, that was not intentional. Good catch!
There was a problem hiding this comment.
Also, this would be nicer with a match instead of chained if lets. @wesleywiser, would you mind making a PR with a fix?
There was a problem hiding this comment.
Yeah, looks like I messed this up when I pulled the latest changes into my branch. I've opened a quick PR that fixes this (#50114). I'll send a follow up tonight that uses a match for this instead.
When I rebased rust-lang#49991 on `master`, I messed up the merge for this line. I'm reverting this back to the way it was in f15e5c1.
…ster Fix bad merge in rust-lang#49991 When I rebased rust-lang#49991 on `master`, I messed up the merge for this line. I'm reverting this back to the way it was in f15e5c1. r? @michaelwoerister
Rollup of 7 pull requests Successful merges: - #50031 (Clarified E0015 message.) - #50058 (Added build disk usage information) - #50081 (Update stdsimd submodule) - #50083 (wasm: Increase default stack size to 1MB) - #50104 (Disable auto-detection of libxml2 when compiling llvm.) - #50114 (Fix bad merge in #49991) - #50117 (must explicitly request file name when using with_file_name.) Failed merges:
Clean up `IsolatedEncoder::encode_info_for_impl_item()` a bit Suggested in the [comments of #49991](https://github.com/rust-lang/rust/pull/49991/files/4a77d35c1ed89310a0ed128ce931cd4b85ca4cd4#r183048939)
| associated_container.hash_stable(hcx, hasher); | ||
| } | ||
| EntryKind::AssociatedConst(associated_container, qualif) => { | ||
| EntryKind::AssociatedConst(associated_container, qualif, _) => { |
There was a problem hiding this comment.
This ignores the last field, but EntryKind::Const above doesn't. cc @michaelwoerister
There was a problem hiding this comment.
Yeah, that's wrong. I'll open a PR for that.
| !self.tcx.sess.opts.output_types.should_trans() | ||
| } | ||
|
|
||
| fn const_qualif(&self, mir: u8, body_id: hir::BodyId) -> ConstQualif { |
There was a problem hiding this comment.
This should ideally call mir_const_qualif itself instead of taking the value as an argument.
There was a problem hiding this comment.
I didn't do that because of this call https://github.com/rust-lang/rust/pull/49991/files/4a77d35c1ed89310a0ed128ce931cd4b85ca4cd4#diff-f55f5d2e86bc0e08c341b51fc78b27e4R796
There was a problem hiding this comment.
Why would that keep the AST promotability but not the MIR one? I think you just never need either for trait associated consts.
Hash EntryKind::AssociatedConst const data Related to rust-lang#49991 r? @michaelwoerister cc @eddyb
Fixes #49690
r? @michaelwoerister