Commit graph

167158 commits

Author SHA1 Message Date
Michael Goulet 42dbbabcb0 Suggest replacing _ in type signature of impl for Trait 2022-04-24 14:49:29 -07:00
Gary Guo 1af3e0a65e Ensure #[used] symbols are preserved in LTO 2022-04-24 22:32:05 +01:00
Joshua Nelson 68ef667b2e Remove dead code in rustdoc shim
The `RUSTDOC_RESOURCE_SUFFIX` variable was never actually set.
2022-04-24 14:53:49 -05:00
marmeladema e10aa1586d Use revisions instead of nll compare mode for /regions/ ui tests 2022-04-24 21:30:35 +02:00
bors 18f314e702 Auto merge of #94609 - esp-rs:esp-idf-stat-type-fixes, r=Mark-Simulacrum
espidf: fix stat

Marking as draft as currently dependant on [a libc fix](https://github.com/rust-lang/libc/pull/2708) and release.
2022-04-24 19:16:20 +00:00
Keita Nonaka a40cd2aa8b test: add test cases for VecDeque 2022-04-24 11:43:07 -07:00
Emil Gardström 2e47271cb8
only show a simple description in E0133 span label 2022-04-24 18:33:07 +02:00
Emil Gardström 8b8f6653cf
add DefId to unsafety violations and display function path in E0133
this enables consumers to access the function definition that was reported to be unsafe
2022-04-24 18:33:06 +02:00
bors 5cdab3a8db Auto merge of #96363 - matthiaskrgr:rollup-mthdja5, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #94893 (diagnostics: regression test for `<usize as Iterator>::rev`)
 - #95504 (Add `x {check,build,doc} {compiler,library}` aliases.)
 - #96237 (compiletest: combine `--*-python` args)
 - #96303 (Improve bootstrap tests)
 - #96352 (Improve span for `consider adding an explicit lifetime bound` suggestions under NLL)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-24 16:22:40 +00:00
Matthias Krüger aef9eb50cd
Rollup merge of #96352 - marmeladema:fix-nll-lifetime-bound-suggestions, r=jackh726
Improve span for `consider adding an explicit lifetime bound` suggestions under NLL

Because NLL borrowck is run after typeck, `in_progress_typeck_results` was always `None` which was preventing the retrieval of the span to which the suggestion is suppose to add the lifetime bound.
We now manually pass the `LocalDefId` owner to `construct_generic_bound_failure` so that under NLL, we give the owner id of the current body.

This helps with #96332
2022-04-24 18:00:27 +02:00
Matthias Krüger 7daa1c92ec
Rollup merge of #96303 - jyn514:improved-bootstrap-tests, r=Mark-Simulacrum
Improve bootstrap tests

- Don't checkout submodules in bootstrap tests

  This doesn't cause any tests to fail, and can greatly speed them up.

- Add a test for --exclude test::XXX

  I didn't know that the `test::` syntax was valid before, and it doesn't seem to be documented anywhere. Add a test so it doesn't regress accidentally, and as executable documentation.
  This also moves the `exclude` tests out of `dist`, to avoid assertion errors when the `cmd` passed to configure didn't match the `subcommand` used.

- Use run_build helper consistently across most bootstrap tests
  This is not super important to do, but the consistency is nice.

  I didn't change any tests that call `configure("dist")` and then override the subcommand - doing
that at all is pretty sketchy, but I don't want to mess with it while already doing a refactor.

Found while working on the "one call to Step for all paths" change mentioned in https://github.com/rust-lang/rust/pull/95503#issuecomment-1105914384, but independent of that work.

cc `@pietroalbini` for the `--exclude` test, git blame says you added support for it originally.
2022-04-24 18:00:27 +02:00
Matthias Krüger e1935cc196
Rollup merge of #96237 - AlecGoncharow:issue-96011-fix, r=Mark-Simulacrum
compiletest: combine `--*-python` args

Since these arguments are now always the same, combine them into a
singular `--python` argument.

Fixes #96011
2022-04-24 18:00:26 +02:00
Matthias Krüger 472404039e
Rollup merge of #95504 - jyn514:library-alias, r=Mark-Simulacrum
Add `x {check,build,doc} {compiler,library}` aliases.

While working on https://github.com/rust-lang/rust/pull/95503, I realized that it will interfere with existing command lines:
Currently people run `x build library/std` expecting it to "add all library crates to the sysroot",
but after that change, it will *only* build `libstd` and its dependencies (and add them to the sysroot), not libtest or libproc_macro.

That will work for local testing in most cases, but could be confusing. Even if not, though, I think `x build library` is more clear about what actually happens than the current `x build library/std`.

The intended end goal is something like:
- For check/build/doc, we have library + compiler aliases, which correspond to basically "most possible" for that piece. This is the intended path of entry (rather than library/test or similar as today) for when you just want the thing to work -- for example, getting a compiler that is "crates.io-compatible" would be roughly `x.py build library`). #95504
- Specific crate invocations build up to that crate, which means that if you don't care about tests you probably want x.py build library/proc_macro or library/std for faster build times. #95503

Note that this is already implemented today for the `doc` command and seems to work pretty well in practice.

I plan to change the dev-guide and various instructions in the README to `build library` once this is merged.

`@rustbot` label +A-rustbuild
2022-04-24 18:00:25 +02:00
Matthias Krüger ce0473ee03
Rollup merge of #94893 - notriddle:notriddle/regression-test-issue-90315, r=Mark-Simulacrum
diagnostics: regression test for `<usize as Iterator>::rev`

Closes #90315
2022-04-24 18:00:24 +02:00
James Higgins 0fea00759f Add type_name info to [TIMING] log output 2022-04-24 11:24:04 -04:00
Michael Howell 40c9bc06bf diagnostics: regression test for <usize as Iterator>::rev
Closes #90315
2022-04-24 11:14:13 -04:00
marmeladema 8d561d25e3 Bless tests 2022-04-24 17:04:31 +02:00
Guillaume Gomez 0233abebc8 Update rustdoc-js tester tool to work with new kind of variables 2022-04-24 15:36:34 +02:00
Guillaume Gomez 3c95c0bd62 Update settings.js to ES6 2022-04-24 15:36:15 +02:00
Guillaume Gomez 4280c816fa Update search.js to ES6 2022-04-24 15:36:02 +02:00
bors d8e59edbfa Auto merge of #96359 - SparrowLii:drop_kind, r=oli-obk
make `classify_drop_access_kind` iterate

This PR:
1. fixes the FIXME of `classify_drop_access_kind` func in the borrowck part. The process of obtaining `StorageDeadOrDrop` has been changed from recursive to iterative.
2. gets `place_ty` in each iteration, avoid repeatedly getting the `ty` of the same place (O(n^2) => O(n))
2022-04-24 12:58:16 +00:00
Gary Guo 9ebeb284b5 Fix MSVC hang issue 2022-04-24 13:13:41 +01:00
SparrowLii a34e1b58cb make classify_drop_access_kind iterate 2022-04-24 17:27:05 +08:00
b-naber f7eae4e580 include valtree creation and valtree -> constvalue conversion in debug assertions check 2022-04-24 10:59:21 +02:00
marmeladema 53120b59ae Recover missing suggestion part under NLL 2022-04-24 09:36:23 +02:00
marmeladema 7b0db3e7c8 Improve span for consider adding an explicit lifetime bound suggestions under NLL
Because NLL borrowck is run after typeck, `in_progress_typeck_results`
was always `None` which was preventing the retrieval of the span to which
the suggestion is suppose to add the lifetime bound.

We now manually pass the `LocalDefId` owner to `construct_generic_bound_failure`
so that under NLL, we give the owner id of the current body.
2022-04-24 09:34:50 +02:00
bors b759b22186 Auto merge of #96067 - jsgf:extern-nounused, r=compiler-errors
Add support for `nounused` --extern flag

This adds `nounused` to the set of extern flags:
`--extern nounused:core=/path/to/core/libcore.rlib`.

The effect of this flag is to suppress `unused-crate-dependencies`
warnings relating to the crate.
2022-04-24 07:17:20 +00:00
Jeremy Fitzhardinge 9102edf208 Add support for nounused --extern flag
This adds `nounused` to the set of extern flags:
`--extern nounused:core=/path/to/core/libcore.rlib`.

The effect of this flag is to suppress `unused-crate-dependencies`
warnings relating to the crate.
2022-04-23 23:31:54 -07:00
Esteban Küber 3587406967 Better handle too many # recovery in raw str
Point at all the unnecessary trailing `#`.
Better handle interaction with outer attributes when `;` is missing.

Fix #95030.
2022-04-23 19:51:11 -07:00
bors b21759f550 Auto merge of #96281 - SparrowLii:const_prop, r=wesleywiser
Optimize `const_prop` mir-opt by accessing `local_decls` through `ecx`

From the FIXME in the impl of `ConstPropagator`. Accessing `local_decls` and `scource_scopes` from `ecx` can reduce `clone` calls and save compile time.
Besides, according to #96213 , the FIXME about writing `layouts` to `ecx` in advance can also be removed.
2022-04-24 01:09:11 +00:00
bors 143eaa8d44 Auto merge of #93970 - cjgillot:novis, r=petrochenkov
Remove visibility information from HIR

The resolver exports all the necessary visibility information through the `tcx.visibility` query.
This PR stops having a dedicated visibility field in HIR, in order to use this query.
We keep a `vis_span` field for diagnostic purposes.
2022-04-23 22:25:51 +00:00
Camille GILLOT 0a6e1350e0 Bless pretty-print output. 2022-04-23 23:03:18 +02:00
Camille GILLOT c3276c6691 Hash visibilities in crate_hash. 2022-04-23 23:03:18 +02:00
Camille GILLOT 9861bc8d52 Compute has_pub_restricted in the resolver. 2022-04-23 23:03:18 +02:00
Camille GILLOT 88de3e52e4 Make clippy inspector more precise. 2022-04-23 23:03:18 +02:00
Camille GILLOT 423a712a16 Fix lints. 2022-04-23 23:01:19 +02:00
bors de1026a67b Auto merge of #96326 - JakobDegen:relax-operand, r=oli-obk
Relax restrictions for copy operands

This was [discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Removing.20requirement.20that.20.60Copy.60.20operands.20have.20.60Copy.60.20types/near/279102313). Details about motivation and such can be found there

r? `@oli-obk`
2022-04-23 19:32:05 +00:00
bors 6b4563bf93 Auto merge of #90602 - mbartlett21:const-intoiterator, r=oli-obk
Unstably constify `impl<I: Iterator> IntoIterator for I`

This constifies the default `IntoIterator` implementation under the `const_intoiterator_identity` feature.

Tracking Issue: #90603
2022-04-23 15:41:45 +00:00
bors 1e9aa8a96b Auto merge of #95971 - workingjubilee:no-weird-fp-in-const, r=oli-obk
No "weird" floats in const fn {from,to}_bits

I suspect this code is subtly incorrect and that we don't even e.g. use x87-style floats in CTFE, so I don't have to guard against that case. A future PR will be hopefully removing them from concern entirely, anyways. But at the moment I wanted to get this rolling because small questions like that one seem best answered by review.

r? `@oli-obk`
cc `@eddyb` `@thomcc`
2022-04-23 13:00:54 +00:00
bors c212fc4aa7 Auto merge of #96323 - bjorn3:sync_cg_clif-2022-04-22, r=bjorn3
Sync rustc_codegen_cranelift

Mostly fixing bugs this time, but also a Cranelift update.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2022-04-23 10:37:35 +00:00
Camille GILLOT daccecc0ec Bless incremental tests. 2022-04-23 09:59:27 +02:00
Camille GILLOT 4bbe078d92 Drop vis in Item. 2022-04-23 09:59:24 +02:00
Camille GILLOT a6e3124d2c Drop vis in ImplItem. 2022-04-23 09:57:00 +02:00
Camille GILLOT 2827007d32 Drop vis from ForeignItem. 2022-04-23 09:56:37 +02:00
Camille GILLOT a62680d108 Drop vis in FieldDef. 2022-04-23 09:56:15 +02:00
Camille GILLOT 4e8046f67a Stop pretty-printing HIR visibility. 2022-04-23 09:55:25 +02:00
Camille GILLOT 10d10efb21 Stop visiting visibility. 2022-04-23 09:53:45 +02:00
bors 09064a21b0 Auto merge of #96316 - michaelwoerister:debuginfo-fix-unit-msvc, r=wesleywiser
debuginfo: Emit ZST struct debuginfo for unit type when CPP-like debuginfo is enabled

As already discovered in 24a728a8eb, PDB does not play well with custom basic types. This PR extends to the fix to `()`: Instead of a custom basic type, we treat it like an empty tuple (i.e. it is described as a struct which happens to have no fields).

Before this change anything with a `()` in it would cause trouble, which is especially bad for `*const ()` and `*mut ()` which are often used for opaque pointers. E.g. the test case added in this PR would look like:
```
0:000>  dx _ref
Error: Unable to bind name '_ref'
0:000>  dx _ptr
Error: Unable to bind name '_ptr'
0:000>  dx _local
Error: Unable to bind name '_local'
0:000>  dx _field,d
_field,d         [Type: unit_type::_TypeContainingUnitField]
    [+0x008] _a               : 123 [Type: unsigned int]
    [+0x000] _unit            : Unexpected failure to dereference object
    [+0x000] _b               : 456 [Type: unsigned __int64]
0:000>  dx ((__int64 *)_ptr),x
Error: Unable to bind name '_ptr'
```

With the PR it produces the expected output:
```
0:000>  dx _ref
_ref             : 0x7ff6f2012230 : () [Type: tuple$<> *]
0:000>  dx _ptr
_ptr             : 0x7e8ddffc20 : () [Type: tuple$<> *]
0:000>  dx _local
_local           : () [Type: tuple$<>]
0:000>  dx _field,d
_field,d         [Type: unit_type::_TypeContainingUnitField]
    [+0x008] _a               : 123 [Type: unsigned int]
    [+0x000] _unit            : () [Type: tuple$<>]
    [+0x000] _b               : 456 [Type: unsigned __int64]
0:000>  dx ((__int64 *)_ptr),x
((__int64 *)_ptr),x : 0x7e8ddffc20 : 0x1122334455667788 [Type: __int64 *]
```

r? `@wesleywiser`
2022-04-23 07:12:52 +00:00
bors 64c5deb0e3 Auto merge of #96314 - AronParker:issue-96297-fix, r=thomcc
Reduce allocations for path conversions on Windows

Previously, UTF-8 to UTF-16 Path conversions on Windows unnecessarily allocate twice, as described in #96297. This commit fixes that issue.
2022-04-23 04:17:50 +00:00
Jubilee Young 4da8682523 Remove unnecessary const-time x87-related checks 2022-04-22 19:34:33 -07:00