Commit Graph

136316 Commits

Author SHA1 Message Date
oli
1f5fb3e056 Differentiate between the availability of ctfe MIR and runtime MIR 2021-01-04 21:40:38 +00:00
oli
cccd40f9b5 Keep an unoptimized duplicate of const fn around
This allows CTFE to reliably detect UB, as otherwise
optimizations may hide UB.
2021-01-04 21:40:38 +00:00
oli
8e4fe6647f Require the encode_promoted_mir caller to know whether MIR for this item actually exists 2021-01-04 21:40:38 +00:00
oli
248b4dbc4f Limit trait item mir encoding to items with default bodies 2021-01-04 21:40:38 +00:00
oli
dadf937a12 Remove mir encode calls that didn't actually encode anything 2021-01-04 21:40:38 +00:00
oli
552f391969 Make encode_optimized_mir always perform its action and instead require the callers to know whether they actually want this 2021-01-04 21:40:38 +00:00
oli
68ff5f0a18 Stop optimizing promoteds 2021-01-04 21:40:38 +00:00
bors
61f5a00923 Auto merge of #80624 - RalfJung:place-ref, r=oli-obk
use PlaceRef more consistently instead of loosely coupled local+projection

Instead of working directly with the `projections` array, use `iter_projections` and `last_projection`. This avoids having to construct new `PlaceRef` from the pieces everywhere.

I only did this for a few files, to see how people think about this. If y'all are happy with this, I'll open an E-mentor issue to complete this. I grepped for `Place::ty_from` to find the places that need adjusting -- this could miss some, but I am not sure what else to grep for.
2021-01-04 20:56:34 +00:00
max-heller
6f0413316f fix incompatible disambiguator test 2021-01-04 15:38:30 -05:00
Rich Kadel
e4aa99fe7a Inlining enabled by -mir-opt-level > 1 is incompatible with coverage
Fixes: #80060

Also adds additional test cases for coverage of doctests.
2021-01-04 11:06:42 -08:00
Ralf Jung
92d1b39043 make sure that promoteds which fail to evaluate in dead const code behave correctly 2021-01-04 19:48:56 +01:00
Albin Hedman
63f5d6111a Added reference to tracking issue and removed unneeded line 2021-01-04 19:36:25 +01:00
Ian Jackson
2c1d6557c9 Remove two obsolete uses of #![feature(split_inclusive)]
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-01-04 16:29:12 +00:00
Ian Jackson
be226e49e4 Stabilize split_inclusive
Closes #72360.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-01-04 16:20:08 +00:00
bors
9a22f993f0 Auto merge of #80688 - ehuss:update-mdbook, r=pietroalbini
[security] Update mdbook

Changelog from 0.4.3 to 0.4.5: https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-045
2021-01-04 16:11:47 +00:00
Guillaume Gomez
9714ac08a5 Add tests for new doc alias check 2021-01-04 16:30:53 +01:00
Eric Huss
65675adaea Update mdbook 2021-01-04 07:18:37 -08:00
Dániel Buga
6002e78392 Builder: Warn if test file does not exist 2021-01-04 16:09:59 +01:00
Guillaume Gomez
c4c010f534 Add an error in case the doc alias is the same as the item it's aliasing 2021-01-04 15:05:36 +01:00
J. Ryan Stinnett
61c8aae0a9 Extract sidebar_deref_methods function 2021-01-04 13:27:13 +00:00
bors
ab5b9aecb9 Auto merge of #80651 - GroteGnoom:issue-78123-fix, r=Nadrieril
Add note to non-exhaustive match on reference to empty

Rust prints "type `&A` is non-empty" even is A is empty.
This is the intended behavior, but can be confusing.
This commit adds a note to non-exhaustive pattern errors if they are a
reference to something uninhabited.

I did not add tests to check that the note is not shown for
non-references or inhabited references, because this is already done
in other tests.

Maybe the added test is superfluous, because
`always-inhabited-union-ref` already checks for this case.

This does not handle &&Void or &&&void etc. I could add those as special
cases as well and ignore people who need quadruple
references.

Fixes #78123
2021-01-04 13:23:08 +00:00
bors
6163bfdcce Auto merge of #80661 - jyn514:duplicate-types, r=GuillaumeGomez
Cleanup rustdoc handling of associated types

This is best reviewed a commit at a time. No particular reason for these changes, they just stood out as I was reviewing https://github.com/rust-lang/rust/pull/80653 and thinking about https://github.com/rust-lang/rust/issues/80379. The new test case worked before, it just wasn't tested.

r? `@GuillaumeGomez`
2021-01-04 10:32:28 +00:00
kadmin
54883e0a1c Add check for array/usize mismatch in astconv 2021-01-04 10:07:15 +00:00
bors
887398ff68 Auto merge of #80610 - Aaron1011:unhash-def-path-hash, r=varkor
Use `UnhashMap` whenever we have a key of `DefPathHash`
2021-01-04 07:49:01 +00:00
bors
0cd459fd62 Auto merge of #80554 - GuillaumeGomez:more-js-cleanup, r=jyn514
More js cleanup

Part of #79052 (Same kind as #80515).

This one is about some small fixes:
 * Replacing some loops with `onEachLazy`.
 * Removing unused function arguments.
 * Turn `buildHelperPopup` into a variable so it can be "replaced" once the function has been called once so it's not called again.

r? `@jyn514`
2021-01-04 05:04:04 +00:00
oliver
e152582a2b
doc -- list edit for consistency 2021-01-04 04:50:24 +00:00
max-heller
06b0900a2d half working 2021-01-03 21:55:53 -05:00
bors
8989689e72 Auto merge of #80418 - oli-obk:this_could_have_been_so_simple, r=RalfJung
Allow references to interior mutable data behind a feature gate

supercedes #80373 by simply not checking for interior mutability on borrows of locals that have `StorageDead` and thus can never be leaked to the final value of the constant

tracking issue: https://github.com/rust-lang/rust/issues/80384

r? `@RalfJung`
2021-01-04 02:15:57 +00:00
max-heller
fc3a4058ce still verify disambiguators for primitives 2021-01-03 20:45:08 -05:00
max-heller
e33a205bdf primitive disambiguator tests 2021-01-03 20:38:28 -05:00
max-heller
b4a0ef066d fix issue 80559 2021-01-03 20:38:28 -05:00
Matthias Krüger
6a4b24e4dd ./x.py clippy: allow the most noisy lints
This silences the following clippy lints in ./x.py clippy:

many_single_char_names (there are a lot of warnings caused by stdarch)
collapsible_if (can reduce readability)
type_complexity
missing_safety_doc (there are almost 3K warnings issued)
too_many_arguments
needless_lifetimes (people want 'tcx lifetimes etc)
wrong_self_convention (warns about from_..(), to_..(), into_..().. fns that do or do not take self by reference.
2021-01-04 02:26:50 +01:00
Jeremy Lin
6d45d055a1 Fix missing link for "fully qualified syntax" 2021-01-03 13:59:02 -08:00
Joshua Nelson
24ef94593c Don't clone type_ unnecessarily 2021-01-03 16:10:46 -05:00
Joshua Nelson
a786eaac1f Simplify rustdoc handling of type aliases for associated types
The logic was very hard to follow before.
2021-01-03 15:40:41 -05:00
bors
80184183ba Auto merge of #77859 - bugadani:no-duplicate-ref-link-error, r=jyn514
Rustdoc: only report broken ref-style links once

This PR assigns the markdown `LinkType` to each parsed link and passes this information into the link collector.
If a link can't be resolved in `resolve_with_disambiguator`, the failure is cached for the link types where we only want to report the error once (namely `Shortcut` and `Reference`).

Fixes  #77681
2021-01-03 20:24:16 +00:00
Daniel Noom
914bc17178 Add notes to stderr of non-exhaustive-reference test 2021-01-03 21:12:27 +01:00
pierwill
9a240e4857 Edit rustc_ast::tokenstream docs
Fix some punctuation and wording, and add intra-documentation links.
2021-01-03 11:54:56 -08:00
Daniel Noom
9cba8a37f9 Add note on void reference test
This test is also changed by adding a note about uninhabited references
still counting as inhabited.
2021-01-03 20:49:35 +01:00
Daniel Noom
998bf0ab88 Add note to non-exhaustive match on reference to empty
Rust prints "type `&A` is non-empty" even is A is empty.
This is the intended behavior, but can be confusing.
This commit adds a note to non-exhaustive pattern errors if they are a
reference to something uninhabited.

I did not add tests to check that the note is not shown for
non-references or inhabited references, because this is already done
in other tests.

Maybe the added test is superfluous, because
`always-inhabited-union-ref` already checks for this case.

This does not handle &&Void or &&&void etc. I could add those as special
cases as well and ignore people who need quadruple
references.

Fixes #78123
2021-01-03 19:05:23 +01:00
bool
514b0ce9d2 Fixed documentation error 2021-01-03 19:54:54 +02:00
bors
db69136369 Auto merge of #80655 - GuillaumeGomez:rollup-ai7soid, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #80580 (Add suggestion for "ignore" doc code block)
 - #80591 (remove allow(incomplete_features) from std)
 - #80617 (Detect invalid rustdoc test commands)
 - #80628 (reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats))
 - #80646 (Clean up in `each_child_of_item`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-03 17:42:27 +00:00
Dániel Buga
4b612dd9cc Only report reference-style link errors once
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-01-03 17:44:59 +01:00
Guillaume Gomez
539c435b50
Rollup merge of #80646 - bugadani:meta, r=petrochenkov
Clean up in `each_child_of_item`

This PR hopes to eliminate some of the surprising elements I encountered while reading the function.
- `macros_only` is checked against inside the loop body, but if it is `true`, the loop is skipped anyway
- only query `span` when relevant
- no need to allocate attribute vector
2021-01-03 17:09:13 +01:00
Guillaume Gomez
ff1f21a8fd
Rollup merge of #80628 - matthiaskrgr:match_ref_pats, r=varkor
reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats)
2021-01-03 17:09:11 +01:00
Guillaume Gomez
fd0dbac943
Rollup merge of #80617 - GuillaumeGomez:detect-invalid-rustdoc-test-commands, r=jyn514
Detect invalid rustdoc test commands

Fixes #80570.

There are now errors displayed in case of bad command syntax:

```
---- [rustdoc] rustdoc/remove-url-from-headings.rs stdout ----

error: htmldocck failed!
status: exit code: 1
command: "/usr/bin/python" "/home/imperio/rust/rust/src/etc/htmldocck.py" "/home/imperio/rust/rust/build/x86_64-unknown-linux-gnu/test/rustdoc/remove-url-from-headings" "/home/imperio/rust/rust/src/test/rustdoc/remove-url-from-headings.rs"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
3: Invalid command: `!`@has`,` (try with ``@!has`)`
	// !`@has` - '//a[`@href="http://a.a"]'`

Encountered 1 errors
```

r? `@camelid`
2021-01-03 17:09:09 +01:00
Guillaume Gomez
2072e11730
Rollup merge of #80591 - lcnr:incomplete-features, r=RalfJung
remove allow(incomplete_features) from std

cc https://github.com/rust-lang/rust/pull/80349#issuecomment-753357123

> Now I am somewhat concerned that the standard library uses some of these features...

I think it is theoretically ok to use incomplete features in the standard library or the compiler if we know that there is an already working subset and we explicitly document what we have to be careful about. Though at that point it is probably better to try and split the incomplete feature into two separate ones, similar to `min_specialization`.

Will be interesting once `feature(const_evaluatable_checked)` works well enough to imo be used in the compiler but not yet well enough to be removed from `INCOMPLETE_FEATURES`.

r? `@RalfJung`
2021-01-03 17:09:08 +01:00
Guillaume Gomez
2686daa779
Rollup merge of #80580 - GuillaumeGomez:suggestion-ignore-codeblock-warn, r=jyn514
Add suggestion for "ignore" doc code block

Part of https://github.com/rust-lang/rust/issues/30032.

This PR adds a suggestion to help users when they have a "ignore" doc code block which is invalid rust code.

r? `@jyn514`
2021-01-03 17:09:01 +01:00
oli
90b56b94f6 Stylistic fixes to diagnostic messages 2021-01-03 15:11:34 +00:00
oli
d3992f36ad Refactor the non-transient cell borrow error diagnostic 2021-01-03 14:46:49 +00:00