Commit graph

136451 commits

Author SHA1 Message Date
jumbatm
4b740acea2 Add FIXME note about storing &'tcx str 2021-01-12 03:31:01 +10:00
jumbatm
7a46a4f219 Remove unnecessary allocation. 2021-01-12 03:31:01 +10:00
jumbatm
15c64a181b Use tcx.symbol_name to check for clashes. 2021-01-12 03:31:00 +10:00
jumbatm
6318db1c5a Add test case for wasm non-clash. 2021-01-12 03:31:00 +10:00
oli
e90b521a15 --emit=mir now emits both mir_for_ctfe and optimized_mir for const fn 2021-01-11 17:24:41 +00:00
Manos Pitsidianakis
0be9d39336
core/slice: remove doc comment about scoped borrow
There's no need to scope the borrow in the doc example due to NLL.

Playground link where changed code compiles
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=fn%20main()%20%7B%0A%20%20%20%20let%20mut%20v%20%3D%20%5B1%2C%200%2C%203%2C%200%2C%205%2C%206%5D%3B%0A%0A%20%20%20%20let%20(left%2C%20right)%20%3D%20v.split_at_mut(2)%3B%0A%20%20%20%20assert_eq!(left%2C%20%5B1%2C%200%5D)%3B%0A%20%20%20%20assert_eq!(right%2C%20%5B3%2C%200%2C%205%2C%206%5D)%3B%0A%20%20%20%20left%5B1%5D%20%3D%202%3B%0A%20%20%20%20right%5B1%5D%20%3D%204%3B%0A%0A%20%20%20%20assert_eq!(v%2C%20%5B1%2C%202%2C%203%2C%204%2C%205%2C%206%5D)%3B%0A%7D%0A
2021-01-11 18:55:35 +02:00
bors
6526e5c772 Auto merge of #80889 - cjgillot:asa, r=oli-obk
Do not query the HIR directly in `opt_associated_item`.

Papercut found by `@Aaron1011.`
2021-01-11 14:54:52 +00:00
Steven Fackler
a9ef7983a6 clean up control flow 2021-01-11 07:48:24 -05:00
Steven Fackler
ebe402dc9e Fix handling of malicious Readers in read_to_end 2021-01-11 07:27:03 -05:00
Lukas Kalbertodt
4038042eb0
Add [T; N]::each_ref and [T; N]::each_mut
These methods work very similarly to `Option`'s methods `as_ref` and
`as_mut`. They are useful in several situation, particularly when
calling other array methods (like `map`) on the result. Unfortunately,
we can't easily call them `as_ref` and `as_mut` as that would shadow
those methods on slices, thus being a breaking change (that is likely
to affect a lot of code).
2021-01-11 01:09:22 -08:00
CoffeeBlend
dec8c033a3
Add tracking issue for array_assume_init 2021-01-11 10:07:29 +01:00
bors
a2cd91ceb0 Auto merge of #80905 - JohnTitor:rollup-tmmwmnb, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #80809 (Use standard formatting for "rust-call" ABI message)
 - #80872 (Fix typo in source-based-code-coverage.md)
 - #80878 (Add ABI argument to `find_mir_or_eval_fn`)
 - #80881 ( Fix intra-doc links to `Self` and `crate` )
 - #80887 (log-color: Detect TTY based on stderr, not stdout)
 - #80892 (rustdoc: Remove `*` intra-doc alias for `pointer`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-11 06:09:50 +00:00
Yuki Okushi
a7f7d70860
Rollup merge of #80892 - camelid:intra-doc-remove-star, r=jyn514
rustdoc: Remove `*` intra-doc alias for `pointer`

It's not valid Rust code and it can easily be confused with a wildcard
glob pattern or something else. People can always use `pointer` instead,
so it's just removing an alias.

It hasn't hit stable yet (I think it's still on nightly), so it's okay
to remove it. (We can always add it back later if we change our mind
too.)

r? `@jyn514`
cc https://github.com/rust-lang/rust/pull/80885#discussion_r554622737
2021-01-11 14:34:54 +09:00
Yuki Okushi
293a491935
Rollup merge of #80887 - camelid:fix-log-color-auto, r=RalfJung
log-color: Detect TTY based on stderr, not stdout

Fixes #78435 (again).

Logging goes to stderr, not stdout, so we should base our automated
detection on stderr instead of stdout.

Thanks to Ralf Jung for noticing and reporting the bug!

r? `@oli-obk`
cc `@RalfJung`
2021-01-11 14:34:52 +09:00
Yuki Okushi
6e2249d2fd
Rollup merge of #80881 - jyn514:intra-doc-self, r=GuillaumeGomez
Fix intra-doc links to `Self` and `crate`

Closes https://github.com/rust-lang/rust/issues/77732.
2021-01-11 14:34:51 +09:00
Yuki Okushi
95a6279de7
Rollup merge of #80878 - unseddd:abi, r=RalfJung
Add ABI argument to `find_mir_or_eval_fn`

Add ABI argument for called function in `find_mir_or_eval_fn` and
`call_extra_fn`. Useful for comparing with expected ABI in interpreters.

Related to [miri/1631](https://github.com/rust-lang/miri/issues/1631)

r? `@RalfJung`
2021-01-11 14:34:49 +09:00
Yuki Okushi
e728fcbaaf
Rollup merge of #80872 - eltociear:patch-4, r=jonas-schievink
Fix typo in source-based-code-coverage.md

preceeding -> preceding
2021-01-11 14:34:47 +09:00
Yuki Okushi
dcd46bfd31
Rollup merge of #80809 - camelid:rust-call-abi-msg, r=lcnr
Use standard formatting for "rust-call" ABI message

Nearly all error messages start with a lowercase letter and don't use
articles - instead they refer to the plural case.
2021-01-11 14:34:40 +09:00
Camelid
e2d3a25161 Fix small typo
transmutting -> transmuting
2021-01-10 21:24:32 -08:00
bors
00c5c3922f Auto merge of #80818 - 12101111:system-libunwind, r=Mark-Simulacrum
Don't build in-tree llvm-libunwind if system-llvm-libunwind is enable

When "system-llvm-libunwind" is enabled, some target eg. musl still build in-tree llvm-libunwind which is useless.
2021-01-11 03:24:14 +00:00
Yuki Okushi
39e1331cfa Add another test case for #79808
Taken from #80293.
2021-01-11 12:10:16 +09:00
William Bain
d46c3e3411 Tweak ? inference error messages 2021-01-10 19:48:11 -05:00
William Bain
62a39ed526 Extract parent def handling for infer failure err 2021-01-10 19:48:11 -05:00
William Bain
b9d9776fea Refactor cannot infer ... message rendering 2021-01-10 19:48:10 -05:00
William Bain
0496fdee4f Note inference failures using ? conversion 2021-01-10 19:47:57 -05:00
Camelid
e98f11b27d rustdoc: Remove * intra-doc alias for pointer
It's not valid Rust code and it can easily be confused with a wildcard
glob pattern or something else. People can always use `pointer` instead,
so it's just removing an alias.

It hasn't hit stable yet (I think it's still on nightly), so it's okay
to remove it. (We can always add it back later if we change our mind
too.)
2021-01-10 15:41:32 -08:00
bors
26d451f4b3 Auto merge of #80782 - petrochenkov:viscopes, r=matthewjasper
resolve: Scope visiting doesn't need an `Ident`

Resolution scope visitor (`fn visit_scopes`) currently takes an `Ident` parameter, but it doesn't need a full identifier, or even its span, it only needs the `SyntaxContext` part.
The `SyntaxContext` part is necessary because scope visitor has to jump to macro definition sites, so it has to be directed by macro expansion information somehow.

I think it's clearer to pass only the necessary part.
Yes, usually visiting happens as a part of an identifier resolution, but in cases like collecting traits in scope (#80765) or collecting typo suggestions that's not the case.

r? `@matthewjasper`
2021-01-10 23:36:33 +00:00
Camille GILLOT
21e1963e9c Do not query the HIR in opt_associated_item. 2021-01-10 22:41:50 +01:00
Camelid
7af29abbc1 log-color: Detect TTY based on stderr, not stdout
Logging goes to stderr, not stdout, so we should base our automated
detection on stderr instead of stdout.

Thanks to Ralf Jung for noticing and reporting the bug!
2021-01-10 13:22:15 -08:00
Camelid
2750e36209 rustdoc: Resolve &str as str
People almost always are referring to `&str`, not `str`, so this will
save a manual link resolve in many cases.

Note that we already accept `&` (resolves to `reference`) in intra-doc
links, so this shouldn't cause breakage.
2021-01-10 12:51:48 -08:00
bors
c97f11af7b Auto merge of #79414 - sasurau4:feature/add-suggestion-for-pattern-in-fns-without-body, r=matthewjasper
Add suggestion for PATTERNS_IN_FNS_WITHOUT_BODY

## Overview

Fix #78927
2021-01-10 20:48:27 +00:00
Camelid
6488aecb74 Use standard formatting for "rust-call" ABI message
Nearly all error messages start with a lowercase letter and don't use
articles - instead they refer to the plural case.
2021-01-10 12:17:24 -08:00
bors
080ee6f5d7 Auto merge of #80789 - Aaron1011:fix/stmt-empty, r=petrochenkov
Synthesize a `TokenStream` for `StmtKind::Empty`

Fixes #80760
2021-01-10 17:58:38 +00:00
Joshua Nelson
690aeaf087 Box Item::attributes
This reduces the size of Item from 136 to 48 bytes.
2021-01-10 10:39:36 -05:00
Nym Seddon
06fd212d6a
Add ABI argument to find_mir_or_eval_fn
Add ABI argument for called function in `find_mir_or_eval_fn` and
`call_extra_fn`. Useful for comparing with expected ABI in interpreters.

Related to [miri/1631](https://github.com/rust-lang/miri/issues/1631)
2021-01-10 15:12:50 +00:00
Joshua Nelson
a52341d784 Small cleanups 2021-01-10 10:00:41 -05:00
Joshua Nelson
0acaa5af6b Fix intra-doc links to Self and crate 2021-01-10 10:00:17 -05:00
Stein Somers
c1dfb4a9c4 BTreeMap: tougher checks on code using raw into_kv_pointers 2021-01-10 14:40:21 +01:00
LingMan
578da998af Merge different function exits 2021-01-10 14:38:14 +01:00
Ikko Ashimine
9ca80a29ec
Fix typo in source-based-code-coverage.md
preceeding -> preceding
2021-01-10 22:17:51 +09:00
Patryk Wychowaniec
d2f8e398f1
Rework diagnostics for wrong number of generic args 2021-01-10 13:07:40 +01:00
Vadim Petrochenkov
f9b5859173 resolve: Simplify built-in macro table 2021-01-10 14:48:47 +03:00
bors
fd34606ddf Auto merge of #80391 - ssomers:btree_cleanup_slices_3, r=Mark-Simulacrum
BTreeMap: tougher checking on most uses of copy_nonoverlapping

Miri checks pointer provenance and destination, but we can check it in debug builds already.
Also, we can let Miri confirm we don't mistake imprints of moved keys and values as genuine.
r? `@Mark-Simulacrum`
2021-01-10 10:48:55 +00:00
bors
34628e5b53 Auto merge of #80867 - JohnTitor:rollup-tvqw555, r=JohnTitor
Rollup of 9 pull requests

Successful merges:

 - #79502 (Implement From<char> for u64 and u128.)
 - #79968 (Improve core::ptr::drop_in_place debuginfo)
 - #80774 (Fix safety comment)
 - #80801 (Use correct span for structured suggestion)
 - #80803 (Remove useless `fill_in` function)
 - #80820 (Support `download-ci-llvm` on NixOS)
 - #80825 (Remove under-used ImplPolarity enum)
 - #80850 (Allow #[rustc_builtin_macro = "name"])
 - #80857 (Add comment to `Vec::truncate` explaining `>` vs `>=`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-10 08:01:12 +00:00
Yuki Okushi
19b8c65e4e
Rollup merge of #80857 - camelid:vec-truncate-comment, r=scottmcm
Add comment to `Vec::truncate` explaining `>` vs `>=`

Hopefully this will prevent people from continuing to ask about this
over and over again :)

See [this Zulip discussion][1] for more.

[1]: https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Vec.3A.3Atruncate.20implementation

r? ``@scottmcm``
2021-01-10 16:56:07 +09:00
Yuki Okushi
3e735c6e93
Rollup merge of #80850 - m-ou-se:rustc-builtin-macro-name, r=petrochenkov
Allow #[rustc_builtin_macro = "name"]

This adds the option of specifying the name of a builtin macro in the `#[rustc_builtin_macro]` attribute: `#[rustc_builtin_macro = "name"]`.

This makes it possible to have both `std::panic!` and `core::panic!` as a builtin macro, by using different builtin macro names for each. This is needed to implement the edition-specific behaviour of the panic macros of RFC 3007.

Also removes `SyntaxExtension::is_derive_copy`, as the macro name (e.g. `sym::Copy`) is now tracked and provides that information directly.

r? ``@petrochenkov``
2021-01-10 16:56:05 +09:00
Yuki Okushi
5acac4c979
Rollup merge of #80825 - GuillaumeGomez:rustdoc-cleanup-bis-repetita, r=jyn514
Remove under-used ImplPolarity enum

It doesn't make much sense to have an enum with only two possible values and to store it inside an `Option` in my opinion when you can do all the same with a simple boolean. I don't expect any chances, performance or RSS usage wise.

r? ``@jyn514``
2021-01-10 16:56:03 +09:00
Yuki Okushi
4f43b77bb6
Rollup merge of #80820 - nagisa:nagisa/dcl-nixos, r=Mark-Simulacrum
Support `download-ci-llvm` on NixOS

In particular, the CI built `libLLVM-*.so` needs to have `libz.so`
RPATHed so that binaries like `llvm-config` work at all.
2021-01-10 16:56:02 +09:00
Yuki Okushi
c2bbd0c697
Rollup merge of #80803 - jyn514:cleanup-fill-in, r=GuillaumeGomez
Remove useless `fill_in` function

It was only used once, in a function that was otherwise trivial.
2021-01-10 16:56:00 +09:00
Yuki Okushi
700f3f23d8
Rollup merge of #80801 - estebank:correct-binding-sugg-span, r=petrochenkov
Use correct span for structured suggestion

On structured suggestion for `let` -> `const`  and `const` -> `let`, use
a proper `Span` and update tests to check the correct application.

Follow up to #80012.
2021-01-10 16:55:59 +09:00