Commit Graph

3332 Commits

Author SHA1 Message Date
Tomasz Miąsko
83dc7fe669 Inline trivial implementation of rustc_target::abi::Align 2021-01-27 16:13:18 +01:00
bors
742c972c4f Auto merge of #79591 - estebank:unexpected-generics, r=oli-obk
Point only at generic arguments when they are unexpected
2021-01-27 07:15:33 +00:00
bors
78e22069d0 Auto merge of #81393 - pnkfelix:issue-81296-make-weak-item-traversal-deterministic, r=estebank
Make weak item traversal deterministic

Fix #81296.

(No test added. The relevant test *is* ui/panic-handler/weak-lang-item.rs, and this change should make it less flaky.)
2021-01-27 00:19:45 +00:00
Esteban Küber
2e846d6f61 Point only at generic arguments when they are unexpected 2021-01-26 15:59:43 -08:00
Yuki Okushi
d68570c78f
Rollup merge of #81407 - osa1:issue81098, r=estebank
Refine "remove semicolon" suggestion in trait selection

Don't suggest it if the last statement doesn't have a semicolon

Fixes #81098

See also #54771 for why this suggestion was added
2021-01-27 04:43:35 +09:00
Yuki Okushi
acbd1010ef
Rollup merge of #81369 - tgnottingham:codegen-to-llvm-ir-wall-time, r=lcnr
rustc_codegen_ssa: use wall time for codegen_to_LLVM_IR time-passes entry

Use elapsed wall time spent on codegen_to_LLVM_IR for all CGUs as a
whole, rather than the sum for each CGU (the distinction matters for
parallel builds, where some CGUs are processed in parallel).
2021-01-27 04:43:28 +09:00
Yuki Okushi
3741844711
Rollup merge of #81353 - jockbert:spelling_in_e0207, r=petrochenkov
Fix spelling in documentation for error E0207

I have trouble parsing the the wording "type parameter parameter".
2021-01-27 04:43:25 +09:00
Yuki Okushi
71f13fb434
Rollup merge of #81325 - osa1:issue81293, r=estebank
typeck: Don't suggest converting LHS exprs

Converting LHS of an assignment does not work, so avoid suggesting that.

Fixes #81293
2021-01-27 04:43:24 +09:00
Yuki Okushi
644df2fd23
Rollup merge of #81195 - estebank:suggest-bound-on-trait-with-params, r=oli-obk
Account for generics when suggesting bound

Fix #81175.
2021-01-27 04:43:20 +09:00
Yuki Okushi
c2c90bf548
Rollup merge of #80900 - camelid:readpointerasbytes-ice, r=oli-obk
Fix ICE with `ReadPointerAsBytes` validation error

Fixes #79690.

r? ``````@oli-obk``````
2021-01-27 04:43:16 +09:00
Ömer Sinan Ağacan
8ddc1c83f2 Refine "remove semicolon" suggestion in trait selection
Don't suggest it if the last statement doesn't have a semicolon

Fixes #81098

See also #54771 for why this suggestion was added
2021-01-26 13:23:30 +03:00
Ömer Sinan Ağacan
d035be8e6f typeck: Don't suggest converting LHS exprs
Converting LHS of an assignment does not work, so avoid suggesting that.

Fixes #81293
2021-01-26 09:09:15 +03:00
bors
a8f7075532 Auto merge of #80692 - Aaron1011:feature/query-result-debug, r=estebank
Enforce that query results implement Debug

Currently, we require that query keys implement `Debug`, but we do not do the same for query values. This can make incremental compilation bugs difficult to debug - there isn't a good place to print out the result loaded from disk.

This PR adds `Debug` bounds to several query-related functions, allowing us to debug-print the query value when an 'unstable fingerprint' error occurs. This required adding `#[derive(Debug)]` to a fairly large number of types - hopefully, this doesn't have much of an impact on compiler bootstrapping times.
2021-01-26 05:47:23 +00:00
Felix S. Klock II
4c5ede7c6a This should address issue 81294.
(No test added. The relevant test *is* ui/panic-handler/weak-lang-item.rs, and this change should make it less flaky.)
2021-01-25 14:37:27 -05:00
bors
f4eb5d9f71 Auto merge of #68828 - oli-obk:inline_cycle, r=wesleywiser
Prevent query cycles in the MIR inliner

r? `@eddyb` `@wesleywiser`

cc `@rust-lang/wg-mir-opt`

The general design is that we have a new query that is run on the `validated_mir` instead of on the `optimized_mir`. That query is forced before going into the optimization pipeline, so as to not try to read from a stolen MIR.

The query should not be cached cross crate, as you should never call it for items from other crates. By its very design calls into other crates can never cause query cycles.

This is a pessimistic approach to inlining, since we strictly have more calls in the `validated_mir` than we have in `optimized_mir`, but that's not a problem imo.
2021-01-25 19:03:37 +00:00
Esteban Küber
088c89d9ff Account for generics when suggesting bound
Fix #81175.
2021-01-24 23:16:50 -08:00
Tyson Nottingham
59195a2772 rustc_codegen_ssa: use wall time for codegen_to_LLVM_IR time-passes entry
Use elapsed wall time spent on codegen_to_LLVM_IR for all CGUs as a
whole, rather than the sum for each CGU (the distinction matters for
parallel builds, where some CGUs are processed in parallel).
2021-01-24 21:27:41 -08:00
bors
d3163e9655 Auto merge of #81355 - jonas-schievink:rollup-vpaadij, r=jonas-schievink
Rollup of 14 pull requests

Successful merges:

 - #75180 (Implement Error for &(impl Error))
 - #78578 (Permit mutable references in all const contexts)
 - #79174 (Make std::future a re-export of core::future)
 - #79884 (Replace magic numbers with existing constants)
 - #80855 (Expand assert!(expr, args..) to include $crate for hygiene on 2021.)
 - #80933 (Fix sysroot option not being honored across rustc)
 - #81259 (Replace version_check dependency with own version parsing code)
 - #81264 (Add unstable option to control doctest run directory)
 - #81279 (Small refactor in typeck)
 - #81297 (Don't provide backend_optimization_level query for extern crates)
 - #81302 (Fix rendering of stabilization version for trait implementors)
 - #81310 (Do not mark unit variants as used when in path pattern)
 - #81320 (Make bad shlex parsing a pretty error)
 - #81338 (Clean up `dominators_given_rpo`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-24 23:04:15 +00:00
Jonas Schievink
529f15f9b9
Rollup merge of #81338 - bugadani:dominator-cleanup, r=davidtwco
Clean up `dominators_given_rpo`
2021-01-24 22:10:10 +01:00
Jonas Schievink
04ddf42218
Rollup merge of #81310 - tmiasko:in-pattern, r=petrochenkov
Do not mark unit variants as used when in path pattern

Record that we are processing a pattern so that code responsible for
handling path resolution can correctly decide whether to mark it as
used or not.

Closes #76788.
2021-01-24 22:10:06 +01:00
Jonas Schievink
9089dd2248
Rollup merge of #81297 - bjorn3:no_extern_backend_optimization_level_query_provider, r=cjgillot
Don't provide backend_optimization_level query for extern crates

Fixes #71291
2021-01-24 22:10:02 +01:00
Jonas Schievink
70be327f2a
Rollup merge of #81279 - bugadani:iter, r=davidtwco
Small refactor in typeck

 - `check_impl_items_against_trait` only queries and walks through associated items once
 - extracted function that reports errors
 - don't check specialization validity when trait item does not match
 - small additional cleanups
2021-01-24 22:10:01 +01:00
Jonas Schievink
22dc82fb9d
Rollup merge of #81259 - est31:cfg_version, r=petrochenkov
Replace version_check dependency with own version parsing code

This gives compiler maintainers a better degree of control
over how the version gets parsed and is a good way to ensure
that there are no changes of behaviour in the future.

Also, issue a warning if the version is invalid instead of erroring
so that we stay forwards compatible with possible future changes
of the versioning scheme.

Last, this improves the present test a little.

Fixes #79436

r? `@petrochenkov`
2021-01-24 22:09:57 +01:00
Jonas Schievink
27abbc208f
Rollup merge of #80933 - rcvalle:fix-sysroot-option, r=nagisa
Fix sysroot option not being honored across rustc

Change link_sanitizer_runtime() to check if the sanitizer library exists in the specified/session sysroot, and if it doesn't exist, use the default sysroot. (See #79253.)
2021-01-24 22:09:55 +01:00
Jonas Schievink
e8ef15d9d1
Rollup merge of #80855 - m-ou-se:assert-2021, r=petrochenkov
Expand assert!(expr, args..) to include $crate for hygiene on 2021.

This makes `assert!(expr, args..)` properly hygienic in Rust 2021.

This is part of rust-lang/rfcs#3007, see #80162.

Before edition 2021, this was a breaking change, as `std::panic` and `core::panic` are different. In edition 2021 they will be identical, making it possible to apply proper hygiene here.
2021-01-24 22:09:53 +01:00
Jonas Schievink
d9c177f777
Rollup merge of #78578 - oli-obk:const_mut_refs, r=RalfJung
Permit mutable references in all const contexts

fixes #71212

cc `@rust-lang/wg-const-eval` `@christianpoveda`
2021-01-24 22:09:48 +01:00
Joakim Åkerblom
1d03648e67 Fix spelling in documentation for error E0207
I have trouble parsing the the wording "type parameter parameter".
2021-01-24 20:31:42 +01:00
Vadim Petrochenkov
bd07165690 parser: Collect tokens for values in key-value attributes 2021-01-24 17:11:56 +03:00
Mara Bos
a730970dff Only call span.rust_2021() when necessary. 2021-01-24 14:19:05 +01:00
Dániel Buga
f8416faaaf Clean up dominators_given_rpo 2021-01-24 13:32:18 +01:00
bors
72c7b70267 Auto merge of #80838 - nagisa:nagisa/stack-probe-type, r=cuviper
Target stack-probe support configurable finely

This adds capability to configure the target's stack probe support in a
more precise manner than just on/off. In particular now we allow
choosing between always inline-asm, always call or either one of those
depending on the LLVM version.

Note that this removes the ability to turn off the generation of the
stack-probe attribute. This is valid to replace it with inline-asm for all targets because
`probe-stack="inline-asm"` will not generate any machine code on targets
that do not currently support stack probes. This makes support for stack
probes on targets that don't have any right now automatic with LLVM
upgrades in the future.

(This is valid to do based on the fact that clang unconditionally sets
this attribute when `-fstack-clash-protection` is used, AFAICT)

cc #77885
r? `@cuviper`
2021-01-24 09:44:42 +00:00
bors
85e355ea9b Auto merge of #80919 - cjgillot:defkey-span, r=oli-obk
Generate metadata by iterating on DefId instead of traversing the HIR tree 1/N

Sample from #80347.
2021-01-24 06:51:17 +00:00
bors
446cbc9db0 Auto merge of #80594 - bjorn3:abi_refactor3, r=petrochenkov
Various ABI refactorings

This includes changes to the rust abi and various refactorings that will hopefully make it easier to use the abi handling infrastructure of rustc in cg_clif. There are several refactorings that I haven't done. I am opening this draft PR to check that I haven't broken any non x86_64 architectures.

r? `@ghost`
2021-01-24 02:59:14 +00:00
est31
14aa12fcc2 Replace version_check dependency with own version parsing code
This gives compiler maintainers a better degree of control
over how the version gets parsed and is a good way to ensure
that there are no changes of behaviour in the future.

Also, issue a warning if the version is invalid instead of erroring
so that we stay forwards compatible with possible future changes
of the versioning scheme.

Last, this improves the present test a little.
2021-01-24 01:56:54 +01:00
bors
26c2d1f408 Auto merge of #79811 - Aaron1011:expn-data-disambig, r=petrochenkov
Add disambiugator to ExpnData

I still need to write a bunch of comments. Opening to see how bad the perf impact is.

cc https://github.com/rust-lang/rust/issues/79560
2021-01-24 00:10:20 +00:00
Aaron Hill
3540f9396a
Add disambiugator to ExpnData
Due to macro expansion, its possible to end up with two distinct
`ExpnId`s that have the same `ExpnData` contents. This violates the
contract of `HashStable`, since two unequal `ExpnId`s will end up with
equal `Fingerprint`s.

This commit adds a `disambiguator` field to `ExpnData`, which is used to
force two otherwise-equivalent `ExpnData`s to be distinct.
2021-01-23 15:41:17 -05:00
Jonas Schievink
be3723c488
Rollup merge of #81298 - lcnr:big-money-big-prices, r=oli-obk
replace RefCell with Cell in FnCtxt

small cleanup
2021-01-23 20:16:17 +01:00
Jonas Schievink
81647c627a
Rollup merge of #81275 - jyn514:time-render, r=wesleywiser
Fix <unknown> queries and add more timing info to render_html

Closes https://github.com/rust-lang/rust/issues/81251.

##  Fix `<unknown>` queries

This happened because `alloc_query_strings` was never called.

##  Add more timing info to render_html

This still has some issues I'm not sure how to work out:

- `create_renderer` and `renderer_after_krate` aren't shown by default.
  I want something like `verbose_generic_activity_with_arg`, but it doesn't exist.

I'm also not sure how to show activities that aren't on by default - I
tried `-Z self-profile -Z self-profile-args=all`, but it didn't show up.

r? `@wesleywiser`
2021-01-23 20:16:10 +01:00
Jonas Schievink
7038bb1eb2
Rollup merge of #81252 - jyn514:resolve-timing, r=petrochenkov
Add more self-profile info to rustc_resolve

The idea is to help me find out where the time is being spent in compiling the docs for `windows-rs`: https://github.com/microsoft/windows-rs/issues/420#issuecomment-764991646
2021-01-23 20:16:09 +01:00
Jonas Schievink
fcf11296f6
Rollup merge of #81249 - cjgillot:issue-79537, r=oli-obk
Lower closure prototype after its body.

Fixes #79537.

r? `@Mark-Simulacrum`
2021-01-23 20:16:07 +01:00
Jonas Schievink
3a3470bf04
Rollup merge of #81243 - osa1:fix_80742_2, r=RalfJung
mir: Improve size_of handling when arg is unsized

As discussed on Zulip with `@RalfJung.`
2021-01-23 20:16:04 +01:00
Jonas Schievink
57d655368b
Rollup merge of #81130 - pierwill:edit-depnode, r=jyn514
Edit rustc_middle::dep_graph module documentation

This is similar to work approved and then closed in https://github.com/rust-lang/rust/pull/80325 due to a bad rebase.
2021-01-23 20:16:00 +01:00
Jonas Schievink
3382771dfd
Rollup merge of #81072 - RalfJung:place-ref-ty, r=oli-obk
PlaceRef::ty: use method call syntax
2021-01-23 20:15:59 +01:00
bjorn3
fa12fdbc29 Fix review comments 2021-01-23 17:55:39 +01:00
oli
209889ddc1 Leave some notes for future changes to the MIR opt level of mir inlining 2021-01-23 16:51:23 +00:00
oli
0491e74dd9 Make sure that const prop does not produce unsilenceable lints after inlining 2021-01-23 16:51:23 +00:00
oli
b8727e2d60 Prevent query cycles during inlining 2021-01-23 16:51:22 +00:00
Joshua Nelson
ca72f9ed70 Calculate self-profile strings in Compiler::enter instead in codegen
This avoids each tool having to separately find and call
`self_profile_alloc_strings`.

- Don't compute the global context if it hasn't yet been computed

  This avoids giving extraneous errors about unresolved names if an error
  occurs during parsing.
2021-01-23 11:42:15 -05:00
bors
4d0dd02ee0 Auto merge of #80579 - RalfJung:no-fallible-promotion, r=oli-obk
avoid promoting division, modulo and indexing operations that could fail

For division, `x / y` will still be promoted if `y` is a non-zero integer literal; however, `1/(1+1)` will not be promoted any more.

While at it, also see if we can reject promoting floating-point arithmetic (which are [complicated](https://github.com/rust-lang/unsafe-code-guidelines/issues/237) so maybe we should not promote them).

This will need a crater run to see if there's code out there that relies on these things being promoted.

If we can land this, promoteds in `fn`/`const fn` cannot fail to evaluate any more, which should let us do some simplifications in codegen/Miri!

Cc https://github.com/rust-lang/rfcs/pull/3027
Fixes https://github.com/rust-lang/rust/issues/61821
r? `@oli-obk`
2021-01-23 13:19:04 +00:00
Camille GILLOT
97ee7c7e5a Allow to query the HIR crate node. 2021-01-23 13:58:09 +01:00