Commit graph

3299 commits

Author SHA1 Message Date
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
Mara Bos a730970dff Only call span.rust_2021() when necessary. 2021-01-24 14:19:05 +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
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
Camille GILLOT 89360931f2 Fix proc macro crate encoding. 2021-01-23 13:57:43 +01:00
Camille GILLOT 4eb0bbd2a8 Filter stability. 2021-01-23 13:57:17 +01:00
Camille GILLOT 4e60ecf783 Iterate on deprecation. 2021-01-23 13:56:50 +01:00
Camille GILLOT 4468473e1b Iterate on const_stability. 2021-01-23 13:56:24 +01:00
Camille GILLOT f1a7e1df3a Iterate on stability. 2021-01-23 13:55:57 +01:00
Camille GILLOT 7a5620c63a Iterate DefId to encode expn_that_defined. 2021-01-23 13:55:35 +01:00
Camille GILLOT 293e885daa Iterate DefId to encode attributes. 2021-01-23 13:54:22 +01:00
Camille GILLOT f1bf6d0e48 Iterate DefId to encode visibility. 2021-01-23 13:53:26 +01:00
Camille GILLOT a185cdbc59 Iterate to encode def_kind. 2021-01-23 13:51:00 +01:00
Camille GILLOT c58a6fa422 Iterate DefId to encode spans. 2021-01-23 13:44:02 +01:00
Camille GILLOT 0b6c9e9f88 Encode DefKind directly. 2021-01-23 13:42:56 +01:00
Camille GILLOT 064a351953 Infallible version of def_span. 2021-01-23 13:35:22 +01:00
bjorn3 c3367dbc6f Add some comments to PassMode 2021-01-23 12:57:35 +01:00
oli 14f39aa81a Do not allow arbitrary mutable references in static mut, just keep with the existing exceptions 2021-01-23 11:33:45 +00:00
oli 00e62fabf1 Adjust wording of a diagnostic 2021-01-23 11:33:45 +00:00
oli d118021f8b Permit mutable references in all const contexts 2021-01-23 11:33:45 +00:00
Bastian Kauschke 688cf6406a replace RefCell with Cell in FnCtxt 2021-01-23 11:47:38 +01:00
bjorn3 794880c6b5 Don't provide backend_optimization_level query for extern crates 2021-01-23 11:11:51 +01:00
bjorn3 a93dace55c Never create an temporary PassMode::Direct when it is not a valid pass mode for a type 2021-01-23 10:30:39 +01:00
bjorn3 ba484de538 Move some code around 2021-01-23 10:30:39 +01:00
bjorn3 da0309c711 Use PassMode::Pair by default for Abi::ScalarPair for all abi's and in return position
Abi::ScalarPair is only ever used for types that don't have a stable
layout anyway so this doesn't break any FFI. It does however reduce the
amount of special casing on the abi outside of the code responsible for
abi specific adjustments to the pass mode.
2021-01-23 10:30:38 +01:00
bjorn3 2bde7d21cc Remove unused dependency 2021-01-23 10:30:38 +01:00
bors 1986b58c64 Auto merge of #80065 - b-naber:parse-angle-arg-diagnostics, r=petrochenkov
Improve diagnostics when parsing angle args

https://github.com/rust-lang/rust/pull/79266 introduced parsing of generic arguments in associated type constraints, this however resulted in possibly very confusing error messages in cases in which closing angle brackets were missing such as in `Vec<(u32, _, _) = vec![]`, which outputs an incorrectly parsed equality constraint error, as noted by `@cynecx.`

This PR tries to provide better error messages in such cases.

r? `@petrochenkov`
2021-01-23 06:27:21 +00:00
bors 693ed05bbd Auto merge of #81017 - Aaron1011:collect-trailing-token, r=petrochenkov
Refactor token collection to capture trailing token immediately

Split out from https://github.com/rust-lang/rust/pull/80689 - when we start capturing more information about attribute targets, we'll need to know in advance if we're capturing a trailing token or not.

r? `@ghost`
2021-01-23 00:42:37 +00:00
pierwill b29353af09 Edit rustc_middle::dep_graph module documentation
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
Co-authored-by: Camelid <camelidcamel@gmail.com>
2021-01-22 15:15:05 -08:00
Joshua Nelson 0679a4cd93 Remove special casing of rustdoc in rustc_lint
This is no longer necessary now that rustdoc doesn't run
everybody_loops.
2021-01-22 14:50:21 -05:00