Commit graph

158873 commits

Author SHA1 Message Date
Matthias Krüger 092477d8c9
Rollup merge of #91259 - jyn514:doctest-warnings, r=GuillaumeGomez
Remove `--display-doctest-warnings`

`--display-doctest-warnings` can be replicated in full with other existing features, there's no
need to have a separate option for it. This removes the option and documents the combination of other features to replicate it.

This also fixes a bug where `--test-args=--show-output` had no effect.

cc `@ollie27,` https://github.com/rust-lang/rust/pull/73314#issuecomment-668317262
Fixes https://github.com/rust-lang/rust/issues/41574

r? `@GuillaumeGomez`
2021-11-26 22:41:44 +01:00
Matthias Krüger 404235e039
Rollup merge of #91252 - jyn514:relative-dir, r=Mark-Simulacrum
Fix bug where submodules wouldn't be updated when running x.py from a subdirectory

Previously, it would concatenate the relative path to the current
subdirectory, which looked at the wrong folder.

I tested this by checking out `1.56.1`, changing the current directory
to `src/`, and running `../x.py build`.

Fixes https://github.com/rust-lang/rust/issues/90481 (cc `@pnkfelix).`

r? `@Mark-Simulacrum`
2021-11-26 22:41:43 +01:00
Matthias Krüger a92f867bf1
Rollup merge of #91248 - alessandrod:compiler-builtins-bump-bpf, r=Mark-Simulacrum
Bump compiler-builtins to 0.1.53

Fixes a LLVM crash with the bpf targets, see https://github.com/rust-lang/compiler-builtins/pull/440
2021-11-26 22:41:42 +01:00
Matthias Krüger 3bdf5fbbd8
Rollup merge of #91240 - dtolnay:utf8width, r=Mark-Simulacrum
Saner formatting for UTF8_CHAR_WIDTH table

The way these lines were currently wrapped definitely does not look like someone's intentional formatting. It's likely they got disfigured by rustfmt at some point.

This commit rearranges it to a rustfmt-compatible formatting that I find easier to read.
2021-11-26 22:41:41 +01:00
Matthias Krüger 330a558e42
Rollup merge of #91223 - GuillaumeGomez:headings-indent, r=jsha
Fix headings indent

Fixes #91200.

Screenshots with the fix:

![Screenshot from 2021-11-25 15-32-35](https://user-images.githubusercontent.com/3050060/143462481-f7e9ea13-72d5-46fe-90e0-9527e74599e3.png)
![Screenshot from 2021-11-25 15-32-49](https://user-images.githubusercontent.com/3050060/143462485-c010716a-0276-421b-a777-afff19c81c96.png)

If the first element of a top docblock is a heading, we still need to keep the indent, but only on this one (I added a test to check it). We need it because otherwise the anchor will go over the `[-]` toggle.

cc `@camelid`
r? `@jsha`
2021-11-26 22:41:40 +01:00
Matthias Krüger fcbbdaf209
Rollup merge of #91197 - camelid:rename-resolvedpath, r=GuillaumeGomez,jyn514
rustdoc: Rename `Type::ResolvedPath` to `Type::Path` and don't re-export it

The new name is shorter, simpler, and consistent with `hir::Ty`. It can't be
re-exported since the name would conflict with the `clean::Path` struct. But
usually enum variants are referred to using their qualified names in Rust anyway
(and parts of rustdoc already do that with `clean::Type`), so this is also more
consistent with the language.

r? `@GuillaumeGomez`
cc `@jyn514`
2021-11-26 22:41:39 +01:00
Matthias Krüger 10743f0f68
Rollup merge of #90611 - fee1-dead:rustdoc-ice-fix, r=jyn514,willcrichton
Fix another ICE in rustdoc scrape_examples

This has occurred to me when documenting a crate with the arguments. Not sure what could have caused it.

r? `@willcrichton`
2021-11-26 22:41:39 +01:00
bors ccce98535b Auto merge of #91246 - nnethercote:faster-layout-array, r=dtolnay
Faster `Layout::array`

`Layout::array` is called (indirectly) by `Vec::push()`, which is typically instantiated many times, and so making it smaller can help with compile times because less LLVM IR is generated.

r? `@ghost`
2021-11-26 21:35:53 +00:00
Joshua Nelson 7e4bf4bfc6 Remove --display-doctest-warnings
This can be replicated in full with other existing features, there's no
need to have a separate option for it.

This also fixes a bug where `--test-args=--show-output` had no effect,
and updates the documentation.
2021-11-26 16:18:16 -05:00
David Tolnay c6810a569f
Clarify safety comment on using i to index into self.source 2021-11-26 12:57:36 -08:00
Noah Lev 79c718f1d5 Rename Type::ResolvedPath to Type::Path
At last! The new name is shorter, simpler, and consistent with
`hir::Ty`.
2021-11-26 12:40:27 -08:00
Josh Stone 4c3699f01a Add 1.57.0 release notes 2021-11-26 15:18:39 -05:00
Guillaume Gomez 23427567b2 Update test for anchors and headings position 2021-11-26 21:03:45 +01:00
Guillaume Gomez 20eda22cbf Update the first heading indent rule so it is only applied on the first heading of the top doc block 2021-11-26 21:03:45 +01:00
Mark Rousskov f54cb85702 Bump to 1.59 2021-11-26 14:53:55 -05:00
jam1garner 37c8f254ed Use non-generic inner function for pointer formatting 2021-11-26 13:59:57 -05:00
Deadbeef 9c14d828ba
Reduce the ICE 2021-11-27 01:33:07 +08:00
bors 6d246f0c8d Auto merge of #91253 - matthiaskrgr:rollup-dnlcjmr, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #91169 (Change cg_ssa's get_param to borrow the builder mutably)
 - #91176 (If the thread does not get the lock in the short term, yield the CPU)
 - #91212 (Fix ICE due to out-of-bounds statement index when reporting borrowck error)
 - #91225 (Fix invalid scrollbar display on source code page)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-26 16:30:42 +00:00
Deadbeef 85c20698d4
Add ICE test 2021-11-27 00:26:22 +08:00
Deadbeef c86da9b7b2
Add trace statements 2021-11-27 00:26:21 +08:00
Deadbeef 2d3d6bc5a2
Fix another ICE in rustdoc scrape_examples 2021-11-27 00:26:18 +08:00
Matthias Krüger a9710deebc
Rollup merge of #91225 - GuillaumeGomez:source-page-scrollbar, r=jsha
Fix invalid scrollbar display on source code page

Fixes bug introduced in #90983:

![Screenshot from 2021-11-25 17-01-08](https://user-images.githubusercontent.com/3050060/143473753-c2e7c43c-ce3f-474d-9d2a-922e63189c51.png)
![Screenshot from 2021-11-25 17-07-08](https://user-images.githubusercontent.com/3050060/143473757-eecaaf2b-f4f0-49e0-a159-ab485e3f7122.png)

To fix it, I simply unset the `overflow-y` on the source code page so it's not displayed anymore.

r? ``@jsha``
2021-11-26 16:02:27 +01:00
Matthias Krüger 13c60669cc
Rollup merge of #91212 - compiler-errors:issue91206, r=oli-obk
Fix ICE due to out-of-bounds statement index when reporting borrowck error

Replace an `[index]` with a `.get` when `statement_index` points to a basic-block terminator (and is therefore out-of-bounds in the statements list).

Fixes #91206
Cc ``@camsteffen``
r? ``@oli-obk``
2021-11-26 16:02:26 +01:00
Matthias Krüger fdc305d58d
Rollup merge of #91176 - hermitcore:spin, r=kennytm
If the thread does not get the lock in the short term, yield the CPU

Reduces on [RustyHermit](https://github.com/hermitcore/rusty-hermit) the amount of wasted processor cycles
2021-11-26 16:02:24 +01:00
Matthias Krüger 324b4bcb3c
Rollup merge of #91169 - RDambrosio016:master, r=bjorn3
Change cg_ssa's get_param to borrow the builder mutably

This is a small change to make `get_param` more flexible for codegens that may need to modify things when retrieving function parameters.

This will currently only be used by [rustc_codegen_nvvm](https://github.com/Rust-GPU/Rust-CUDA) (my own project), but may be useful to more codegens in the future.

This is needed because cg_nvvm needs to remap certain types to libnvvm-friendly types, such as `i128` -> `<2 x i64>`. Because cg_ssa does not give mutable access to the builder, i resorted to using a mutex:
```rs
    fn get_param(&self, index: usize) -> Self::Value {
        let val = llvm::get_param(self.llfn(), index as c_uint);
        trace!("Get param `{:?}`", val);
        unsafe {
            let llfnty = LLVMRustGetFunctionType(self.llfn());
            let map = self.remapped_integer_args.borrow();
            if let Some((_, key)) = map.get(llfnty) {
                if let Some((_, new_ty)) = key.iter().find(|t| t.0 == index) {
                    trace!("Casting irregular param {:?} to {:?}", val, new_ty);
                    return transmute_llval(
                        *self.llbuilder.lock().unwrap(),
                        &self.cx,
                        val,
                        *new_ty,
                    );
                }
            }
            val
        }
    }
```
However, i predict this is pretty bad for performance, considering how much builders are called during codegen, so i would greatly appreciate having a more flexible API for this.
2021-11-26 16:02:23 +01:00
Joshua Nelson 6e0e220804 Fix bug where submodules wouldn't be updated when running x.py from a subdirectory
Previously, it would concatenate the relative path to the current
subdirectory, which looked at the wrong folder.

I tested this by checking out `1.56.1`, changing the current directory
to `src/`, and running `../x.py build`.
2021-11-26 09:56:01 -05:00
Oli Scherer 18694126b1 Perform Sync check on static items in wf-check instead of during const checks 2021-11-26 14:22:45 +00:00
Lucas Kent df3e7a28f7 Refactor EmitterWriter::emit_suggestion_default 2021-11-27 01:13:37 +11:00
bors 454cc5fb86 Auto merge of #91164 - Badel2:usefulness-stack-overflow, r=davidtwco
Fix stack overflow in `usefulness.rs`

Fix #88747

Applied the suggestion from `@nbdd0121,` not sure if this has any drawbacks. The first call to `ensure_sufficient_stack` is not needed to fix the test case, but I added it to be safe.
2021-11-26 13:42:35 +00:00
Alessandro Decina 1cf37189bc Bump compiler-builtins to 0.1.53
Fixes a LLVM crash with the bpf targets
2021-11-26 10:33:32 +00:00
bors 1e79d79dac Auto merge of #91205 - Aaron1011:visit_param_env, r=lcnr
Visit `param_env` field in Obligation's `TypeFoldable` impl

This oversight appears to have gone unnoticed for a long time
without causing issues, but it should still be fixed.
2021-11-26 09:55:06 +00:00
Nicholas Nethercote dbfb91385f Add a unit test for zero-sized types in RawVec.
Because there's some subtle behaviour specific to zero-sized types and
it's currently not well tested.
2021-11-26 19:30:45 +11:00
Nicholas Nethercote f3bda74d36 Optimize Layout::array.
The current implementation is much more conservative than it needs to
be, because it's dealing with the size and alignment of a given `T`,
which are more restricted than an arbitrary `Layout`.

For example, imagine a struct with a `u32` and a `u4`. You can safely
create a `Layout { size_: 5, align_: 4 }` by hand, but
`Layout:🆕:<T>` will give `Layout { size_: 8, align_: 4}`, where the
size already has padding that accounts for the alignment. (And the
existing `debug_assert_eq!` in `Layout::array` already demonstrates that
no additional padding is required.)
2021-11-26 19:30:35 +11:00
Nicholas Nethercote 026edbb4ef Use unchecked construction in Layout::pad_to_align.
Other, similar methods for `Layout` do likewise, and there's already an
`unwrap()` around the result demonstrating the safety.
2021-11-26 19:30:35 +11:00
LeSeulArtichaut 6db9605d85
Use TypeFolder::Error for FullTypeResolver and QueryNormalizer
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-26 07:40:43 +00:00
LeSeulArtichaut 30bf20a692
Unwrap the results of type folders
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-26 07:38:25 +00:00
LeSeulArtichaut 6dc3dae46f
Adapt TypeFolder implementors to return a Result
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-26 07:25:16 +00:00
LeSeulArtichaut 6e3fa20b00
Make TypeFoldable implementors short-circuit on error
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-26 07:17:59 +00:00
LeSeulArtichaut c5f0d0ebb4
Make TypeFolder::fold_* return Result 2021-11-26 06:53:35 +00:00
bors a7836bf885 Auto merge of #91181 - GuillaumeGomez:improve-rustdoc-gui-ci, r=jsha
Improve rustdoc-gui CI

As commented [here](https://github.com/rust-lang/rust/pull/91179#discussion_r756023009):

When the text isn't displayed, the color returned by puppeteer is always `rgba(0,0,0,0)`, which is definitely not the right value. To prevent this error from happening again, `browser-ui-test` will now fail if a CSS color check is run when the text isn't displayed.

Either this PR or #91179 is merged first, they'll conflict because I made changes to the same test file.

cc `@jyn514`
r? `@jsha`
2021-11-26 06:44:00 +00:00
bors 9adfd9db78 Auto merge of #85102 - estebank:point-at-assignment, r=oli-obk
Diagnostic tweaks

* On type mismatch caused by assignment, point at the source of the expectation
* Hide redundant errors
* Suggest `while let` when `let` is missing in some cases
2021-11-26 03:57:55 +00:00
David Tolnay 2be9a8349f
Eliminate bunch of copies of error codepath from Utf8LossyChunksIter
Using a macro to stamp out 7 identical copies of the nontrivial slicing
logic to exit this loop didn't seem like a necessary use of a macro. The
early return case can be handled by `break` without practically any
changes to the logic inside the loop.

All this code is from early 2014 (7.5 years old, pre-1.0) so it's
possible there were compiler limitations that forced the macro way at
the time.

Confirmed that `x.py bench library/alloc --stage 0 --test-args from_utf8_lossy`
is unaffected on my machine.
2021-11-25 19:52:45 -08:00
David Tolnay 9125dd74bd
Eliminate an unreachable codepath from String::from_utf8_lossy
Utf8Lossy's Iterator implementation ensures that only the final chunk
has an empty slice for broken. Thus the only way the first chunk could
have an empty broken is if it is the final chunk, i.e. there is only one
chunk total. And the only way that there could be one chunk total is if
the whole input is valid utf8 and non-empty. That condition has already
been handled by an early return, so at the point that the first
REPLACEMENT is being pushed, it's impossible for first_broken to be
empty.
2021-11-25 18:27:40 -08:00
David Tolnay 553a84c445
Saner formatting for UTF8_CHAR_WIDTH table 2021-11-25 18:18:36 -08:00
jackh726 eeaa215f85 Don't treat unnormalized function arguments as well-formed 2021-11-25 21:16:27 -05:00
bors e2f6fb9996 Auto merge of #91037 - c410-f3r:testsssssss, r=petrochenkov
Move some tests to more reasonable directories - 10

cc #73494
r? `@petrochenkov`
2021-11-25 23:53:02 +00:00
Aaron Hill a7cc6bc4d0
Visit param_env field in Obligation's TypeFoldable impl
This oversight appears to have gone unnoticed for a long time
without causing issues, but it should still be fixed.
2021-11-25 15:33:37 -06:00
Noah Lev d81deb33fa Stop re-exporting Type::ResolvedPath
I would like to rename it to `Type::Path`, but then it can't be
re-exported since the name would conflict with the `Path` struct.
Usually enum variants are referred to using their qualified names in
Rust (and parts of rustdoc already do that with `clean::Type`), so this
is also more consistent with the language.
2021-11-25 12:08:05 -08:00
Noah Lev 8adb0b6d6c Clean up clean re-exports
This will allow re-exporting only certain enum variants.
2021-11-25 12:08:05 -08:00
bors dd549dcab4 Auto merge of #90580 - cjgillot:no-ee-upvar, r=Aaron1011
Remove eval_always from upvars.

Split off https://github.com/rust-lang/rust/pull/86056
r? `@ghost`
2021-11-25 19:43:56 +00:00