Skip to content
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

Rollup of 7 pull requests #89959

Closed
wants to merge 19 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a333b91
linux/aarch64 Now() should be actually_monotonic()
AGSaidi Sep 4, 2021
50433a0
polymorphize: don't check foreign items
davidtwco Oct 1, 2021
da2b69b
polymorphize: remove predicate logic
davidtwco Aug 20, 2020
4528b8e
collector: limit pme context note to user-defd fns
davidtwco Oct 1, 2021
76b0553
polymorphize: polymorphize shims
davidtwco Oct 1, 2021
e41bb97
Add `#[repr(i8)]` to `Ordering`
lopopolo Oct 4, 2021
b39e915
polymorphize: don't normalize self-ty need substs
davidtwco Oct 4, 2021
c801593
Add support for specifying multiple clobber_abi in `asm!`
asquared31415 Oct 14, 2021
00dba3a
Make Option::as_mut const
lilasta Oct 16, 2021
d1f7608
Add `#![cfg_attr(bootstrap, feature(const_panic))]` to `library/core/…
lilasta Oct 16, 2021
c645d3f
clippy::complexity changes
matthiaskrgr Oct 16, 2021
7bad85e
Remove FIXME since there is nothing to be fixed.
GuillaumeGomez Oct 15, 2021
3a0c007
Rollup merge of #88652 - AGSaidi:linux-aarch64-should-be-actually-mon…
GuillaumeGomez Oct 16, 2021
7d6edd6
Rollup merge of #89316 - asquared31415:multiple-clobber-abi, r=Amanieu
GuillaumeGomez Oct 16, 2021
a3b902a
Rollup merge of #89507 - lopopolo:lopopolo/ordering-repr-i8, r=joshtr…
GuillaumeGomez Oct 16, 2021
2a8efc4
Rollup merge of #89514 - davidtwco:polymorphize-shims-and-predicates,…
GuillaumeGomez Oct 16, 2021
4163a39
Rollup merge of #89907 - GuillaumeGomez:correctly-emit-errors, r=camelid
GuillaumeGomez Oct 16, 2021
37ccfa9
Rollup merge of #89943 - matthiaskrgr:clpcompl, r=oli-obk
GuillaumeGomez Oct 16, 2021
f3dd8ef
Rollup merge of #89953 - woppopo:option_const_as_mut, r=oli-obk
GuillaumeGomez Oct 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
collector: limit pme context note to user-defd fns
rustc adds notes to errors which happen post-monomorphization to
provide the user with helpful context (as these errors may rely on the
specific instantiations). To prevent this note being added where it is
not appropriate, the node is checked to originate outwith the current
crate. However, when polymorphization is enabled, this can result in
some errors (produced by `optimized_mir`) to occur earlier in
compilation than they normally would, during the collection of shims.
Some shims have ids that originate in the standard library, but these
should not receive the PME note, so instances for compiler-generated
functions no longer receive this note.

Signed-off-by: David Wood <[email protected]>
davidtwco committed Oct 1, 2021
commit 4528b8e581eb1bb24f4f264d43244d7912f812f7
8 changes: 8 additions & 0 deletions compiler/rustc_middle/src/mir/mono.rs
Original file line number Diff line number Diff line change
@@ -47,6 +47,14 @@ pub enum MonoItem<'tcx> {
}

impl<'tcx> MonoItem<'tcx> {
/// Returns `true` if the mono item is user-defined (i.e. not compiler-generated, like shims).
pub fn is_user_defined(&self) -> bool {
match *self {
MonoItem::Fn(instance) => matches!(instance.def, InstanceDef::Item(..)),
MonoItem::Static(..) | MonoItem::GlobalAsm(..) => true,
}
}

pub fn size_estimate(&self, tcx: TyCtxt<'tcx>) -> usize {
match *self {
MonoItem::Fn(instance) => {
4 changes: 3 additions & 1 deletion compiler/rustc_monomorphize/src/collector.rs
Original file line number Diff line number Diff line change
@@ -450,7 +450,9 @@ fn collect_items_rec<'tcx>(
// involving a dependency, and the lack of context is confusing) in this MVP, we focus on
// diagnostics on edges crossing a crate boundary: the collected mono items which are not
// defined in the local crate.
if tcx.sess.diagnostic().err_count() > error_count && starting_point.node.krate() != LOCAL_CRATE
if tcx.sess.diagnostic().err_count() > error_count
&& starting_point.node.krate() != LOCAL_CRATE
&& starting_point.node.is_user_defined()
{
let formatted_item = with_no_trimmed_paths(|| starting_point.node.to_string());
tcx.sess.span_note_without_error(