Commit Graph

136409 Commits

Author SHA1 Message Date
Steven Fackler
5cb830397e make check a bit more clear 2021-01-11 17:13:50 -05:00
bors
fe531d5a5f Auto merge of #79012 - tgnottingham:span_data_to_lines_and_cols, r=estebank
rustc_span: add span_data_to_lines_and_cols to caching source map view
2021-01-11 21:32:50 +00:00
Gus Caplan
5ba3be1d60
squash! fix wasi 2021-01-11 15:31:52 -06:00
Gus Caplan
8f64cec022
new target 2021-01-11 14:22:41 -06:00
Gus Caplan
94bf59ea34
Use correct ABI for wasm32 by default
Introduces `RUSTC_USE_WASM32_BINDGEN_COMPAT_ABI` env var to use the
compat ABI if need.
2021-01-11 14:22:38 -06:00
Tyson Nottingham
f15fae822e rustc_serialize: fix incorrect signed LEB128 decoding
The signed LEB128 decoding function used a hardcoded constant of 64
instead of the number of bits in the type of integer being decoded,
which resulted in incorrect results for some inputs. Fix this, make the
decoding more consistent with the unsigned version, and increase the
LEB128 encoding and decoding test coverage.
2021-01-11 12:13:26 -08:00
Tyson Nottingham
52f21791fb Serialize incr comp structures to file via fixed-size buffer
Reduce a large memory spike that happens during serialization by writing
the incr comp structures to file by way of a fixed-size buffer, rather
than an unbounded vector.

Effort was made to keep the instruction count close to that of the
previous implementation. However, buffered writing to a file inherently
has more overhead than writing to a vector, because each write may
result in a handleable error. To reduce this overhead, arrangements are
made so that each LEB128-encoded integer can be written to the buffer
with only one capacity and error check. Higher-level optimizations in
which entire composite structures can be written with one capacity and
error check are possible, but would require much more work.

The performance is mostly on par with the previous implementation, with
small to moderate instruction count regressions. The memory reduction is
significant, however, so it seems like a worth-while trade-off.
2021-01-11 12:13:22 -08:00
Santiago Pastorino
82d0c597bf
Revert "Auto merge of #76896 - spastorino:codegen-inline-fns2, r=davidtwco,wesleywiser"
This reverts commit ddf2cc7f8e, reversing
changes made to 937f629535.
2021-01-11 16:27:59 -03:00
bors
c5eae56293 Auto merge of #75490 - LukasKalbertodt:add-basic-array-methods, r=dtolnay
Add `[T; N]::each_ref` and `[T; N]::each_mut`

This PR adds the methods `each_ref` and `each_mut` to `[T; N]`. The ability to add methods to arrays was added in #75212. These two methods are particularly useful with `map` which was also added in that PR. Tracking issue: #76118

```rust
impl<T, const N: usize> [T; N] {
    pub fn each_ref(&self) -> [&T; N];
    pub fn each_mut(&mut self) -> [&mut T; N];
}
```
2021-01-11 18:50:53 +00:00
Jeremy Fitzhardinge
d7ce9d5b6d test for issue 80832 2021-01-11 10:44:46 -08:00
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
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