Commit graph

1017 commits

Author SHA1 Message Date
bors
3bbc443cc6 Auto merge of #77379 - camelid:improve-wording-crate-resolution-error, r=davidtwco
Improve wording for external crate resolution error

I think it reads better this way.
2020-10-01 03:28:50 +00:00
Dylan DPC
85e77edc82
Rollup merge of #77371 - camelid:remove-extra-space-in-diagnostic, r=varkor
Remove trailing space in error message

- Add test for error message
- Remove trailing space in error message
2020-10-01 02:13:49 +02:00
Dylan DPC
cc1513b860
Rollup merge of #77360 - oli-obk:zst_const_pat_regression, r=RalfJung
References to ZSTs may be at arbitrary aligned addresses

fixes #77320

r? @RalfJung
2020-10-01 02:13:48 +02:00
Dylan DPC
849e5636ea
Rollup merge of #77343 - varkor:rustc_args_required_const-validation, r=lcnr
Validate `rustc_args_required_const`

Fixes https://github.com/rust-lang/rust/issues/74608.
2020-10-01 02:13:44 +02:00
Dylan DPC
73258f87ea
Rollup merge of #77324 - Aaron1011:fix/const-item-mutation-ptr, r=petrochenkov
Don't fire `const_item_mutation` lint on writes through a pointer

Fixes #77321
2020-10-01 02:13:43 +02:00
Dylan DPC
0044a9c084
Rollup merge of #77319 - tgnottingham:siphasher_endianness, r=nnethercote
Stable hashing: add comments and tests concerning platform-independence

SipHasher128 implements short_write in an endian-independent way, yet
its write_xxx Hasher trait methods undo this endian-independence by byte
swapping the integer inputs on big-endian hardware. StableHasher then
adds endian-independence back by also byte-swapping on big-endian
hardware prior to invoking SipHasher128.

This double swap may have the appearance of being a no-op, but is in
fact by design. In particular, we really do want SipHasher128 to be
platform-dependent, in order to be consistent with the libstd SipHasher.
Try to clarify this intent. Also, add and update a couple of unit tests.

---

Previous commit text:

~SipHasher128: fix platform-independence confusion~

~StableHasher is supposed to ensure platform independence by converting
integers to little-endian and extending isize and usize to 64 bits as
necessary, but in fact, much of that work is already handled by
SipHasher128.~

~In particular, SipHasher128 implements short_write in an
endian-independent way, yet both StableHasher and SipHasher128
additionally attempt to achieve endian-independence by byte swapping on
BE hardware before invoking short writes. This double swap has no
effect, so let's remove it.~

~Because short_write is endian-independent, SipHasher128 is already
handling part of the platform-independence, and it would be somewhat
difficult to make it *not* handle that part with the current
implementation. As splitting platform-independence responsibilities
between StableHasher and SipHasher128 would be confusing, let's make
SipHasher128 handle all of it.~

~Finally, update some incorrect comments and increase test coverage.
Unit tests pass on both LE and BE systems.~
2020-10-01 02:13:41 +02:00
Dylan DPC
6d3cfd9d51
Rollup merge of #77305 - lcnr:candidate_from_obligation, r=davidtwco
move candidate_from_obligation_no_cache

It's only called from `candidate_from_obligation` which is already in this file.
2020-10-01 02:13:37 +02:00
Dylan DPC
f23559451b
Rollup merge of #77303 - lcnr:const-evaluatable-TooGeneric, r=oli-obk,varkor
const evaluatable: improve `TooGeneric` handling

Instead of emitting an error in `fulfill`, we now correctly stall on inference variables.

As `const_eval_resolve` returns `ErrorHandled::TooGeneric` when encountering generic parameters on which
we actually do want to error, we check for inference variables and eagerly emit an error if they don't exist, returning `ErrorHandled::Reported` instead.

Also contains a small bugfix for `ConstEquate` where we previously only stalled on type variables. This is probably a leftover from
when we did not yet support stalling on const inference variables.

r? @oli-obk cc @varkor @eddyb
2020-10-01 02:13:35 +02:00
Dylan DPC
37df40bd1c
Rollup merge of #77202 - ehuss:defer-apple-sdkroot, r=petrochenkov
Defer Apple SDKROOT detection to link time.

This defers the detection of the SDKROOT for Apple iOS/tvOS targets to link time, instead of when the `Target` is defined. This allows commands that don't need to link to work (like `rustdoc` or `rustc --print=target-list`). This also makes `--print=target-list` a bit faster.

This also removes the note in the platform support documentation about these targets being missing. When I wrote it, I misunderstood how the SDKROOT stuff worked.

Notes:
* This means that JSON spec targets can't explicitly override these flags. I think that is probably fine, as I believe the value is generally required, and can be set with the SDKROOT environment variable.
* This changes `x86_64-apple-tvos` to use `appletvsimulator`. I think the original code was wrong (it was using `iphonesimulator`). Also, `x86_64-apple-tvos` seems broken in general, and I cannot build it locally. The `data_layout` does not appear to be correct (it is a copy of the arm64 layout instead of the x86_64 layout). I have not tried building Apple's LLVM to see if that helps, but I suspect it is just wrong (I'm uncertain since I don't know how the tvOS simulator works with its bitcode-only requirements).
* I'm tempted to remove the use of `Result` for built-in target definitions, since I don't think they should be fallible. This was added in https://github.com/rust-lang/rust/pull/34980, but that only relates to JSON definitions. I think the built-in targets shouldn't fail. I can do this now, or not.

Fixes #36156
Fixes #76584
2020-10-01 02:13:34 +02:00
Dylan DPC
8ccc063fbc
Rollup merge of #77153 - Aaron1011:fix/better-recursive-expand, r=petrochenkov
Fix recursive nonterminal expansion during pretty-print/reparse check

Makes progress towards #43081

In PR #73084, we started recursively expanded nonterminals during the
pretty-print/reparse check, allowing them to be properly compared
against the reparsed tokenstream.

Unfortunately, the recursive logic in that PR only handles the case
where a nonterminal appears inside a `TokenTree::Delimited`. If a
nonterminal appears directly in the expanded tokens of another
nonterminal, the inner nonterminal will not be expanded.

This PR fixes the recursive expansion of nonterminals, ensuring that
they are expanded wherever they occur.
2020-10-01 02:13:32 +02:00
Camelid
2c5e2a6fc6 Improve wording for external crate resolution error
I think it reads better this way.
2020-09-30 16:03:01 -07:00
bors
ef663a8a48 Auto merge of #77372 - jonas-schievink:rollup-e5bdzga, r=jonas-schievink
Rollup of 12 pull requests

Successful merges:

 - #77037 (more tiny clippy cleanups)
 - #77233 (BTreeMap: keep an eye out on the size of the main components)
 - #77280 (Ensure that all LLVM components requested by tests are available on CI)
 - #77284 (library: Forward compiler-builtins "mem" feature)
 - #77296 (liveness: Use Option::None to represent absent live nodes)
 - #77322 (Add unstable book docs for `-Zunsound-mir-opts`)
 - #77328 (Use `rtassert!` instead of `assert!` from the child process after fork() in std::sys::unix::process::Command::spawn())
 - #77331 (Add test for async/await combined with const-generics.)
 - #77338 (Fix typo in alloc vec comment)
 - #77340 (Alloc vec use imported path)
 - #77345 (Add test for issue #74761)
 - #77348 (Update books)

Failed merges:

r? `@ghost`
2020-09-30 20:49:27 +00:00
Vadim Petrochenkov
384eb2691f rustc_metadata: Do not forget to encode inherent impls for foreign types 2020-09-30 22:58:35 +03:00
Jonas Schievink
d4add198be
Rollup merge of #77296 - tmiasko:liveness-option, r=ecstatic-morse
liveness: Use Option::None to represent absent live nodes

No functional changes intended.
2020-09-30 20:56:12 +02:00
Jonas Schievink
248d6bf1e2
Rollup merge of #77037 - matthiaskrgr:cl42ppy, r=Dylan-DPC
more tiny clippy cleanups

commits stand alone and can be reviewed one by one
2020-09-30 20:56:05 +02:00
Camelid
b2ce3e5344 Remove trailing space in error message 2020-09-30 11:52:42 -07:00
bors
867bd42c38 Auto merge of #75810 - hug-dev:cmse-nonsecure-entry, r=jonas-schievink
Add support for cmse_nonsecure_entry attribute

This pull request adds the `cmse_nonsecure_entry` attribute under an unstable feature.

I was not sure if it was fine for me to send directly the pull-request or if I should submit a RFC first. I was told on Zulip that it was fine to do so but please close it if I need first submit a RFC or follow another process instead.

The `cmse_nonsecure_entry` attribute is a LLVM attribute that will be available in LLVM 11. I plan to rebase on the [upgrade PR](https://github.com/rust-lang/rust/pull/73526) once merged to make this one compile.

This attribute modifies code generation of the function as explained [here](https://developer.arm.com/documentation/ecm0359818/latest/) to make it work with the TrustZone-M hardware feature. This feature is only available on `thumbv8m` targets so I created an error for that if one tries to use this attribute for another target.

I added this attribute in Rust as any other LLVM attribute are added but since this one is target-dependent I am not sure if it was the best thing to do. Please indicate me if you think of other ways, like isolating target-dependent attributes together.

----------------

Tracking issue: https://github.com/rust-lang/rust/issues/75835
2020-09-30 18:43:48 +00:00
Dylan MacKenzie
1301f43119 Remove E0019, use E0015 for inline assembly in a const 2020-09-30 11:29:25 -07:00
Dylan MacKenzie
0c26144b1a Better span for attribute suggestions
`def_span` has the same issues as `body.span`, so do it this way instead.
2020-09-30 11:29:16 -07:00
Hugues de Valon
2588287def Add more tests and check for ABI
Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
2020-09-30 18:10:17 +01:00
Jake Vossen
dffb9d6a26 cargo fmt 2020-09-30 10:55:34 -06:00
Jake Vossen
5032674065 fixed merge conflicts 2020-09-30 10:54:27 -06:00
Jake Vossen
f69a88b7d3 updated p! macro to accept literals 2020-09-30 10:52:51 -06:00
Jake Vossen
d103fe15d1 Fixed more write literals after master merge 2020-09-30 10:12:48 -06:00
Jake Vossen
916d23614b updated p! macro to accept literals 2020-09-30 10:07:15 -06:00
est31
7f5008c829 Backport LLVM apfloat commit to rustc_apfloat
Backports LLVM commit: e34bd1e0b0

Fixes #69532
2020-09-30 17:48:26 +02:00
Hugues de Valon
1aaafac6ff Add support for cmse_nonsecure_entry attribute
This patch adds support for the LLVM cmse_nonsecure_entry attribute.
This is a target-dependent attribute that only has sense for the
thumbv8m Rust targets.
You can find more information about this attribute here:
https://developer.arm.com/documentation/ecm0359818/latest/

Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
2020-09-30 15:48:59 +01:00
Hugues de Valon
d255d70e7a Update LLVM and add Unsupported diagnostic
Secure entry functions do not support if arguments are passed on the
stack. An "unsupported" diagnostic will be emitted by LLVM if that is
the case.
This commits adds support in Rust for that diagnostic so that an error
will be output if that is the case!

Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
2020-09-30 14:57:37 +01:00
bors
939cc3e445 Auto merge of #77281 - tmiasko:liveness-everybody, r=oli-obk
Liveness analysis for everybody

Perform liveness analysis for every body instead of limiting it to fns.

Fixes #77169.
2020-09-30 12:44:31 +00:00
varkor
609786dbd8 Validate rustc_args_required_const 2020-09-30 11:59:44 +01:00
Oliver Scherer
ce6c25da58 References to ZSTs may be at arbitrary aligned addresses 2020-09-30 10:40:49 +02:00
Tyson Nottingham
d061fee177 Stable hashing: add comments and tests concerning platform-independence
SipHasher128 implements short_write in an endian-independent way, yet
its write_xxx Hasher trait methods undo this endian-independence by byte
swapping the integer inputs on big-endian hardware. StableHasher then
adds endian-independence back by also byte-swapping on big-endian
hardware prior to invoking SipHasher128.

This double swap may have the appearance of being a no-op, but is in
fact by design. In particular, we really do want SipHasher128 to be
platform-dependent, in order to be consistent with the libstd SipHasher.
Try to clarify this intent. Also, add and update a couple of unit tests.
2020-09-30 00:57:35 -07:00
Dylan MacKenzie
7c6d685551 Rewrite E0019 example
Inline assembly is now the only user of E0019. What is it doing that
E0015 is not?
2020-09-29 21:17:48 -07:00
Dylan MacKenzie
1513904c1c Remove default build_error impl
Now all structured errors must have their own error code
2020-09-29 21:17:48 -07:00
bors
6ac6c67574 Auto merge of #77069 - sexxi-goose:closure_print_2, r=nikomatsakis
pretty.rs: Update Closure and Generator print

More detailed outline: https://github.com/rust-lang/project-rfc-2229/pull/17

Closes: https://github.com/rust-lang/project-rfc-2229/issues/11

r? `@nikomatsakis`
cc `@eddyb` `@davidtwco` `@estebank`
2020-09-30 03:10:47 +00:00
Dylan MacKenzie
287993c961 Remove machinery for halting error output 2020-09-29 19:20:33 -07:00
Dylan MacKenzie
e02ea835a7 Don't stop const-checking after erroneous trait bound 2020-09-29 19:20:33 -07:00
Dylan MacKenzie
37f37dc5ba Emit multiple function pointer errors from const-checker 2020-09-29 19:20:33 -07:00
Dylan MacKenzie
b400871b9c Don't emit duplicate errors for the return place 2020-09-29 19:20:33 -07:00
Dylan MacKenzie
5b3145574e Priority levels 2020-09-29 19:20:33 -07:00
Dylan MacKenzie
a23297f5c0 Bless mut tests 2020-09-29 19:20:33 -07:00
Dylan MacKenzie
b518ccb4c3 Give MutDeref a real error message 2020-09-29 19:20:33 -07:00
Dylan MacKenzie
de35c4293d Remove ops::non_const
This helper function was meant to reduce code duplication between
const-checking pre- and post-drop-elaboration. Most of the functionality
is only relevant for the pre-drop-elaboration pass.
2020-09-29 19:20:33 -07:00
Dylan MacKenzie
ce50939952 Fix "unstable in stable" error
The "otherwise" note is printed before the suggestion currently.
2020-09-29 19:20:33 -07:00
Dylan MacKenzie
782a595d7c Return a DiagnosticBuilder from structured errors
This ensures that `emit_error` will actually cause compilation to fail.
2020-09-29 19:20:33 -07:00
Dylan MacKenzie
20e07e7b8e Forbid generator-specific MIR in all const-contexts 2020-09-29 19:20:33 -07:00
Dylan MacKenzie
c38aca0502 delay_span_bug if const-checking an async function
This errors during AST lowering. Any errors we emit here are just noise.
2020-09-29 19:20:33 -07:00
Dylan MacKenzie
25c7753eee Continue after impl Trait in const fn 2020-09-29 19:13:11 -07:00
Dylan MacKenzie
325b7d42ec Continue const-checking after errors when easy
This doesn't change any UI test output
2020-09-29 17:38:28 -07:00
Dylan MacKenzie
4d343a5e59 Useful derives on mir::LocalKind 2020-09-29 17:38:28 -07:00
Tomasz Miąsko
93e3db30e9 liveness: Use Option::None to represent absent live nodes
No functional changes intended.
2020-09-30 00:00:00 +00:00
Tomasz Miąsko
924e8aaaf2 Liveness analysis for everybody
Perform liveness analysis for every body instead of limiting it to fns.
2020-09-29 23:45:31 +02:00
bors
381b445ff5 Auto merge of #77274 - tmiasko:liveness-cnd, r=lcnr
Liveness refactoring continued

* Move body_owner field from IrMaps to Liveness (the only user of the field).
* Use upvars instead of FnKind to check for closures (avoids FnKind, will be useful when checking all bodies, not just fns).
* Use visit_param to add variables corresponding to params.
* Store upvars_mentioned inside Liveness struct.
* Inline visitor implementation for IrMaps, avoiding unnecessary indirection.
* Test interaction with automatically_derived attribute (not covered by any of existing tests).

No functional changes intended.
2020-09-29 19:25:10 +00:00
David Wood
9ef68f53e1
resolve: improve "try using the enum's variant"
This commit improves the "try using the enum's variant" suggestion:

- Variants in suggestions would not result in more errors (e.g. use
  of a struct variant is only suggested if the suggestion can
  trivially construct that variant). Therefore, suggestions are only
  emitted for variants that have no fields (since the suggestion
  can't know what value fields would have).
- Suggestions include the syntax for constructing the variant. If a
  struct or tuple variant is suggested, then it is constructed in the
  suggestion - unless in pattern-matching or when arguments are already
  provided.
- A help message is added which mentions the variants which are no
  longer suggested.

Signed-off-by: David Wood <david@davidtw.co>
2020-09-29 16:52:43 +01:00
bors
4d52dc4790 Auto merge of #76754 - varkor:diagnostic-cleanup-ii, r=ecstatic-morse
Clean up diagnostics for arithmetic operation errors

Plus a small tweak to a range pattern error message.
2020-09-29 14:28:58 +00:00
bors
26373fb4ba Auto merge of #77275 - petrochenkov:interpid, r=varkor
expand: Stop normalizing `NtIdent`s before passing them to built-in macros

Built-in macros should be able to deal with `NtIdents` in the input by themselves like any other parser code.

You can't imagine how bad mutable AST visitors are, *especially* if they are modifying tokens.
This is one step towards removing token visiting from the visitor infrastructure (https://github.com/rust-lang/rust/pull/77271 also works in this direction.)
2020-09-29 05:14:36 +00:00
Aaron Hill
c6107c53d7
Don't fire const_item_mutation lint on writes through a pointer
Fixes #77321
2020-09-28 23:51:57 -04:00
bors
48cab67447 Auto merge of #77257 - ecstatic-morse:optimize-int-range-from-pat, r=Mark-Simulacrum
Optimize `IntRange::from_pat`, then shrink `ParamEnv`

Resolves #77058.

r? `@Mark-Simulacrum`
cc `@vandenheuvel`

Looking at the output of `perf report` for #76244, the hot instructions seemed to be around the call to `pat_constructor` in `IntRange::from_pat`. I carried out an obvious optimization, but it actually made the instruction count higher (see #77075). However, it seems to have mitigated whatever was causing the pipeline stalls, so when combined with #76244, it's a net win.

As you can see below, the regression in #76244 seems to have originated from something measured by `stalled-cycles-backend`. I'll try to collect some finer-grained stats to see if I can isolate it. I wish I had a better idea of what was going on here. I'd like to prevent the regression from reappearing in the future due to small changes in unrelated code.

<details>
<summary>Current `master`:</summary>

```
 Performance counter stats for 'cargo +baseline-stage1 check':

          2,275.67 msec task-clock:u              #    0.998 CPUs utilized
                 0      context-switches:u        #    0.000 K/sec
                 0      cpu-migrations:u          #    0.000 K/sec
            49,826      page-faults:u             #    0.022 M/sec
     5,117,221,678      cycles:u                  #    2.249 GHz
       299,655,943      stalled-cycles-frontend:u #    5.86% frontend cycles idle
     2,284,213,395      stalled-cycles-backend:u  #   44.64% backend cycles idle
     8,051,871,959      instructions:u            #    1.57  insn per cycle
                                                  #    0.28  stalled cycles per insn
     1,359,589,402      branches:u                #  597.447 M/sec
         7,359,347      branch-misses:u           #    0.54% of all branches

       2.281030026 seconds time elapsed

       2.108197000 seconds user
       0.164183000 seconds sys
```
</details>

<details>
<summary>Shrink `ParamEnv` without changing `IntRange::from_pat`:</summary>

```
 Performance counter stats for 'cargo +perf-stage1 check':

          2,751.79 msec task-clock:u              #    0.996 CPUs utilized
                 0      context-switches:u        #    0.000 K/sec
                 0      cpu-migrations:u          #    0.000 K/sec
            50,103      page-faults:u             #    0.018 M/sec
     6,260,590,019      cycles:u                  #    2.275 GHz
       317,355,920      stalled-cycles-frontend:u #    5.07% frontend cycles idle
     3,397,743,582      stalled-cycles-backend:u  #   54.27% backend cycles idle
     8,276,224,367      instructions:u            #    1.32  insn per cycle
                                                  #    0.41  stalled cycles per insn
     1,370,453,386      branches:u                #  498.023 M/sec
         7,281,031      branch-misses:u           #    0.53% of all branches

       2.763265838 seconds time elapsed

       2.544578000 seconds user
       0.204548000 seconds sys
```
</details>

<details>
<summary>Shrink `ParamEnv` and change `IntRange::from_pat`: </summary>

```
 Performance counter stats for 'cargo +perf-stage1 check':

          2,295.57 msec task-clock:u              #    0.996 CPUs utilized
                 0      context-switches:u        #    0.000 K/sec
                 0      cpu-migrations:u          #    0.000 K/sec
            49,959      page-faults:u             #    0.022 M/sec
     5,151,407,066      cycles:u                  #    2.244 GHz
       324,517,829      stalled-cycles-frontend:u #    6.30% frontend cycles idle
     2,301,671,001      stalled-cycles-backend:u  #   44.68% backend cycles idle
     8,130,868,329      instructions:u            #    1.58  insn per cycle
                                                  #    0.28  stalled cycles per insn
     1,356,618,512      branches:u                #  590.972 M/sec
         7,323,800      branch-misses:u           #    0.54% of all branches

       2.304509653 seconds time elapsed

       2.128090000 seconds user
       0.163909000 seconds sys
```
</details>
2020-09-29 02:29:13 +00:00
Aaron Hill
46d8c4bdb7
Fix recursive nonterminal expansion during pretty-print/reparse check
Makes progress towards #43081

In PR #73084, we started recursively expanded nonterminals during the
pretty-print/reparse check, allowing them to be properly compared
against the reparsed tokenstream.

Unfortunately, the recursive logic in that PR only handles the case
where a nonterminal appears inside a `TokenTree::Delimited`. If a
nonterminal appears directly in the expanded tokens of another
nonterminal, the inner nonterminal will not be expanded.

This PR fixes the recursive expansion of nonterminals, ensuring that
they are expanded wherever they occur.
2020-09-28 19:14:42 -04:00
Vadim Petrochenkov
4a4a7f8599 expand: Minor fn ptr call cleanup 2020-09-28 23:10:48 +03:00
Vadim Petrochenkov
85ef265dbe expand: Stop un-interpolating NtIdents before passing them to built-in macros
This was a big hack, and built-in macros should be able to deal with `NtIdents` in the input by themselves like any other parser code.
2020-09-28 23:10:44 +03:00
Bastian Kauschke
db5b70f193 move candidate_from_obligation_no_cache 2020-09-28 20:21:44 +02:00
Bastian Kauschke
a4783debe0 const evaluatable: improve TooGeneric handling 2020-09-28 20:18:06 +02:00
Oliver Scherer
43c181bac4 Use tracing spans to trace the entire MIR interp stack 2020-09-28 20:07:57 +02:00
bors
fc2daaae61 Auto merge of #77302 - RalfJung:rollup-n8gg3v6, r=RalfJung
Rollup of 7 pull requests

Successful merges:

 - #76454 (UI to unit test for those using Cell/RefCell/UnsafeCell)
 - #76474 (Add option to pass a custom codegen backend from a driver)
 - #76711 (diag: improve closure/generic parameter mismatch)
 - #77170 (Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]`)
 - #77194 (Add doc alias for iterator fold)
 - #77288 (fix building libstd for Miri on macOS)
 - #77295 (Update unstable-book: Fix ABNF in inline assembly docs)

Failed merges:

r? `@ghost`
2020-09-28 18:02:45 +00:00
Ralf Jung
85a59d40f1
Rollup merge of #77170 - ecstatic-morse:const-fn-ptr, r=oli-obk
Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]`

`rustc_allow_const_fn_ptr` was a hack to work around the lack of an escape hatch for the "min `const fn`" checks in const-stable functions. Now that we have co-opted `allow_internal_unstable` for this purpose, we no longer need a bespoke attribute.

Now this functionality is gated under `const_fn_fn_ptr_basics` (how concise!), and `#[allow_internal_unstable(const_fn_fn_ptr_basics)]` replaces `#[rustc_allow_const_fn_ptr]`. `const_fn_fn_ptr_basics` allows function pointer types to appear in the arguments and locals of a `const fn` as well as function pointer casts to be performed inside a `const fn`. Both of these were allowed in constants and statics already. Notably, this does **not** allow users to invoke function pointers in a const context. Presumably, we will use a nicer name for that (`const_fn_ptr`?).

r? @oli-obk
2020-09-28 18:39:44 +02:00
Ralf Jung
88ae20d8aa
Rollup merge of #76711 - davidtwco:issue-51154-param-closure, r=estebank
diag: improve closure/generic parameter mismatch

Fixes #51154.

This PR improves the diagnostic when a type parameter is expected and a closure is found, noting that each closure has a distinct type and therefore could not always match the caller-chosen type of the parameter.

r? @estebank
2020-09-28 18:39:42 +02:00
Ralf Jung
6a8cdbd285
Rollup merge of #76474 - bjorn3:driver_selected_codegen, r=oli-obk
Add option to pass a custom codegen backend from a driver

This allows the driver to pass information to the codegen backend. For example the headcrab debugger may in the future want to use cg_clif to JIT code to be injected in the debuggee. This would PR make it possible to tell cg_clif which symbol can be found at which address and to tell it to inject the JITed code into the right process.

This PR may also help with https://github.com/rust-lang/miri/pull/1540 by allowing miri to provide a codegen backend that only emits metadata and doesn't perform any codegen.

cc @nbaksalyar (headcrab)
cc @RalfJung (miri)
2020-09-28 18:39:40 +02:00
bors
d62d3f7fa9 Auto merge of #76899 - wesleywiser:experimental_unsound_mir_opts_flag, r=oli-obk
[mir-opt] Introduce a new flag to enable experimental/unsound mir opts

This implements part of https://github.com/rust-lang/compiler-team/issues/319. The exact name of this flag was not decided as part of that MCP and some people expressed that it should include "unsound" in some way.

I've chosen to use `enable-experimental-unsound-mir-opts` as the name. While long, I don't think that matters too much as really it will only be used by some mir-opt tests. If you object or have a better name, please leave a comment!

r? `@oli-obk`
cc `@rust-lang/wg-mir-opt` `@RalfJung`
2020-09-28 15:32:27 +00:00
bors
535d27ac9a Auto merge of #77236 - matthewjasper:defer-typeof-impl-trait, r=davidtwco
Compute underlying type of impl trait types later in compilation

Also change a `bug!` to `delay_span_bug`
Closes #74018
2020-09-28 12:47:23 +00:00
bors
96555ba608 Auto merge of #77261 - oli-obk:const_generic_array_serializer, r=matthewjasper
Deduplicate and generalize some (de/)serializer impls

I noticed this while implementing #77227 and getting a "not implemented for [T; 16]" error. There's likely more things we can deduplicate in this file, but I didn't need any additional changes.
2020-09-28 08:33:00 +00:00
bors
4e3eb52493 Auto merge of #77265 - vandenheuvel:chalkup, r=Dylan-DPC
Update chalk to 0.29.0
2020-09-28 06:20:02 +00:00
Aman Arora
c923da0b49 pretty.rs: Update Closure and Generator print
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com>
Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-09-28 01:27:19 -04:00
Valerii Lashmanov
92a0668c20 SsoHashMap minor refactoring, SSO_ARRAY_SIZE introduced 2020-09-27 23:48:19 -05:00
Wesley Wiser
b9d0ea95c8 [mir-opt] Introduce a new flag to enable experimental/unsound mir opts 2020-09-27 19:21:01 -04:00
Tomasz Miąsko
33dde94d33 liveness: Inline visitor implementation for IrMaps 2020-09-27 23:55:53 +02:00
Tomasz Miąsko
536b51aca0 liveness: Store upvars_mentioned inside Liveness struct 2020-09-27 23:55:53 +02:00
Tomasz Miąsko
b629ffd96b liveness: Use visit_param to add variables corresponding to params 2020-09-27 23:55:53 +02:00
Tomasz Miąsko
e0db21dc7e liveness: Use upvars instead of FnKind to check for closures
Avoiding FnKind will make it easier to run liveness analysis on all
bodies in the future, not just fn-like things.
2020-09-27 23:55:52 +02:00
Tomasz Miąsko
e3319e7d16 liveness: Move body_owner field from IrMaps to Liveness
The Liveness struct is the only user of body_owner field.  Move the
field there.
2020-09-27 23:55:52 +02:00
bors
c0b15cc6ed Auto merge of #77242 - ecstatic-morse:dataflow-switch-int, r=jonas-schievink
Replace `discriminant_switch_effect` with more general version

#68528 added a new edge-specific effect for `SwitchInt` terminators, `discriminant_switch_effect`, to the dataflow framework. While this accomplished the short-term goal of making drop elaboration more precise, it wasn't really useful in other contexts: It only supported `SwitchInt`s on the discriminant of an `enum` and did not allow effects to be applied along the "otherwise" branch. In const-propagation, for example, arbitrary edge-specific effects for the targets of a `SwitchInt` can be used to remember the value a `match` scrutinee must have in each arm.

This PR replaces `discriminant_switch_effect` with a more general `switch_int_edge_effects` method. The new method has a slightly different interface from the other edge-specific effect methods (e.g. `call_return_effect`). This divergence is explained in the new method's documentation, and reading the changes to the various dataflow impls as well as `direction.rs` should further clarify things. This PR should not change behavior.
2020-09-27 21:54:49 +00:00
bors
7f7a1cbfd3 Auto merge of #77229 - tmiasko:liveness, r=lcnr
Small improvements in liveness pass

* Remove redundant debug logging (`add_variable` already contains logging).
* Remove redundant fields for a number of live nodes and variables.
* Delay conversion from a symbol to a string until linting.
* Inline contents of specials struct.
* Remove unnecessary local variable exit_ln.
* Use newtype_index for Variable and LiveNode.
* Access live nodes directly through self.lnks[ln].

No functional changes intended (except those related to the logging).
2020-09-27 19:38:01 +00:00
Dylan MacKenzie
3cbd17fcc6 Remove rustc_allow_const_fn_ptr
This was a hack to work around the lack of an escape hatch for the "min
`const fn`" checks in const-stable functions. Now that we have co-opted
`allow_internal_unstable` for this purpose, we no longer need the
bespoke attribute.
2020-09-27 10:46:41 -07:00
Dylan MacKenzie
1ff143191c Add a feature gate for basic function pointer use in const fn 2020-09-27 10:46:41 -07:00
Jonas Schievink
344ab3fb7b
Rollup merge of #77263 - bugadani:cleanup, r=lcnr
Clean up trivial if let
2020-09-27 18:37:29 +02:00
Jonas Schievink
65298ee49c
Rollup merge of #77262 - bugadani:redundant-comment, r=Dylan-DPC
Remove duplicate comment
2020-09-27 18:37:28 +02:00
Jonas Schievink
06677cbcfc
Rollup merge of #77256 - jyn514:typo, r=Aaron1011
Fix typo in ExpnData documentation

This mis-highlighted the entire documentation as code: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/hygiene/struct.ExpnData.html#structfield.krate
2020-09-27 18:37:26 +02:00
Jonas Schievink
2a90d31423
Rollup merge of #77249 - jyn514:private-links, r=Manishearth
Separate `private_intra_doc_links` and `broken_intra_doc_links` into separate lints

This is not ideal because it means `deny(broken_intra_doc_links)` will
no longer `deny(private_intra_doc_links)`. However, it can't be fixed
with a new lint group, because `broken` is already in the `rustdoc` lint
group; there would need to be a way to nest groups somehow.

This also removes the early `return` so that the link will be generated
even though it gives a warning.

r? @Manishearth
cc @ecstatic-morse (https://github.com/rust-lang/rust/pull/77242#issuecomment-699565095)
2020-09-27 18:37:23 +02:00
Jonas Schievink
9f086fcb00
Rollup merge of #77203 - ecstatic-morse:const-stability-attr-checks, r=oli-obk
Check for missing const-stability attributes in `rustc_passes`

Currently, this happens as a side effect of `is_min_const_fn`, which is non-obvious. Also adds a test for this case, since we didn't seem to have one before.
2020-09-27 18:37:21 +02:00
Jonas Schievink
ec1766c5b6
Rollup merge of #76839 - lzutao:mips-asm, r=Amanieu
Add asm! support for MIPS

For now, I only add support for mips32.
mips64 may come in future PRs if I could learn more about the target.
2020-09-27 18:37:20 +02:00
Joshua Nelson
80ffaed809 Add documentation for private_intra_doc_links 2020-09-27 10:44:41 -04:00
Joshua Nelson
03d8be0896 Separate private_intra_doc_links and broken_intra_doc_links into separate lints
This is not ideal because it means `deny(broken_intra_doc_links)` will
no longer `deny(private_intra_doc_links)`. However, it can't be fixed
with a new lint group, because `broken` is already in the `rustdoc` lint
group; there would need to be a way to nest groups somehow.

This also removes the early `return` so that the link will be generated
even though it gives a warning.
2020-09-27 09:58:29 -04:00
Bram van den Heuvel
ef7377eb05 Update chalk to 0.29.0 2020-09-27 15:54:07 +02:00
bors
d902752866 Auto merge of #77118 - exrook:stability-generic-parameters-2, r=varkor
Stability annotations on generic parameters (take 2.5)

Rebase of #72314 + more tests

Implements rust-lang/wg-allocators#2.
2020-09-27 12:51:21 +00:00
bjorn3
71bc62b9f6 Add option to pass a custom codegen backend from a driver 2020-09-27 14:16:42 +02:00
bors
b8363295d5 Auto merge of #71274 - RalfJung:raw-init-check-aggregate, r=petrochenkov
might_permit_raw_init: also check aggregate fields

This is the next step for https://github.com/rust-lang/rust/issues/66151: when doing `mem::zeroed`/`mem::uninitialized`, also recursively check fields of aggregates (except for arrays) for whether they permit zero/uninit initialization.
2020-09-27 10:17:09 +00:00
Dániel Buga
e4200512ff Clean up trivial if let 2020-09-27 11:54:50 +02:00
Dániel Buga
3d4a2e6bb9 Remove duplicate comment 2020-09-27 11:00:46 +02:00
bors
71bdb84817 Auto merge of #76955 - jyn514:refactor-diagnostics, r=euclio
Refactor and fix intra-doc link diagnostics, and fix links to primitives

Closes https://github.com/rust-lang/rust/issues/76925, closes https://github.com/rust-lang/rust/issues/76693, closes https://github.com/rust-lang/rust/issues/76692.

Originally I only meant to fix #76925. But the hack with `has_primitive` was so bad it was easier to fix the primitive issues than to try and work around it.

Note that this still has one bug: `std::primitive::i32::MAX` does not resolve. However, this fixes the ICE so I'm fine with fixing the link in a later PR.

This is part of a series of refactors to make #76467 possible.

This is best reviewed commit-by-commit; it has detailed commit messages.

r? `@euclio`
2020-09-27 08:12:29 +00:00
Joshua Nelson
d9fc5b5ea8 Fix typo in ExpnData documentation
This mis-highlighted the entire documentation as code.
2020-09-27 00:10:54 -04:00
Dylan MacKenzie
c4d8089f00 Revert "Add an unused field of type Option<DefId> to ParamEnv struct."
This reverts commit ab83d372ed.
2020-09-26 21:01:09 -07:00
Dylan MacKenzie
bb6c249f99 Speed up IntRange::from_pat
Previously, this method called the more general `pat_constructor`
function, which can return other pattern variants besides `IntRange`.
Then it throws away any non-`IntRange` variants. Specialize it so work
is only done when it could result in an `IntRange`.
2020-09-26 20:00:54 -07:00
Lzu Tao
9000710959 Add MIPS asm! support
This patch also:
* Add soft-float supports: only f32
* zero-extend i8/i16 to i32 because MIPS only supports register-length
  arithmetic.
* Update table in asm! chapter in unstable book.
2020-09-27 02:36:50 +00:00
bors
62fe055aba Auto merge of #76986 - jonas-schievink:ret-in-reg, r=nagisa
Return values up to 128 bits in registers

This fixes https://github.com/rust-lang/rust/issues/26494#issuecomment-619506345 by making Rust's default ABI pass return values up to 128 bits in size in registers, just like the System V ABI.

The result is that these methods from the comment linked above now generate the same code, making the Rust ABI as efficient as the `"C"` ABI:

```rust
pub struct Stats { x: u32, y: u32, z: u32, }

pub extern "C" fn sum_c(a: &Stats, b: &Stats) -> Stats {
    return Stats {x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
}

pub fn sum_rust(a: &Stats, b: &Stats) -> Stats {
    return Stats {x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
}
```

```asm
sum_rust:
	movl	(%rsi), %eax
	addl	(%rdi), %eax
	movl	4(%rsi), %ecx
	addl	4(%rdi), %ecx
	movl	8(%rsi), %edx
	addl	8(%rdi), %edx
	shlq	$32, %rcx
	orq	%rcx, %rax
	retq
```
2020-09-27 02:35:11 +00:00
Eric Huss
7420d7a980 Move add_apple_sdk out of add_pre_link_args. 2020-09-26 19:12:38 -07:00
Dylan MacKenzie
c0cd1b0a26 Remove intra-doc link 2020-09-26 17:29:55 -07:00
Tomasz Miąsko
d68aa227c6 liveness: Access live nodes directly through self.lnks[ln] 2020-09-27 00:00:00 +00:00
Jonas Schievink
7a1a87114e
Rollup merge of #77235 - petrochenkov:reparse, r=Aaron1011
pretty-print-reparse hack: Rename some variables for clarity

This will also make it easier to make the comparisons asymmetric.

Also one impossible case is removed.

r? @Aaron1011
2020-09-27 01:53:29 +02:00
Jonas Schievink
aa35c527fd
Rollup merge of #77231 - oli-obk:clippy_const_fn, r=Manishearth
Move helper function for `missing_const_for_fn` out of rustc to clippy

cc @rust-lang/clippy @ecstatic-morse #76618

r? @Manishearth

I also removed all support for suggesting a function could be `const fn` when that would require feature gates to actually work.

This means we'll now have to maintain this ourselves in clippy, but that's how most lints work anyway, so...
2020-09-27 01:53:27 +02:00
Jonas Schievink
593b38be6a
Rollup merge of #77209 - jyn514:fix-docs, r=petrochenkov
Fix documentation highlighting in ty::BorrowKind

Previously it looked a little odd: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.BorrowKind.html#variant.UniqueImmBorrow

Noticed this while reviewing https://github.com/rust-lang/rustc-dev-guide/pull/894.
2020-09-27 01:53:25 +02:00
Jonas Schievink
3d1d24da94
Rollup merge of #77208 - mati865:late-link-args-order, r=petrochenkov
Late link args order

MSYS2 changed how winpthreads is built and as the result it now depends on more mingw-w64 libraries.

This PR affects only MinGW targets since nobody else is using `late_link_args_{dynamic,static}`. Now the order is similar to how it used to be before https://github.com/rust-lang/rust/pull/67502.
2020-09-27 01:53:23 +02:00
Jonas Schievink
6b8fb3fbd8
Rollup merge of #77107 - bugadani:perf, r=oli-obk
Enable const propagation into operands at mir_opt_level=2

Feature was added in #74507 but gated with `mir_opt_level>=3` because of compile time regressions. Let's see whether the LLVM 11 update solves that.

As the [perf results](https://github.com/rust-lang/rust/pull/77107#issuecomment-697668154) show, enabling this optimization results in a lot less regression as before.

cc @oli-obk

r? @ghost
2020-09-27 01:53:16 +02:00
Valerii Lashmanov
41942fac7d SsoHashSet reimplemented as a wrapper on top of SsoHashMap
SsoHashSet::replace had to be removed because
it requires missing API from SsoHashMap.
It's not a widely used function, so I think it's ok
to omit it for now.

EitherIter moved into its own file.

Also sprinkled code with #[inline] attributes where appropriate.
2020-09-26 18:42:26 -05:00
Dylan MacKenzie
2364b58b87 Update dataflow impls to reflect new interface 2020-09-26 15:15:06 -07:00
Dylan MacKenzie
43e6ef876f Update engine to use new interface 2020-09-26 15:15:06 -07:00
Dylan MacKenzie
4c5f9f742c Replace discriminant_switch_effect with more general version
...that allows arbitrary effects on each edge of a `SwitchInt`
terminator.
2020-09-26 14:50:47 -07:00
bors
623fb90b5a Auto merge of #76897 - Aaron1011:feature/min-proc-macro-metadata, r=petrochenkov
Encode less metadata for proc-macro crates

Currently, we serialize the same crate metadata for proc-macro crates as
we do for normal crates. This is quite wasteful - almost none of this
metadata is ever used, and much of it can't even be deserialized (if it
contains a foreign `CrateNum`).

This PR changes metadata encoding to skip encoding the majority of crate
metadata for proc-macro crates. Most of the `Lazy<[T]>` fields are left
completetly empty, while the non-lazy fields are left as-is.

Additionally, proc-macros now have a def span that does not include
their body. This was done for normal functions in #75465, but was missed
for proc-macros.

As a result of this PR, we should only ever encode local `CrateNum`s
when encoding proc-macro crates. I've added a specialized serialization
impl for `CrateNum` to assert this.
2020-09-26 20:57:31 +00:00
Valerii Lashmanov
0600b178aa SsoHashSet/SsoHashMap API greatly expanded
Now both provide almost complete API of their non-SSO counterparts.
2020-09-26 14:30:05 -05:00
Valerii Lashmanov
5c224a484d MiniSet/MiniMap moved and renamed into SsoHashSet/SsoHashMap
It is a more descriptive name and with upcoming changes
there will be nothing "mini" about them.
2020-09-26 14:30:05 -05:00
bors
e37c99fa1c Auto merge of #77224 - RalfJung:rollup-hdvb96c, r=RalfJung
Rollup of 12 pull requests

Successful merges:

 - #75454 (Explicitly document the size guarantees that Option makes.)
 - #76631 (Add `x.py setup`)
 - #77076 (Add missing code examples on slice iter types)
 - #77093 (merge `need_type_info_err(_const)`)
 - #77122 (Add `#![feature(const_fn_floating_point_arithmetic)]`)
 - #77127 (Update mdBook)
 - #77161 (Remove TrustedLen requirement from BuilderMethods::switch)
 - #77166 (update Miri)
 - #77181 (Add doc alias for pointer primitive)
 - #77204 (Remove stray word from `ClosureKind::extends` docs)
 - #77207 (Rename `whence` to `span`)
 - #77211 (Remove unused #[allow(...)] statements from compiler/)

Failed merges:

 - #77170 (Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]`)

r? `@ghost`
2020-09-26 17:50:26 +00:00
Vadim Petrochenkov
fe3e5aa729 pretty-print-reparse hack: Remove an impossible case
Delimiters cannot appear as isolated tokens in a token stream
2020-09-26 20:27:14 +03:00
Vadim Petrochenkov
275bf626f6 pretty-print-reparse hack: Rename some variables for clarity 2020-09-26 20:27:09 +03:00
Matthew Jasper
3a81adeca2 Call type_of for opaque types later in compilation
This ensures that various wf checks have already been done before we
typeck item bodies.
2020-09-26 17:56:03 +01:00
Aaron Hill
b9653568a7
Encode less metadata for proc-macro crates
Currently, we serialize the same crate metadata for proc-macro crates as
we do for normal crates. This is quite wasteful - almost none of this
metadata is ever used, and much of it can't even be deserialized (if it
contains a foreign `CrateNum`).

This PR changes metadata encoding to skip encoding the majority of crate
metadata for proc-macro crates. Most of the `Lazy<[T]>` fields are left
completetly empty, while the non-lazy fields are left as-is.

Additionally, proc-macros now have a def span that does not include
their body. This was done for normal functions in #75465, but was missed
for proc-macros.

As a result of this PR, we should only ever encode local `CrateNum`s
when encoding proc-macro crates. I've added a specialized serialization
impl for `CrateNum` to assert this.
2020-09-26 12:26:27 -04:00
Matthew Jasper
ef83742b2b Delay bug for non-universal regions in member constraints 2020-09-26 17:16:25 +01:00
Tomasz Miąsko
57d38975cc liveness: Use newtype_index for Variable and LiveNode 2020-09-26 16:44:41 +02:00
Tomasz Miąsko
49d1ce00f3 liveness: Remove unnecessary local variable exit_ln 2020-09-26 16:44:28 +02:00
Oliver Scherer
1b843896c8 Move qualify_min_const_fn out of rustc into clippy 2020-09-26 16:08:24 +02:00
Tomasz Miąsko
141b91da6c liveness: Inline contents of specials struct 2020-09-26 15:38:56 +02:00
Tomasz Miąsko
70f150b51e liveness: Delay conversion from a symbol to a string until linting 2020-09-26 15:38:51 +02:00
Tomasz Miąsko
2fb1564457 liveness: Remove redundant fields for a number of live nodes and variables 2020-09-26 15:38:30 +02:00
Tomasz Miąsko
9b5835ec79 liveness: Remove redundant debug logging
The IrMaps::add_variable already contains debug logging. Don't duplicate it.
2020-09-26 15:38:22 +02:00
Jonas Schievink
4c5acc4ed7 Return values up to 128 bits in registers 2020-09-26 15:34:26 +02:00
Oliver Scherer
455f284496 Deduplicate and generalize some (de/)serializer impls 2020-09-26 14:55:42 +02:00
varkor
94c789b275 char not char 2020-09-26 13:34:49 +01:00
varkor
8eb42ba0fb Make invalid integer operation messages consistent 2020-09-26 13:34:49 +01:00
Ralf Jung
9e02642fb3
Rollup merge of #77211 - est31:remove_unused_allow, r=oli-obk
Remove unused #[allow(...)] statements from compiler/
2020-09-26 12:58:34 +02:00
Ralf Jung
67f8c5914f
Rollup merge of #77204 - LingMan:patch-3, r=jonas-schievink
Remove stray word from `ClosureKind::extends` docs
2020-09-26 12:58:30 +02:00
Ralf Jung
7c47b1e5f4
Rollup merge of #77161 - est31:swich_len_already_trusted, r=petrochenkov
Remove TrustedLen requirement from BuilderMethods::switch

The main use case of TrustedLen is allowing APIs to specialize on it,
but no use of it uses that specialization. Instead, only the .len()
function provided by ExactSizeIterator is used, which is already
required to be accurate.

Thus, the TrustedLen requirement on BuilderMethods::switch is redundant.
2020-09-26 12:58:24 +02:00
Ralf Jung
3b544e73ae
Rollup merge of #77122 - ecstatic-morse:const-fn-arithmetic, r=RalfJung,oli-obk
Add `#![feature(const_fn_floating_point_arithmetic)]`

cc #76618

This is a template for splitting up `const_fn` into granular feature gates. I think this will make it easier, both for us and for users, to track stabilization of each individual feature. We don't *have* to do this, however. We could also keep stabilizing things out from under `const_fn`.

cc @rust-lang/wg-const-eval
r? @oli-obk
2020-09-26 12:58:20 +02:00
Ralf Jung
ac8169dc10
Rollup merge of #77093 - lcnr:const-generics-infer-warning, r=varkor
merge `need_type_info_err(_const)`

I hoped that this would automatically solve #76737 but it doesn't quite seem like it

fixes #77092

r? @varkor
2020-09-26 12:58:17 +02:00
Ralf Jung
6f881b3b7d might_permit_raw_init: also check aggregate fields 2020-09-26 12:29:01 +02:00
bors
6f9a8a7f9b Auto merge of #76485 - estebank:format_arg_capture_spans, r=davidtwco
Point at named argument not found when using `format_args_capture` instead of whole format string
2020-09-26 10:05:49 +00:00
Bastian Kauschke
9a607c0a27 unused into 2020-09-26 10:31:34 +02:00
Bastian Kauschke
32195ac8f4 rename functions 2020-09-26 10:28:15 +02:00
bors
fd15e6180d Auto merge of #70743 - oli-obk:eager_const_to_pat_conversion, r=eddyb
Fully destructure constants into patterns

r? `@varkor`

as discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/constants.20in.20patterns/near/192789924

we should probably crater it once reviewed
2020-09-26 06:44:28 +00:00
est31
12187b7f86 Remove unused #[allow(...)] statements from compiler/ 2020-09-26 01:25:55 +02:00
Joshua Nelson
58d57f3f5e Fix documentation highlighting in ty::BorrowKind
Previously it looked a little odd: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.BorrowKind.html#variant.UniqueImmBorrow
2020-09-25 18:54:05 -04:00
marmeladema
5946c12476 Move is_raw_guess check in ty::print::pretty 2020-09-25 22:48:44 +01:00
marmeladema
35bad3edbf Address review comment 2020-09-25 22:48:44 +01:00
marmeladema
f25d0bc559 Remove now unused double_braced_* symbols 2020-09-25 22:46:15 +01:00
marmeladema
23085b6360 Fix profiling query key creation 2020-09-25 22:46:15 +01:00
marmeladema
bb8e1764bb Simplify some match statements on `DefPathDataName' 2020-09-25 22:46:15 +01:00
marmeladema
75130b06bf Avoid calling Symbol::interner in compute_codegen_unit_name 2020-09-25 22:46:15 +01:00
marmeladema
657ecdb75e Rename DefPathData::get_name() to DefPathData::name() 2020-09-25 22:46:15 +01:00
marmeladema
2708ad8bb4 Fix pretty-printing of DisambiguatedDefPathData 2020-09-25 22:46:15 +01:00
marmeladema
9f50c49117 Implement Display for DisambiguatedDefPathData and DefPathData 2020-09-25 22:46:15 +01:00
marmeladema
f1878d19fa Move from {{closure}}#0 syntax to {closure#0} for (def) path components 2020-09-25 22:46:14 +01:00
LingMan
900daba2cb
Remove stray word from ClosureKind::extends docs 2020-09-25 23:35:07 +02:00
Dylan MacKenzie
76c6f2dc3f No need to call is_min_const_fn for side-effects 2020-09-25 14:31:32 -07:00
Dylan MacKenzie
11bfc60a4b Change error in fn_queries to delay_span_bug
This should be caught by the new check in `rustc_passes`. At some point,
this function will be removed entirely.
2020-09-25 14:31:32 -07:00
Dylan MacKenzie
61d86fa06c Check for missing const-stability attributes in stability
This used to happen as a side-effect of `is_min_const_fn`, which was
subtle.
2020-09-25 14:31:32 -07:00
bors
c6e4db620a Auto merge of #77198 - jonas-schievink:rollup-i59i41h, r=jonas-schievink
Rollup of 15 pull requests

Successful merges:

 - #76932 (Relax promises about condition variable.)
 - #76973 (Unstably allow assume intrinsic in const contexts)
 - #77005 (BtreeMap: refactoring around edges)
 - #77066 (Fix dest prop miscompilation around references)
 - #77073 (dead_code: look at trait impls even if they don't contain items)
 - #77086 (Include libunwind in the rust-src component.)
 - #77097 (Make [].as_[mut_]ptr_range() (unstably) const.)
 - #77106 (clarify that `changelog-seen = 1` goes to the beginning of config.toml)
 - #77120 (Add `--keep-stage-std` to `x.py` for keeping only standard library artifacts)
 - #77126 (Invalidate local LLVM cache less often)
 - #77146 (Install std for non-host targets)
 - #77155 (remove enum name from ImplSource variants)
 - #77176 (Removing erroneous semicolon in transmute documentation)
 - #77183 (Allow multiple allow_internal_unstable attributes)
 - #77189 (Remove extra space from vec drawing)

Failed merges:

r? `@ghost`
2020-09-25 19:35:33 +00:00
Eric Huss
c29a29cba0 Defer Apple SDKROOT detection to link time. 2020-09-25 12:07:46 -07:00
Jonas Schievink
12b8d8943d
Rollup merge of #77183 - bugadani:issue-77088, r=varkor
Allow multiple allow_internal_unstable attributes

Fixes #77088
2020-09-25 19:42:52 +02:00
Jonas Schievink
e739468f97
Rollup merge of #77155 - lcnr:ImplSource, r=ecstatic-morse
remove enum name from ImplSource variants

This is quite a lot cleaner in my opinion.
2020-09-25 19:42:48 +02:00
Jonas Schievink
ba44e9fe34
Rollup merge of #77073 - lcnr:ty-trait-param, r=matthewjasper
dead_code: look at trait impls even if they don't contain items

fixes #70225
2020-09-25 19:42:35 +02:00
Jonas Schievink
452aa759b7
Rollup merge of #77066 - jonas-schievink:dest-prop-borrow, r=oli-obk
Fix dest prop miscompilation around references

Closes https://github.com/rust-lang/rust/issues/77002
2020-09-25 19:42:33 +02:00
Jonas Schievink
1b8c939a8d
Rollup merge of #76973 - lzutao:unstably-const-assume, r=oli-obk
Unstably allow assume intrinsic in const contexts

Not sure much about this usage because there are concerns
about [blocking  optimization][1] and [slowing down LLVM][2] when using `assme` intrinsic
in inline functions.
But since Oli suggested in https://github.com/rust-lang/rust/issues/76960#issuecomment-695772221,
here we are.

[1]: https://github.com/rust-lang/rust/pull/54995#issuecomment-429302709
[2]: https://github.com/rust-lang/rust/issues/49572#issuecomment-589615423
2020-09-25 19:42:29 +02:00
Dylan MacKenzie
659028f48b Use proper issue for const_fn_floating_point_arithmetic 2020-09-25 10:39:11 -07:00
Dylan MacKenzie
2049052cb9 Put floating point arithmetic behind its own feature gate
This refactors handling of `Rvalue::{Unary,Binary}Op` in the
const-checker. Now we `span_bug` if there's an unexpected type in a
primitive operation. This also allows unary negation on
`char` values through the const-checker because it makes the code a bit
cleaner. `char` does not actually support these operations, and if it
did, we could evaluate them at compile-time.
2020-09-25 10:37:52 -07:00
Dylan MacKenzie
0d2521aaf7 Add const_fn_floating_point_arithmetic 2020-09-25 10:37:52 -07:00
bors
10ef7f9ebf Auto merge of #77157 - tmiasko:simplify-cfg-dup, r=jonas-schievink
Remove duplicated SimplifyCfg pass
2020-09-25 17:27:52 +00:00
bors
5b9e886403 Auto merge of #73453 - erikdesjardins:tuplayout, r=eddyb
Ignore ZST offsets when deciding whether to use Scalar/ScalarPair layout

This is important because Scalar/ScalarPair layout previously would not be used if any ZST had nonzero offset.
For example, before this change, only `((), u128)` would be laid out like `u128`, not `(u128, ())`.

Fixes #63244
2020-09-25 14:42:20 +00:00
Dániel Buga
54c9c949a1 Allow multiple allow_internal_unstable attributes
Co-authored-by: varkor <github@varkor.com>
2020-09-25 15:19:46 +02:00
bors
b984ef6797 Auto merge of #77152 - vandenheuvel:update_chalk_further, r=jackh726
Update chalk to 0.28.0
2020-09-25 12:22:05 +00:00
Mateusz Mikuła
bfdb7903c9 Link dynamic and static late_link_args before generic ones 2020-09-25 13:35:49 +02:00
bors
521d8d8a22 Auto merge of #77041 - lcnr:const-eval-perf, r=ecstatic-morse
perf: move cold path of `process_obligations` into a separate function

cc #76575

This probably won't matter too much in the long run once #69218 is merged so we may not want to merge this.

r? `@ecstatic-morse`
2020-09-25 10:14:47 +00:00
bors
9d74efe32e Auto merge of #76844 - simonvandel:fix-76803, r=wesleywiser
Fix #76803 miscompilation

Fixes #76803
Seems like it was an oversight that the discriminant value being set was not compared to the target value from the SwitchInt, as a comment says this is a requirement for the optimization to be sound.

r? `@wesleywiser` since you are probably familiar with the optimization and made #76837 to workaround the bug
2020-09-25 04:17:03 +00:00
bors
5bfeee5fe0 Auto merge of #77172 - jonas-schievink:rollup-a041rou, r=jonas-schievink
Rollup of 15 pull requests

Successful merges:

 - #75438 (Use adaptive SVG favicon for rustdoc like other rust sites)
 - #76304 (Make delegation methods of `std::net::IpAddr` unstably const)
 - #76724 (Allow a unique name to be assigned to dataflow graphviz output)
 - #76978 (Documented From impls in std/sync/mpsc/mod.rs)
 - #77044 (Liballoc bench vec use mem take not replace)
 - #77050 (Typo fix: "satsify" -> "satisfy")
 - #77074 (add array::from_ref)
 - #77078 (Don't use an if guard to check equality with a constant)
 - #77079 (Use `Self` in docs when possible)
 - #77081 (Merge two almost identical match arms)
 - #77121 (Updated html_root_url for compiler crates)
 - #77136 (Suggest `const_mut_refs`, not `const_fn` for mutable references in `const fn`)
 - #77160 (Suggest `const_fn_transmute`, not `const_fn`)
 - #77164 (Remove workaround for deref issue that no longer exists.)
 - #77165 (Followup to #76673)

Failed merges:

r? `@ghost`
2020-09-25 01:56:06 +00:00
Jonas Schievink
8515efb193
Rollup merge of #77165 - simonvandel:do-not-fire-on-drop-and-replace, r=oli-obk
Followup to #76673

Resolves https://github.com/rust-lang/rust/pull/76673#discussion_r494426303
r? @tmiasko
2020-09-25 02:29:52 +02:00
Jonas Schievink
b8d158b0f8
Rollup merge of #77160 - ecstatic-morse:const-fn-transmute-suggestion, r=oli-obk
Suggest `const_fn_transmute`, not `const_fn`

More fallout from #76850 in the vein of #77134. The fix is the same. I looked through the structured errors file and didn't see any more of this kind of diagnostics bug.

r? @oli-obk
2020-09-25 02:29:49 +02:00
Jonas Schievink
473ae229f0
Rollup merge of #77136 - ecstatic-morse:issue-77134, r=oli-obk
Suggest `const_mut_refs`, not `const_fn` for mutable references in `const fn`

Resolves #77134.

Prior to #76850, most uses of `&mut` in `const fn` ~~required~~ involved two feature gates, `const_mut_refs` and `const_fn`. The first allowed all mutable borrows of locals. The second allowed only locals, arguments and return values whose types contained `&mut`. I switched the second check to the `const_mut_refs` gate. However, I forgot update the error message with the new suggestion.

Alternatively, we could revert to having two different feature gates for this. OP's code never borrows anything mutably, so it didn't need `const_mut_refs` in the past, only `const_fn`. I'd prefer to keep everything under a single gate, however.

r? @oli-obk
2020-09-25 02:29:47 +02:00
Jonas Schievink
6f3da3d53f
Rollup merge of #77121 - duckymirror:html-root-url, r=jyn514
Updated html_root_url for compiler crates

Closes #77103

r? @jyn514
2020-09-25 02:29:45 +02:00
Jonas Schievink
b8ab6eb217
Rollup merge of #77081 - LingMan:patch-1, r=jonas-schievink
Merge two almost identical match arms
2020-09-25 02:29:44 +02:00
Jonas Schievink
28e0bc997e
Rollup merge of #77078 - LingMan:patch-2, r=jonas-schievink
Don't use an if guard to check equality with a constant

Match on it directly instead
2020-09-25 02:29:40 +02:00
Jonas Schievink
d766c239bd
Rollup merge of #76724 - ecstatic-morse:dataflow-pass-names, r=lcnr
Allow a unique name to be assigned to dataflow graphviz output

Previously, if the same analysis were invoked multiple times in a single compilation session, the graphviz output for later runs would overwrite that of previous runs. Allow callers to add a unique identifier to each run so this can be avoided.
2020-09-25 02:29:31 +02:00
bors
9b5c98f640 Auto merge of #77014 - tmiasko:arena, r=Mark-Simulacrum
DroplessArena: Allocate objects from the end of memory chunk

Allocating from the end of memory chunk simplifies the alignment code
and reduces the number of checked arithmetic operations.
2020-09-24 23:51:45 +00:00
Bastian Kauschke
06d2325a50 perf: split progress_obligations with inline(never) 2020-09-24 22:13:41 +02:00
Bastian Kauschke
ff7009a4d2 nit 2020-09-24 22:03:39 +02:00
Bastian Kauschke
e5430e5306 the two hardest things in programming, names and... 2020-09-24 22:01:46 +02:00
Dylan MacKenzie
ebf024bba8 Suggest const_fn_transmute instead of const_fn 2020-09-24 12:07:41 -07:00
Simon Vandel Sillesen
7dec440340 Resolve https://github.com/rust-lang/rust/pull/76673#discussion_r494426303 2020-09-24 21:02:53 +02:00
Bram van den Heuvel
51c781f613 Upgrade chalk to 0.28.0 2020-09-24 20:54:33 +02:00
bors
e599b53e67 Auto merge of #76918 - ishitatsuyuki:match-fastpath, r=oli-obk
Add fast path for match checking

This adds a fast path that would reduce the complexity to linear on matches consisting of only variant patterns (i.e. enum matches). (Also see: #7462) Unfortunately, I was too lazy to add a similar fast path for constants (mostly for integer matches), ideally that could be added another day.

TBH, I'm not confident with the performance claims due to the fact that enums tends to be small and FxHashMap could add a lot of overhead.

r? `@Mark-Simulacrum`

needs perf
2020-09-24 17:22:56 +00:00
Bastian Kauschke
1857184cd1 remove enum name from ImplSource variants 2020-09-24 19:22:36 +02:00
est31
12ada5cf4b Remove TrustedLen requirement from BuilderMethods::switch
The main use case of TrustedLen is allowing APIs to specialize on it,
but no use of it uses that specialization. Instead, only the .len()
function provided by ExactSizeIterator is used, which is already
required to be accurate.

Thus, the TrustedLen requirement on BuilderMethods::switch is redundant.
2020-09-24 19:10:34 +02:00
Bram van den Heuvel
5f67571e34 Update chalk to 0.27.0 2020-09-24 19:10:01 +02:00
Bram van den Heuvel
61b2a6f5e5 Update chalk to 0.26.0 2020-09-24 19:10:01 +02:00
Bram van den Heuvel
ed784023e5 Update chalk to 0.25.0 2020-09-24 19:10:01 +02:00
Bram van den Heuvel
cb660c6ab5 Update chalk to 0.24.0 2020-09-24 19:10:01 +02:00
Bram van den Heuvel
52eeff6fbe Update chalk to 0.23.0 2020-09-24 19:10:00 +02:00
Bram van den Heuvel
b832a97a51 Update chalk to 0.22.0 2020-09-24 19:10:00 +02:00
bors
87d262acb5 Auto merge of #77006 - oli-obk:🐌_const_queries, r=Mark-Simulacrum
Cache `eval_to_allocation_raw` on disk

https://github.com/rust-lang/rust/pull/74949#issuecomment-695833161 regressed the performance on these queries, this PR gets the perf back.
2020-09-24 15:12:17 +00:00
Oliver Scherer
40629ef827 Always cache const eval queries 2020-09-24 17:09:09 +02:00
Oliver Scherer
fc9f2947da Document FallbackToConstRef and make sure we don't accidentally use it 2020-09-24 17:01:03 +02:00
bors
893fadd11a Auto merge of #76820 - jyn514:query-comments, r=davidtwco
Preserve doc-comments when generating queries

Closes https://github.com/rust-lang/rust/issues/76812
2020-09-24 13:01:46 +00:00
Matthias Krüger
d7a5c574b1 use std::mem::take(x) instead of std::mem::replace(x, Default::default()) (clippy::mem_replace_with_default) 2020-09-24 13:38:08 +02:00
Matthias Krüger
2ad46acd7f EarlyOtherwiseBranch::run_pass(): don't convert Place to Place (clippy::useless_conversion) 2020-09-24 13:38:07 +02:00
bors
3a4da87f58 Auto merge of #77049 - lcnr:const-eval-function-signature, r=oli-obk
const_evaluatable_checked: extend predicate collection

We now walk the hir instead of using `ty` so that we get better spans here, While I am still not completely sure if that's
what we want in the end, it does seem a lot closer to the final goal than the previous version.

We also look into type aliases (and use a `TypeVisitor` here), about which I am not completely sure, but we will see how well this works.

We also look into fn decls, so the following should work now.
```rust
fn test<T>() -> [u8; std::mem::size_of::<T>()] {
    [0; std::mem::size_of::<T>()]
}
```
Additionally, we visit the optional trait and self type of impls.

r? `@oli-obk`
2020-09-24 10:29:14 +00:00
Oliver Scherer
9550ca6242 Deduplicate the "needs partialeq derive" message creation sites 2020-09-24 10:18:51 +02:00
bors
86b4172305 Auto merge of #77028 - andjo403:mini, r=matthewjasper
Move MiniSet to data_structures

remove the need for T to be copy from MiniSet as was done for MiniMap

MiniMap and MiniSet was added by https://github.com/rust-lang/rust/pull/72412

think that this can be used in https://github.com/rust-lang/rust/pull/68828
2020-09-24 08:14:30 +00:00
Oliver Scherer
e4928d77a1 Use correct type in diagnostics again 2020-09-24 10:06:07 +02:00
Oliver Scherer
2bc54d4273 Don't talk about determinism 2020-09-24 09:43:10 +02:00
Bastian Kauschke
3f9015b22d visit impl self ty + trait 2020-09-24 09:04:26 +02:00
Bastian Kauschke
b8402d6a6e assign the correct DefId in nominal_obligations 2020-09-24 09:04:23 +02:00
Bastian Kauschke
f8d3f401df walk hir to get const evaluatable predicates 2020-09-24 09:03:50 +02:00
Bastian Kauschke
ac1d0d8b28 fmt, use IndexSet directly instead of UniquePredicates 2020-09-24 09:03:14 +02:00
Bastian Kauschke
e1f408e6c8 const_evaluatable_checked: collect predicates from fn_sig 2020-09-24 09:03:07 +02:00
bors
5562bb6d74 Auto merge of #76748 - tmiasko:no-op-jumps, r=matthewjasper
Fix underflow when calculating the number of no-op jumps folded

When removing unwinds to no-op blocks and folding jumps to no-op blocks,
remove the unwind target first. Otherwise we cannot determine if target
has been already folded or not.

Previous implementation incorrectly assumed that all resume targets had
been folded already, occasionally resulting in an underflow:

```
remove_noop_landing_pads: removed 18446744073709551613 jumps and 3 landing pads
```
2020-09-24 05:57:06 +00:00
Dylan MacKenzie
a320ef751b Suggest const_mut_refs for mutable references in const fn 2020-09-23 21:04:07 -07:00
Joshua Nelson
472e52e5a0 Fix intra-doc links for primitives
- Add `PrimTy::name` and `PrimTy::name_str`
- Use those new functions to distinguish between the name in scope and
the canonical name
- Fix diagnostics for primitive types
- Add tests for primitives
2020-09-23 21:04:22 -04:00
Tomasz Miąsko
a09d607844 Remove duplicated SimplifyCfg pass 2020-09-24 00:00:00 +00:00
bors
c35177582b Auto merge of #77102 - Dylan-DPC:rollup-2jfrg3u, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #76898 (Record `tcx.def_span` instead of `item.span` in crate metadata)
 - #76939 (emit errors during AbstractConst building)
 - #76965 (Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.)
 - #76993 (Changing the alloc() to accept &self instead of &mut self)
 - #76994 (fix small typo in docs and comments)
 - #77017 (Add missing examples on Vec iter types)
 - #77042 (Improve documentation for ToSocketAddrs)
 - #77047 (Miri: more informative deallocation error messages)
 - #77055 (Add #[track_caller] to more panicking Cell functions)

Failed merges:

r? `@ghost`
2020-09-23 22:34:44 +00:00
bors
8b4085359a Auto merge of #76673 - simonvandel:remove-unneeded-drops, r=oli-obk
MIR pass to remove unneeded drops on types not needing drop

This is heavily dependent on MIR inlining running to actually see the drop statement.

Do we want to special case replacing a call to std::mem::drop with a goto aswell?
2020-09-23 20:13:47 +00:00
Erik Hofmayer
764967a7e5 tidy 2020-09-23 22:08:30 +02:00
Erik Hofmayer
138a2e5eaa /nightly/nightly-rustc 2020-09-23 21:51:56 +02:00
Erik Hofmayer
dd66ea2d3d Updated html_root_url for compiler crates 2020-09-23 21:14:43 +02:00
Dániel Buga
90c7731f6c Enable const prop into operands at mir_opt_level=2 2020-09-23 19:03:10 +02:00
Oliver Scherer
9aa1c0934c Update documentation tests 2020-09-23 18:55:27 +02:00
Oliver Scherer
da217644a1 Make sure we keep emitting a hard error 2020-09-23 18:36:53 +02:00
Oliver Scherer
017423179a Make sure we report a future incompat error in all cases 2020-09-23 18:04:44 +02:00
Oliver Scherer
6a33de0170 Name function correctly 2020-09-23 17:55:14 +02:00
Oliver Scherer
9a7e66aeaf Make sure we don't hide errors just because a lint has been emitted 2020-09-23 17:52:37 +02:00
Oliver Scherer
177d0cef48 Deduplicate errors in const to pat conversion 2020-09-23 17:03:31 +02:00
Oliver Scherer
d486486afd Talk about unpredictable instead of "not deterministic" 2020-09-23 16:38:30 +02:00
Oliver Scherer
1b1b6eabaa Remove the "lift constant to reference" logic 2020-09-23 16:28:45 +02:00
Dylan DPC
f8dec3d054
Rollup merge of #77047 - RalfJung:miri-dealloc, r=oli-obk
Miri: more informative deallocation error messages

Make sure we show the affected AllocId.

r? @oli-obk
2020-09-23 14:54:13 +02:00
Dylan DPC
bcdbe79f0c
Rollup merge of #76994 - yuk1ty:fix-small-typo, r=estebank
fix small typo in docs and comments

Fixed `the the` to `the`, as far as I found.
2020-09-23 14:54:07 +02:00
Dylan DPC
eaaf5d7e38
Rollup merge of #76965 - fusion-engineering-forks:fix-atomic-from-mut, r=Amanieu
Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.

Fixes some platform-specific problems with #74532 by using the actual alignment of the types instead of hardcoding a few `target_arch`s.

r? @RalfJung
2020-09-23 14:54:04 +02:00
Dylan DPC
98e5ee7df0
Rollup merge of #76939 - lcnr:const-evaluatable-cont, r=oli-obk
emit errors during AbstractConst building

There changes are currently still untested, so I don't expect this to pass CI 😆

It seems to me like this is the direction we want to go in, though we didn't have too much of a discussion about this.

r? @oli-obk
2020-09-23 14:54:02 +02:00
Dylan DPC
a22eb31668
Rollup merge of #76898 - Aaron1011:fix/item-def-span, r=oli-obk
Record `tcx.def_span` instead of `item.span` in crate metadata

This was missed in PR #75465. As a result, a few places have been using
the full body span of functions, instead of just the header span.
2020-09-23 14:54:00 +02:00
Bastian Kauschke
0e84b61053 use relevant span when unifying ConstVarValues 2020-09-23 11:00:44 +02:00
Bastian Kauschke
3dbfdb0182 use the correct span when dealing with inference variables 2020-09-23 10:44:11 +02:00
bors
feca2c229e Auto merge of #76659 - simonvandel:76432, r=oli-obk
SimplifyComparisonIntegral: fix miscompilation

Fixes #76432
Only insert StorageDeads if we actually removed one.
Fixes an issue where we added StorageDead to a place with no StorageLive

r? `@oli-obk`
2020-09-23 08:23:00 +00:00
Bastian Kauschke
0abb1abf04 unused path 2020-09-23 10:06:32 +02:00
Bastian Kauschke
45d92b43e3 merge need_type_info_err(_const) 2020-09-23 09:24:58 +02:00
Andreas Jonson
6586c37bec Move MiniSet to data_structures
remove the need for T to be copy from MiniSet as was done for MiniMap
2020-09-23 08:09:16 +02:00
bors
f6d59207ad Auto merge of #76850 - ecstatic-morse:const-checking-refactor, r=oli-obk
Remove `qualify_min_const_fn`

~~Blocked on #76807 (the first six commits).~~

With this PR, all checks in `qualify_min_const_fn` are replicated in `check_consts`, and the former is no longer invoked. My goal was to have as few changes to test output as possible, since making sweeping changes to the code *while* doing big batches of diagnostics updates turned out to be a headache. To this end, there's a few `HACK`s in `check_consts` to achieve parity with `qualify_min_const_fn`.

The new system that replaces `is_min_const_fn` is referred to as "const-stability"  My end goal for the const-stability rules is this:
* Const-stability is only applicable to functions defined in `staged_api` crates.
* All functions not marked `rustc_const_unstable` are considered "const-stable".
    - NB. This is currently not implemented. `#[unstable]` functions are also const-unstable. This causes problems when searching for feature gates.
    - All "const-unstable" functions have an associated feature gate
* const-stable functions can only call other const-stable functions
     - `allow_internal_unstable` can be used to circumvent this.
* All const-stable functions are subject to some additional checks (the ones that were unique to `qualify_min_const_fn`)

The plan is to remove each `HACK` individually in subsequent PRs. That way, changes to error message output can be reviewed in isolation.
2020-09-23 05:40:35 +00:00
Jacob Hughes
3f1b4b39e3 Fix compilation & test failures 2020-09-22 22:54:52 -04:00