-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove HIR inlining #49991
Remove HIR inlining #49991
Conversation
Nice, thanks @wesleywiser! I'll take a look as soon as I find the time. |
Looks great, @wesleywiser! Two things I'm wondering:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/librustc_metadata/schema.rs
Outdated
associated_container.hash_stable(hcx, hasher); | ||
qualif.hash_stable(hcx, hasher); | ||
} | ||
} | ||
} | ||
} | ||
|
||
#[derive(RustcEncodable, RustcDecodable)] | ||
pub struct ConstData { | ||
pub rendered: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 👍
src/librustc/ty/maps/mod.rs
Outdated
@@ -254,9 +253,9 @@ define_maps! { <'tcx> | |||
[] 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
// with them. | ||
pub fingerprint: ich::Fingerprint, | ||
} | ||
|
||
#[derive(Clone)] | ||
pub struct ExternBodyNestedBodies { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be removed too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good catch!
src/librustc_metadata/schema.rs
Outdated
@@ -289,7 +289,7 @@ impl_stable_hash_for!(struct Entry<'tcx> { | |||
|
|||
#[derive(Copy, Clone, RustcEncodable, RustcDecodable)] | |||
pub enum EntryKind<'tcx> { | |||
Const(u8), | |||
Const(u8, Lazy<RenderedConst>), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does ast_promotable
mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the behaviour as &&
binds more tightly — was this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that was not intentional. Good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this would be nicer with a match
instead of chained if let
s. @wesleywiser, would you mind making a PR with a fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
@@ -375,14 +373,37 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for EntryKind<'gcx> { | |||
EntryKind::AssociatedType(associated_container) => { | |||
associated_container.hash_stable(hcx, hasher); | |||
} | |||
EntryKind::AssociatedConst(associated_container, qualif) => { | |||
EntryKind::AssociatedConst(associated_container, qualif, _) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ignores the last field, but EntryKind::Const
above doesn't. cc @michaelwoerister
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's wrong. I'll open a PR for that.
@@ -869,6 +871,13 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { | |||
!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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should ideally call mir_const_qualif
itself instead of taking the value as an argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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