Commit graph

155683 commits

Author SHA1 Message Date
Marcel Hlopko
198d90786b Add pie as another relocation-model value 2021-10-01 08:06:42 +02:00
bors
598d89bf14 Auto merge of #89414 - Manishearth:rollup-hs11bcq, r=Manishearth
Rollup of 8 pull requests

Successful merges:

 - #88782 (Fix ICE when `start` lang item has wrong generics)
 - #89202 (Resolve infered types when complaining about unexpected call type )
 - #89248 (Suggest similarly named associated items in trait impls)
 - #89303 (Add `#[must_not_suspend]` to some types in std)
 - #89306 (thread: implements available_concurrency on haiku)
 - #89314 (fix(lint): don't suggest refutable patterns to "fix" irrefutable bind)
 - #89370 (CTFE: tweak aggregate rvalue handling)
 - #89392 (bootstrap: Update comment in config.library.toml.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-01 03:23:17 +00:00
Wesley Wiser
3565e8a088 Correct caller/callsite confusion in inliner message 2021-09-30 21:39:02 -04:00
Manish Goregaokar
9ea439d158
Rollup merge of #89392 - BGR360:master, r=jyn514
bootstrap: Update comment in config.library.toml.

Downloading LLVM from CI works for all platforms now.

All other templates in this directory already have the proper comment. Seems this one was neglected.
2021-09-30 18:05:27 -07:00
Manish Goregaokar
4661464961
Rollup merge of #89370 - RalfJung:ctfe-aggregate-rvalue, r=oli-obk
CTFE: tweak aggregate rvalue handling

I have not looked at this code in ages... I think Miri does not even hit it, since (most?) aggregate rvalues are lowered somewhere in the MIR pipeline, but CTFE does hit it.

So this adds some extra sanity assertions, and removes a ZST special case -- ZST should only be special cased fairly late (when the actual memory access happens); e.g. `!` is a ZST and we still want `copy_op` to be called for it since it will perform validation (and raise UB, since `!` is never valid).
2021-09-30 18:05:26 -07:00
Manish Goregaokar
fbc67b59a1
Rollup merge of #89314 - notriddle:notriddle/lint-fix-enum-variant-match, r=davidtwco
fix(lint): don't suggest refutable patterns to "fix" irrefutable bind

In function arguments and let bindings, do not suggest changing `C` to `Foo::C` unless `C` is the only variant of `Foo`, because it won't work.

The general warning is still kept, because code like this is confusing.

Fixes #88730

p.s. `src/test/ui/lint/lint-uppercase-variables.rs` already tests the one-variant case.
2021-09-30 18:05:25 -07:00
Manish Goregaokar
fccfc981d6
Rollup merge of #89306 - devnexen:haiku_ncpus, r=nagisa
thread: implements available_concurrency on haiku
2021-09-30 18:05:24 -07:00
Manish Goregaokar
7b40d4240e
Rollup merge of #89303 - guswynn:std_suspend, r=dtolnay
Add `#[must_not_suspend]` to some types in std

I am not sure what else should have it? `Ref`?
2021-09-30 18:05:23 -07:00
Manish Goregaokar
837ac87709
Rollup merge of #89248 - hkmatsumoto:suggest-similarly-named-assoc-items, r=estebank
Suggest similarly named associated items in trait impls

Fix #85942

Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types, and constants.
2021-09-30 18:05:22 -07:00
Manish Goregaokar
b437be45ea
Rollup merge of #89202 - estebank:infer-call-type, r=oli-obk
Resolve infered types when complaining about unexpected call type

```
error[E0618]: expected function, found `{integer}`
  --> $DIR/call-block.rs:2:13
   |
LL |     let _ = {42}();
   |             ^^^^--
   |             |
   |             call expression requires function
```
instead of
```
error[E0618]: expected function, found `_`
  --> $DIR/call-block.rs:2:13
   |
LL |     let _ = {42}();
   |             ^^^^--
   |             |
   |             call expression requires function
```
2021-09-30 18:05:21 -07:00
Manish Goregaokar
3d86aac990
Rollup merge of #88782 - asquared31415:issue-79559, r=cjgillot
Fix ICE when `start` lang item has wrong generics

In my previous pr #87875 I missed the requirements on the `start` lang item due to its relative difficulty to test and opting for more conservative estimates.  This fixes that by updating the requirement to be exactly one generic type.

The `start` lang item should have exactly one generic type for the return type of the `main` fn ptr passed to it.  I believe having zero would previously *sometimes* compile (often with the use of `fn() -> ()` as the fn ptr but it was likely UB to call if the return type of `main` was not `()` as far as I know) however it also sometimes would not for various errors including ICEs and LLVM errors depending on exact situations.  Having more than 1 generic has always failed with an ICE because only the one generic type is expected and provided.

Fixes #79559, fixes #73584, fixes #83117 (all duplicates)
Relevant to #9307

r? ````@cjgillot````
2021-09-30 18:05:20 -07:00
bors
1c0ed0d4c4 Auto merge of #89183 - cjgillot:noenc, r=oli-obk
Move encode_metadata out of CrateStore.

`rustc_metadata` is already accessible by all client crates. It does not need to be called trough a trait object.
2021-10-01 00:35:35 +00:00
Sebastian Pop
0f9f241aac [aarch64] add target feature outline-atomics
Enable outline-atomics by default as enabled in clang by the following commit
https://reviews.llvm.org/rGc5e7e649d537067dec7111f3de1430d0fc8a4d11

Performance improves by several orders of magnitude when using the LSE instructions
instead of the ARMv8.0 compatible load/store exclusive instructions.

Tested on Graviton2 aarch64-linux with
x.py build && x.py install && x.py test
2021-09-30 23:34:33 +00:00
Rémy Rakic
bec19a72dd add regression test for issue 89119 2021-09-30 22:55:05 +02:00
Matthew Jasper
051d5b0118 Fix standard library for min_specialization changes 2021-09-30 21:42:41 +01:00
Matthew Jasper
c8f86cad2d Elaborate predicates in min_specialization checks
Supertraits of specialization markers could circumvent checks for
min_specialization. Elaborating predicates prevents this.
2021-09-30 21:42:09 +01:00
bors
aa7aca3b95 Auto merge of #89282 - sexxi-goose:fix-88118, r=nikomatsakis
2229: Consume IfLet expr

When using the IfLet guard feature, we can ICE when attempting to resolve PlaceBuilders.
For pattern matching, we currently don't consume the IfLet expression when "visiting" the arms leading us to not "read" all variables and hence not being able to resolve them.

r? `@nikomatsakis`
Closes https://github.com/rust-lang/rust/issues/88118
2021-09-30 20:23:47 +00:00
Chase Wilson
09f1542418
Implemented -Z randomize-layout 2021-09-30 14:50:06 -05:00
The8472
ffd7ade203 fix issues pointed out in review 2021-09-30 21:23:30 +02:00
the8472
6654a0bbdc from review: code style
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-09-30 21:23:30 +02:00
The8472
2c6e67105e implement advance_(back_)_by on more iterators 2021-09-30 21:23:28 +02:00
Mark Rousskov
56fcf0725a Avoid nondeterminism in trimmed_def_paths
Previously this query depended on the global interning order of Symbols, which
meant that irrelevant changes could influence the query and cause
recompilations. This commit ensures that the return set is stable and will not
be affected by the global order by deterministically (in lexicographic order)
choosing a name to use if there are multiple names for a single DefId.
2021-09-30 14:27:57 -04:00
Camille GILLOT
2d51b78ca9 Rebase fallout. 2021-09-30 20:22:42 +02:00
pierwill
7ed75ce97c Recommend running cargo clean in E0514 output 2021-09-30 12:52:51 -05:00
Camille Gillot
79d14751a3 Update compiler/rustc_codegen_cranelift/scripts/filter_profile.rs
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-09-30 19:41:32 +02:00
Camille GILLOT
ea6b7996b5 Update run-make-fulldeps. 2021-09-30 19:41:32 +02:00
Camille GILLOT
b244b98e7c Move EncodedMetadata to rustc_metadata. 2021-09-30 19:41:32 +02:00
Camille GILLOT
df54d3980b Move encode_metadata out of CrateStore. 2021-09-30 19:41:31 +02:00
Cameron Steffen
f5e4f78eb7 Add private arg to fmt::UnsafeArg 2021-09-30 12:32:05 -05:00
Ben Reeves
098d86236b bootstrap: Update comment (again) in config.library.toml 2021-09-30 11:25:20 -05:00
Owen Gage
e8e7f6e05c Add truncate note to Vec::resize 2021-09-30 17:21:03 +01:00
Camille Gillot
77c300285c Apply suggestions from code review
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2021-09-30 17:40:17 +02:00
Camille GILLOT
659b0a2fd9 Bless tests. 2021-09-30 17:40:15 +02:00
Camille GILLOT
faa7d4221b Do not pass hir::Crate to lints. 2021-09-30 17:39:54 +02:00
Tyler Hart
35b0015b09
Improve wording of map_or_else docs
Changes doc text to refer to the "default" parameter as the "default"
function.
2021-09-30 11:12:09 -04:00
Wesley Wiser
c20eebac2d Update llvm submodule to fix function name mangling on x86 Windows
Fixes #89307
2021-09-30 10:03:12 -04:00
bors
6dc08b909b Auto merge of #87998 - nneonneo:master, r=oli-obk
Avoid spurious "previous iteration of loop" errors

Only follow backwards edges during `get_moved_indexes` if the move path is definitely initialized at loop entry. Otherwise, the error occurred prior to the loop, so we ignore the backwards edges to avoid generating misleading "value moved here, in previous iteration of loop" errors.

This patch also slightly improves the analysis of inits, including `NonPanicPathOnly` initializations (which are ignored by `drop_flag_effects::for_location_inits`). This is required for the definite initialization analysis, but may also help find certain skipped reinits in rare cases.

Patch passes all non-ignored src/test/ui testcases.

Fixes #72649.
2021-09-30 13:23:09 +00:00
Alik Aslanyan
d98ac573a4
Remove visible path calculation from allowed deprecation lint 2021-09-30 15:15:10 +04:00
bors
c6007fdc70 Auto merge of #86853 - usbalbin:const_try, r=oli-obk
Constify ?-operator for Result and Option

Try to make `?`-operator usable in `const fn` with `Result` and `Option`, see #74935 . Note that the try-operator itself was constified in #87237.

TODO
* [x] Add tests for const T -> T conversions
* [x] cleanup commits
* [x] Remove `#![allow(incomplete_features)]`
* [?] Await decision in #86808 - I'm not sure
* [x] Await support for parsing `~const` in bootstrapping compiler
* [x] Tracking issue(s)? - #88674
2021-09-30 10:35:24 +00:00
bors
69c1c6a173 Auto merge of #89250 - Aaron1011:keep-bound-region-names, r=estebank
Don't anonymize bound region names during typeck

Once this anonymization has performed, we have no
way of recovering the original names during NLL
borrow checking. Keeping the original names allows
error messages in full NLL mode to contain the original
bound region names.

As a result, the typeck results may contain types that
differ only in the names used for their bound regions. However,
anonimization of bound regions does not guarantee that
all distinct types are unqual (e.g. not subtypes of each other).
For example, `for<'a> fn(&'a u32, &'a u32)` and
`for<'b, 'c> fn(&'b u32, &'c u32)` are subtypes of each other,
as explained here:

63cc2bb3d0/compiler/rustc_infer/src/infer/nll_relate/mod.rs (L682-L690)

Therefore, any code handling types with higher-ranked regions already
needs to handle the case where two distinct `Ty`s are 'actually'
equal.
2021-09-30 07:33:59 +00:00
Ben Reeves
1cf905fdab bootstrap: Update comment in config.library.toml.
Downloading LLVM from CI works for all platforms now.
2021-09-30 02:05:42 -05:00
bors
30acf6def3 Auto merge of #89386 - ehuss:rollup-idf4dmj, r=ehuss
Rollup of 13 pull requests

Successful merges:

 - #87428 (Fix union keyword highlighting in rustdoc HTML sources)
 - #88412 (Remove ignore-tidy-undocumented-unsafe from core::slice::sort)
 - #89098 (Fix generics where bounds order)
 - #89232 (Improve help for recursion limit errors)
 - #89294 (⬆️ rust-analyzer)
 - #89297 (Remove Never variant from clean::Type enum)
 - #89311 (Add unit assignment to MIR for `asm!()`)
 - #89313 (PassWrapper: handle function rename from upstream D36850)
 - #89315 (Clarify that `CString::from_vec_unchecked` appends 0 byte.)
 - #89335 (Optimize is_sorted for Range and RangeInclusive)
 - #89366 (rustdoc: Remove lazy_static dependency)
 - #89377 (Update cargo)
 - #89378 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-09-30 04:51:41 +00:00
Eric Huss
20c95302e0
Rollup merge of #89378 - ehuss:update-books, r=ehuss
Update books

## nomicon

1 commits in fe6227eb3c8533200c52dffa42ef1b6f2f02c40e..2747c4bb2cbc0639b733793ddb0bf4e9daa2634e
2021-08-31 05:42:38 +0900 to 2021-09-19 17:33:32 +0900
- Clarify a bit of wording (rust-lang/nomicon#310)

## reference

2 commits in 0e5ed7a4bec065f0cc18c35d1c904639e095314d..13747275bd14c2d2b453100498532f9ae5504769
2021-08-29 17:33:21 +0900 to 2021-09-24 17:44:04 +0900
-  (rust-lang/reference#1087)
- Document RangeFrom patterns (rust-lang/reference#900)

## book

4 commits in fcb5e0ea68112d85a1d29a7a7335978ef2a02181..eb1282ec444db94055fa9531b6f3f803e86bb382
2021-08-31 21:26:19 -0400 to 2021-09-16 21:17:09 -0400
- Rust 1.55 (rust-lang/book#2890)
- Chapter 3.3: Remove unused variable (rust-lang/book#2877)
- Appendix (operators and symbols): remove extra space (rust-lang/book#2876)
- Chapter 17.1: add missing comma (rust-lang/book#2867)

## rust-by-example

2 commits in 9d4132b56c4999cd3ce1aeca5f1b2f2cb0d11c24..28aca4a36962c709bce301c03114b5589381dfb8
2021-09-14 06:56:00 -0300 to 2021-09-25 08:19:51 -0300
- fix formatting (rust-lang/rust-by-example#1463)
- involving === verb, involved === adjective (rust-lang/rust-by-example#1461)

## rustc-dev-guide

7 commits in 9198465b6ca8bed669df0cbb67c0e6d0b140803c..d1f03cbaa39d9164f5fe4b9b93762668142e0dad
2021-09-12 11:50:44 -0500 to 2021-09-24 12:00:29 +0900
- Fix a typo on closure.md (rust-lang/rustc-dev-guide#1218)
- const generics update
- s/--blessed/--bless/
- Make indentation consistent in example vscode config file
- Suggests `--edition=2018` argument when using stage0/bin/rustfmt directly
- `ty::Unevaluated`: dealing with unused substs (rust-lang/rustc-dev-guide#1190)
- Parallel codegen (rust-lang/rustc-dev-guide#1206)
2021-09-29 19:33:45 -07:00
Eric Huss
4bb478967d
Rollup merge of #89377 - ehuss:update-cargo, r=ehuss
Update cargo

5 commits in 0121d66aa2ef5ffa9735f86c2b56f5fdc5a837a6..d56b42c549dbb7e7d0f712c51b39400260d114d4
2021-09-22 16:08:27 +0000 to 2021-09-27 13:44:18 +0000
- Allow `cargo update --precise` with metadata. (rust-lang/cargo#9945)
- Support path_in_vcs as part of cargo_vcs_metadata (rust-lang/cargo#9866)
- Doc about InstallTracker files and `install.root` (rust-lang/cargo#9948)
- Add some clarity on the license/license-file warning. (rust-lang/cargo#9941)
- Fix the problem that help cannot be displayed properly (rust-lang/cargo#9933)
2021-09-29 19:33:44 -07:00
Eric Huss
9a77b21114
Rollup merge of #89366 - GuillaumeGomez:remove-lazy-static, r=jyn514
rustdoc: Remove lazy_static dependency

The macro was used in only one place and there are equivalents in the std, so it seemed weird to keep it around...

I think running a perf check would be a good idea though, just in case.

r? ``@jyn514``
2021-09-29 19:33:43 -07:00
Eric Huss
8f9f3aa04d
Rollup merge of #89335 - mbrubeck:range-is-sorted, r=cuviper
Optimize is_sorted for Range and RangeInclusive

The [`Step`] trait guarantees that `Range<impl Step>` yields items in sorted order.  We can override `Iterator::is_sorted` based on this guarantee, as we already do for `Iterator::min` and `max`.

Thank you to ``@fiveseven-lambda`` who pointed this out [on the Rust Users Forum](https://users.rust-lang.org/t/is-sorted-method-in-impl-iterator-for-range/64717).

[`Step`]: https://doc.rust-lang.org/stable/std/iter/trait.Step.html
2021-09-29 19:33:42 -07:00
Eric Huss
e392f5d90d
Rollup merge of #89315 - et342:cstr_from_vec_unchecked_doc, r=yaahc
Clarify that `CString::from_vec_unchecked` appends 0 byte.
2021-09-29 19:33:41 -07:00
Eric Huss
403e221dcf
Rollup merge of #89313 - durin42:llvm-14-thinLTOResolvePrevailingInModule, r=nikic
PassWrapper: handle function rename from upstream D36850

thinLTOResolvePrevailingInModule became thinLTOFinalizeInModule and
gained the ability to propagate noRecurse and noUnwind function
attributes. I ran codegen tests with it both on and off, as the upstream
patch uses it in both modes, and the tests pass both ways. Given that,
it seemed reasonable to go ahead and let the propagation be enabled in
rustc, and see what happens. See https://reviews.llvm.org/D36850 for
more examples of how the new version of the function gets used.

r? ``@nikic`` cc ``@nagisa``
2021-09-29 19:33:40 -07:00
Eric Huss
c5f8675291
Rollup merge of #89311 - FabianWolff:issue-89305, r=oli-obk
Add unit assignment to MIR for `asm!()`

Fixes #89305. `ExprKind::LlvmInlineAsm` gets a `push_assign_unit()` here:
2b6ed3b675/compiler/rustc_mir_build/src/build/expr/into.rs (L475-L479)

The same should probably happen for `ExprKind::InlineAsm`, which fixes the "use of possibly-uninitialized variable" error described in #89305.
2021-09-29 19:33:39 -07:00
Eric Huss
8dfe52293a
Rollup merge of #89297 - GuillaumeGomez:remove-never-from-type-enum, r=camelid
Remove Never variant from clean::Type enum

Fixes #89287.

r? ``@camelid``
2021-09-29 19:33:38 -07:00