]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #91057 - the8472:clarify-parallelism-steady-state, r=dtolnay
Matthias Krüger [Sat, 27 Nov 2021 10:46:42 +0000 (11:46 +0100)]
Rollup merge of #91057 - the8472:clarify-parallelism-steady-state, r=dtolnay

Expand `available_parallelism` docs in anticipation of cgroup quota support

The "fixed" in "fixed steady state limits" means to exclude load-dependent resource prioritization
that would calculate to 100% of capacity on an idle system and less capacity on a loaded system.

Additionally I also exclude "system load" since it would be silly to try to identify
other, perhaps higher priority, processes hogging some CPU cores that aren't explicitly excluded
by masks/quotas/whatever.

2 years agoRollup merge of #90995 - the8472:hash-portability, r=dtolnay
Matthias Krüger [Sat, 27 Nov 2021 10:46:42 +0000 (11:46 +0100)]
Rollup merge of #90995 - the8472:hash-portability, r=dtolnay

Document non-guarantees for Hash

Dependence on endianness and type sizes was reported for enum discriminants in #74215 but it is a more general
issue since for example the default implementation of `Hasher::write_usize` uses native endianness.
Additionally the implementations of library types are occasionally changed as their internal fields
change or hashing gets optimized.

## Question

Should this go on the module level documentation instead since it also concerns `Hasher` to some extent and not just `Hash`?

resolves #74215

2 years agoRollup merge of #83791 - the8472:relax-zip-side-effect-guarantee, r=dtolnay
Matthias Krüger [Sat, 27 Nov 2021 10:46:40 +0000 (11:46 +0100)]
Rollup merge of #83791 - the8472:relax-zip-side-effect-guarantee, r=dtolnay

Weaken guarantee around advancing underlying iterators in zip

The current guarantee (introduced in #52279) is too strong as it prevents adapters from exploiting knowledge about the iterator length and using counted loops for example because they would stop calling `next()` before it ever returned `None`. Additionally several nested zip iterators already fail to uphold this.

This does not yet remove any of the specialization code that tries (and sometimes fails) to uphold the guarantee for `next()`
because removing it would also affect `next_back()` in more surprising ways.

The intent is to be able to remove for example this branch

https://github.com/rust-lang/rust/blob/36bcf4069717b9dff90270d13b53a3b130329960/library/core/src/iter/adapters/zip.rs#L234-L243

or this test

https://github.com/rust-lang/rust/blob/36bcf4069717b9dff90270d13b53a3b130329960/library/core/tests/iter/adapters/zip.rs#L177-L188

Solves #82303 by declaring it a non-issue.

2 years agoAuto merge of #91261 - Mark-Simulacrum:next-rel, r=Mark-Simulacrum
bors [Sat, 27 Nov 2021 03:45:36 +0000 (03:45 +0000)]
Auto merge of #91261 - Mark-Simulacrum:next-rel, r=Mark-Simulacrum

Bump to 1.59

r? `@Mark-Simulacrum`

2 years agoAuto merge of #91269 - matthiaskrgr:rollup-jh8i8eh, r=matthiaskrgr
bors [Sat, 27 Nov 2021 00:42:30 +0000 (00:42 +0000)]
Auto merge of #91269 - matthiaskrgr:rollup-jh8i8eh, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #90611 (Fix another ICE in rustdoc scrape_examples)
 - #91197 (rustdoc: Rename `Type::ResolvedPath` to `Type::Path` and don't re-export it)
 - #91223 (Fix headings indent)
 - #91240 (Saner formatting for UTF8_CHAR_WIDTH table)
 - #91248 (Bump compiler-builtins to 0.1.53)
 - #91252 (Fix bug where submodules wouldn't be updated when running x.py from a subdirectory)
 - #91259 (Remove `--display-doctest-warnings`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #91259 - jyn514:doctest-warnings, r=GuillaumeGomez
Matthias Krüger [Fri, 26 Nov 2021 21:41:44 +0000 (22:41 +0100)]
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`

2 years agoRollup merge of #91252 - jyn514:relative-dir, r=Mark-Simulacrum
Matthias Krüger [Fri, 26 Nov 2021 21:41:43 +0000 (22:41 +0100)]
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`

2 years agoRollup merge of #91248 - alessandrod:compiler-builtins-bump-bpf, r=Mark-Simulacrum
Matthias Krüger [Fri, 26 Nov 2021 21:41:42 +0000 (22:41 +0100)]
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

2 years agoRollup merge of #91240 - dtolnay:utf8width, r=Mark-Simulacrum
Matthias Krüger [Fri, 26 Nov 2021 21:41:41 +0000 (22:41 +0100)]
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.

2 years agoRollup merge of #91223 - GuillaumeGomez:headings-indent, r=jsha
Matthias Krüger [Fri, 26 Nov 2021 21:41:40 +0000 (22:41 +0100)]
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`

2 years agoRollup merge of #91197 - camelid:rename-resolvedpath, r=GuillaumeGomez,jyn514
Matthias Krüger [Fri, 26 Nov 2021 21:41:39 +0000 (22:41 +0100)]
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`

2 years agoRollup merge of #90611 - fee1-dead:rustdoc-ice-fix, r=jyn514,willcrichton
Matthias Krüger [Fri, 26 Nov 2021 21:41:39 +0000 (22:41 +0100)]
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`

2 years agoAuto merge of #91246 - nnethercote:faster-layout-array, r=dtolnay
bors [Fri, 26 Nov 2021 21:35:53 +0000 (21:35 +0000)]
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`

2 years agoRemove `--display-doctest-warnings`
Joshua Nelson [Fri, 26 Nov 2021 18:52:28 +0000 (13:52 -0500)]
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.

2 years agoRename `Type::ResolvedPath` to `Type::Path`
Noah Lev [Wed, 24 Nov 2021 20:29:58 +0000 (12:29 -0800)]
Rename `Type::ResolvedPath` to `Type::Path`

At last! The new name is shorter, simpler, and consistent with
`hir::Ty`.

2 years agoUpdate test for anchors and headings position
Guillaume Gomez [Thu, 25 Nov 2021 14:39:04 +0000 (15:39 +0100)]
Update test for anchors and headings position

2 years agoUpdate the first heading indent rule so it is only applied on the first heading of...
Guillaume Gomez [Thu, 25 Nov 2021 14:33:38 +0000 (15:33 +0100)]
Update the first heading indent rule so it is only applied on the first heading of the top doc block

2 years agoBump to 1.59
Mark Rousskov [Fri, 26 Nov 2021 19:53:55 +0000 (14:53 -0500)]
Bump to 1.59

2 years agoReduce the ICE
Deadbeef [Fri, 26 Nov 2021 17:33:07 +0000 (01:33 +0800)]
Reduce the ICE

2 years agoAuto merge of #91253 - matthiaskrgr:rollup-dnlcjmr, r=matthiaskrgr
bors [Fri, 26 Nov 2021 16:30:42 +0000 (16:30 +0000)]
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

2 years agoAdd ICE test
Deadbeef [Fri, 5 Nov 2021 17:18:32 +0000 (01:18 +0800)]
Add ICE test

2 years agoAdd trace statements
Deadbeef [Fri, 5 Nov 2021 16:57:57 +0000 (00:57 +0800)]
Add trace statements

2 years agoFix another ICE in rustdoc scrape_examples
Deadbeef [Fri, 5 Nov 2021 14:37:33 +0000 (22:37 +0800)]
Fix another ICE in rustdoc scrape_examples

2 years agoRollup merge of #91225 - GuillaumeGomez:source-page-scrollbar, r=jsha
Matthias Krüger [Fri, 26 Nov 2021 15:02:27 +0000 (16:02 +0100)]
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``

2 years agoRollup merge of #91212 - compiler-errors:issue91206, r=oli-obk
Matthias Krüger [Fri, 26 Nov 2021 15:02:26 +0000 (16:02 +0100)]
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``

2 years agoRollup merge of #91176 - hermitcore:spin, r=kennytm
Matthias Krüger [Fri, 26 Nov 2021 15:02:24 +0000 (16:02 +0100)]
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

2 years agoRollup merge of #91169 - RDambrosio016:master, r=bjorn3
Matthias Krüger [Fri, 26 Nov 2021 15:02:23 +0000 (16:02 +0100)]
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.

2 years agoFix bug where submodules wouldn't be updated when running x.py from a subdirectory
Joshua Nelson [Fri, 26 Nov 2021 14:55:46 +0000 (09:55 -0500)]
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`.

2 years agoAuto merge of #91164 - Badel2:usefulness-stack-overflow, r=davidtwco
bors [Fri, 26 Nov 2021 13:42:35 +0000 (13:42 +0000)]
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.

2 years agoBump compiler-builtins to 0.1.53
Alessandro Decina [Fri, 26 Nov 2021 10:33:16 +0000 (10:33 +0000)]
Bump compiler-builtins to 0.1.53

Fixes a LLVM crash with the bpf targets

2 years agoAuto merge of #91205 - Aaron1011:visit_param_env, r=lcnr
bors [Fri, 26 Nov 2021 09:55:06 +0000 (09:55 +0000)]
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.

2 years agoAdd a unit test for zero-sized types in `RawVec`.
Nicholas Nethercote [Thu, 25 Nov 2021 08:29:10 +0000 (19:29 +1100)]
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.

2 years agoOptimize `Layout::array`.
Nicholas Nethercote [Fri, 26 Nov 2021 02:39:05 +0000 (13:39 +1100)]
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::new::<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.)

2 years agoUse unchecked construction in `Layout::pad_to_align`.
Nicholas Nethercote [Fri, 26 Nov 2021 02:36:39 +0000 (13:36 +1100)]
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.

2 years agoAuto merge of #91181 - GuillaumeGomez:improve-rustdoc-gui-ci, r=jsha
bors [Fri, 26 Nov 2021 06:44:00 +0000 (06:44 +0000)]
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`

2 years agoAuto merge of #85102 - estebank:point-at-assignment, r=oli-obk
bors [Fri, 26 Nov 2021 03:57:55 +0000 (03:57 +0000)]
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

2 years agoSaner formatting for UTF8_CHAR_WIDTH table
David Tolnay [Fri, 26 Nov 2021 02:18:36 +0000 (18:18 -0800)]
Saner formatting for UTF8_CHAR_WIDTH table

2 years agoAuto merge of #91037 - c410-f3r:testsssssss, r=petrochenkov
bors [Thu, 25 Nov 2021 23:53:02 +0000 (23:53 +0000)]
Auto merge of #91037 - c410-f3r:testsssssss, r=petrochenkov

Move some tests to more reasonable directories - 10

cc #73494
r? `@petrochenkov`

2 years agoVisit `param_env` field in Obligation's `TypeFoldable` impl
Aaron Hill [Wed, 24 Nov 2021 23:20:52 +0000 (17:20 -0600)]
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.

2 years agoStop re-exporting `Type::ResolvedPath`
Noah Lev [Wed, 24 Nov 2021 20:27:37 +0000 (12:27 -0800)]
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.

2 years agoClean up `clean` re-exports
Noah Lev [Wed, 24 Nov 2021 20:21:44 +0000 (12:21 -0800)]
Clean up `clean` re-exports

This will allow re-exporting only certain enum variants.

2 years agoAuto merge of #90580 - cjgillot:no-ee-upvar, r=Aaron1011
bors [Thu, 25 Nov 2021 19:43:56 +0000 (19:43 +0000)]
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`

2 years agoFix clippy test
Esteban Kuber [Thu, 25 Nov 2021 18:39:32 +0000 (18:39 +0000)]
Fix clippy test

2 years agoAccount for type obligation coming from `const` and `static`
Esteban Kuber [Sun, 21 Nov 2021 01:49:51 +0000 (01:49 +0000)]
Account for type obligation coming from `const` and `static`

2 years agoOn type mismatch caused by assignment, point at assignee
Esteban Küber [Fri, 7 May 2021 02:09:35 +0000 (19:09 -0700)]
On type mismatch caused by assignment, point at assignee

* Do not emit unnecessary E0308 after E0070
* Show fewer errors on `while let` missing `let`
* Hide redundant E0308 on `while let` missing `let`
* Point at binding definition when possible on invalid assignment
* do not point at closure twice
* do not suggest `if let` for literals in lhs
* account for parameter types

2 years agoAdd test demonstrating no more ICE
Michael Goulet [Thu, 25 Nov 2021 16:33:01 +0000 (16:33 +0000)]
Add test demonstrating no more ICE

2 years agoFix issue 91206
Michael Goulet [Thu, 25 Nov 2021 06:48:09 +0000 (06:48 +0000)]
Fix issue 91206

2 years agoAuto merge of #91221 - matthiaskrgr:rollup-iuz3gxq, r=matthiaskrgr
bors [Thu, 25 Nov 2021 16:12:04 +0000 (16:12 +0000)]
Auto merge of #91221 - matthiaskrgr:rollup-iuz3gxq, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #89359 (Various fixes for const_trait_impl)
 - #90499 (Link with default MACOSX_DEPLOYMENT_TARGET if not otherwise specified.)
 - #91096 (Print associated types on opaque `impl Trait` types)
 - #91111 (Do not visit attributes in `ItemLowerer`.)
 - #91162 (explain why CTFE/Miri perform truncation on shift offset)
 - #91185 (Remove `-Z force-overflow-checks`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoFix invalid scrollbar display on source code page
Guillaume Gomez [Thu, 25 Nov 2021 16:08:23 +0000 (17:08 +0100)]
Fix invalid scrollbar display on source code page

2 years agoRollup merge of #91185 - camelid:rm-force-overflow-checks, r=wesleywiser
Matthias Krüger [Thu, 25 Nov 2021 14:05:40 +0000 (15:05 +0100)]
Rollup merge of #91185 - camelid:rm-force-overflow-checks, r=wesleywiser

Remove `-Z force-overflow-checks`

It was replaced several years ago by the stable option `-C overflow-checks`.
The goal was to delete the `-Z` flag once users had migrated [1].
Now that it's been several years, it makes sense to delete the old flag.

See also the discussion on Zulip [2].

[1]: https://github.com/rust-lang/rust/issues/33134#issuecomment-280484097
[2]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/overflow.20checks/near/262497224

r? ```@wesleywiser```
cc ```@RalfJung```

2 years agoRollup merge of #91162 - RalfJung:miri-shift-truncation, r=oli-obk
Matthias Krüger [Thu, 25 Nov 2021 14:05:39 +0000 (15:05 +0100)]
Rollup merge of #91162 - RalfJung:miri-shift-truncation, r=oli-obk

explain why CTFE/Miri perform truncation on shift offset

Closes https://github.com/rust-lang/miri/issues/1920

2 years agoRollup merge of #91111 - cjgillot:hir-no-lower-attrs, r=michaelwoerister
Matthias Krüger [Thu, 25 Nov 2021 14:05:38 +0000 (15:05 +0100)]
Rollup merge of #91111 - cjgillot:hir-no-lower-attrs, r=michaelwoerister

Do not visit attributes in `ItemLowerer`.

By default, AST visitors visit expressions that appear in key-value attributes.
Those expressions should not be lowered to HIR, as they do not correspond to actually compiled code.

Since an attribute cannot produce meaningful HIR, just skip them altogether.

Fixes https://github.com/rust-lang/rust/issues/81886
Fixes https://github.com/rust-lang/rust/issues/90873
r? `@michaelwoerister`

2 years agoRollup merge of #91096 - compiler-errors:elaborate_opaque_trait, r=estebank
Matthias Krüger [Thu, 25 Nov 2021 14:05:37 +0000 (15:05 +0100)]
Rollup merge of #91096 - compiler-errors:elaborate_opaque_trait, r=estebank

Print associated types on opaque `impl Trait` types

This PR generalizes #91021, printing associated types for all opaque `impl Trait` types instead of just special-casing for future.

before:
```
error[E0271]: type mismatch resolving `<impl Iterator as Iterator>::Item == u32`
```

after:
```
error[E0271]: type mismatch resolving `<impl Iterator<Item = usize> as Iterator>::Item == u32`
```

---

Questions:
1. I'm kinda lost in binders hell with this one. Is all of the `rebind`ing necessary?
2. Is there a map collection type that will give me a stable iteration order? Doesn't seem like TraitRef is Ord, so I can't just sort later..
3. I removed the logic that suppresses printing generator projection types. It creates outputs like this [gist](https://gist.github.com/compiler-errors/d6f12fb30079feb1ad1d5f1ab39a3a8d). Should I put that back?
4. I also added spaces between traits, `impl A+B` -> `impl A + B`. I quite like this change, but is there a good reason to keep it like that?

r? ````@estebank````

2 years agoRollup merge of #90499 - rusticstuff:macos-target-fixes, r=petrochenkov
Matthias Krüger [Thu, 25 Nov 2021 14:05:36 +0000 (15:05 +0100)]
Rollup merge of #90499 - rusticstuff:macos-target-fixes, r=petrochenkov

Link with default MACOSX_DEPLOYMENT_TARGET if not otherwise specified.

This PR sets the MACOSX_DEPLOYMENT_TARGET environment variable during the linking stage to our default, if it is not specified. This way it matches the deployment target we pass to llvm. If not set the the linker uses Xcode or Xcode commandline tools default which varies by version.

Fixes #90342, #91082.

Drive-by fixes to make Rust behave more like clang:
* Default to 11.0 deployment target for ARM64 which is the earliest version that had support for it.
* Set the llvm target to `arm64-apple-macosx<deployment target>` instead of `aarch64-apple-macosx<deployment target>`.

2 years agoRollup merge of #89359 - fee1-dead:const-it, r=oli-obk
Matthias Krüger [Thu, 25 Nov 2021 14:05:35 +0000 (15:05 +0100)]
Rollup merge of #89359 - fee1-dead:const-it, r=oli-obk

Various fixes for const_trait_impl

A few problems I found while making `Iterator` easier to const-implement.

1. More generous `~const Drop` check.

We check for nested fields with caller bounds.

For example, an ADT type with fields of types `A`, `B`, `C`, check if all of them are either:
 - Bounded (`A: ~const Drop`, `B: Copy`)
 - Known to be able to destruct at compile time (`C = i32`, `struct C(i32)`, `C = some_fn`)

2. Don't treat trait functions marked with `#[default_method_body_is_const]` as stable const fns when checking `const_for` and `const_try` feature gates.

I think anyone can review this, so no r? this time.

2 years agoImprove tests
Guillaume Gomez [Wed, 24 Nov 2021 17:01:34 +0000 (18:01 +0100)]
Improve tests

2 years agoUpdate browser-ui-test version to enforce that text is displayed before checking...
Guillaume Gomez [Wed, 24 Nov 2021 17:01:20 +0000 (18:01 +0100)]
Update browser-ui-test version to enforce that text is displayed before checking colors

2 years agoAuto merge of #91195 - camelid:path-did, r=jyn514
bors [Thu, 25 Nov 2021 13:11:35 +0000 (13:11 +0000)]
Auto merge of #91195 - camelid:path-did, r=jyn514

rustdoc: Remove `ResolvedPath.did`

`ResolvedPath.did` was not actually the same as `.path.def_id()`. Instead,
`.did` referred to the `DefId` of the page to be used as a hyperlink target.
For example, a link to `Struct::method()` would use `Struct`'s `DefId` as its
`.did` field. This behavior is confusing, easy to accidentally misuse, and can
instead be obtained on-demand when computing hyperlink targets. It's also likely
part of the reason `kind_side_channel` exists. I'm currently working on some
experimental refactorings in `collect_intra_doc_links` that I believe require --
or at least benefit from -- removing `.did`.

r? `@jyn514`

2 years agoMove some tests to more reasonable directories
Caio [Fri, 19 Nov 2021 10:18:00 +0000 (07:18 -0300)]
Move some tests to more reasonable directories

2 years agoAuto merge of #88781 - estebank:emoji-idents, r=oli-obk
bors [Thu, 25 Nov 2021 08:16:08 +0000 (08:16 +0000)]
Auto merge of #88781 - estebank:emoji-idents, r=oli-obk

Tokenize emoji as if they were valid identifiers

In the lexer, consider emojis to be valid identifiers and reject
them later to avoid knock down parse errors.

Partially address #86102.

2 years agoSet MACOSX_DEPLOYMENT_TARGET env var to default for linking if not set.
Hans Kratz [Tue, 2 Nov 2021 12:52:47 +0000 (13:52 +0100)]
Set MACOSX_DEPLOYMENT_TARGET env var to default for linking if not set.

2 years agoSet the default deployment target for Macos ARM64 to 11.0.
Hans Kratz [Tue, 2 Nov 2021 11:41:56 +0000 (12:41 +0100)]
Set the default deployment target for Macos ARM64 to 11.0.

11.0 (Big Sur) is the first version which supports ARM64 so we use
that as default.

2 years agoThe correct LLVM target for aarch64-apple-darwin is arm64-... (as with ios)
Hans Kratz [Tue, 2 Nov 2021 10:46:06 +0000 (11:46 +0100)]
The correct LLVM target for aarch64-apple-darwin is arm64-... (as with ios)

2 years agoAuto merge of #85346 - estebank:issue-84946, r=nagisa,varkor
bors [Thu, 25 Nov 2021 05:09:51 +0000 (05:09 +0000)]
Auto merge of #85346 - estebank:issue-84946, r=nagisa,varkor

Account for incorrect `impl Foo<const N: ty> {}` syntax

Fix #84946

2 years agoUpdate cargo to fix tokenizer test affected by tokenizing emoji
Esteban Kuber [Thu, 25 Nov 2021 00:19:50 +0000 (00:19 +0000)]
Update cargo to fix tokenizer test affected by tokenizing emoji

2 years agoUpdate comment
Noah Lev [Wed, 24 Nov 2021 23:32:03 +0000 (18:32 -0500)]
Update comment

Co-authored-by: Joshua Nelson <github@jyn.dev>
2 years agoDo not visit attributes in `LateResolutionVisitor`.
Camille GILLOT [Wed, 24 Nov 2021 22:07:13 +0000 (23:07 +0100)]
Do not visit attributes in `LateResolutionVisitor`.

2 years agoAuto merge of #91203 - GuillaumeGomez:rollup-kwtqvb1, r=GuillaumeGomez
bors [Wed, 24 Nov 2021 23:09:42 +0000 (23:09 +0000)]
Auto merge of #91203 - GuillaumeGomez:rollup-kwtqvb1, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #89542 (Partially stabilize `duration_consts_2`)
 - #90044 (Restrict aarch64 outline atomics to glibc for now.)
 - #90420 (Create rustdoc_internals feature gate)
 - #91075 (Reduce prominence of item-infos)
 - #91151 (Fix test in std::process on android)
 - #91179 (Fix more <a> color)
 - #91199 (rustdoc: Add test for mixing doc comments and attrs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoTweak span and add more tests
Esteban Kuber [Wed, 24 Nov 2021 20:24:14 +0000 (20:24 +0000)]
Tweak span and add more tests

2 years agoRollup merge of #91199 - camelid:test-mixing-docs, r=GuillaumeGomez
Guillaume Gomez [Wed, 24 Nov 2021 21:56:40 +0000 (22:56 +0100)]
Rollup merge of #91199 - camelid:test-mixing-docs, r=GuillaumeGomez

rustdoc: Add test for mixing doc comments and attrs

This is a step toward adding more test coverage to make it easier to
remove the distinction between collapsed and uncollapsed doc values.

2 years agoRollup merge of #91179 - GuillaumeGomez:a-color, r=jsha
Guillaume Gomez [Wed, 24 Nov 2021 21:56:39 +0000 (22:56 +0100)]
Rollup merge of #91179 - GuillaumeGomez:a-color, r=jsha

Fix more <a> color

Fixes #91175.

Another bug I saw is:

![Screenshot from 2021-11-24 11-41-27](https://user-images.githubusercontent.com/3050060/143239845-f173cfeb-8f5c-4215-a5af-b71d4e1bcd84.png)

I fixed it as well.

r? ``@jsha``

2 years agoRollup merge of #91151 - name1e5s:chore/process_test, r=m-ou-se
Guillaume Gomez [Wed, 24 Nov 2021 21:56:38 +0000 (22:56 +0100)]
Rollup merge of #91151 - name1e5s:chore/process_test, r=m-ou-se

Fix test in std::process on android

closes #10380

2 years agoRollup merge of #91075 - jsha:chill-item-info, r=GuillaumeGomez
Guillaume Gomez [Wed, 24 Nov 2021 21:56:37 +0000 (22:56 +0100)]
Rollup merge of #91075 - jsha:chill-item-info, r=GuillaumeGomez

Reduce prominence of item-infos

Fixes #59853

 - Remove border.
 - Reduce size of emoji slightly.
 - Remove details disclosure for unstable reason. This was inconsistent with our other details disclosures, and the detail revealed was usually better explained by clicking on the issue link.

Demo: https://rustdoc.crud.net/jsha/chill-item-info/std/mem/union.MaybeUninit.html#method.slice_assume_init_ref

Compare vs: https://doc.rust-lang.org/nightly/std/mem/union.MaybeUninit.html#method.slice_assume_init_ref

<img src="https://user-images.githubusercontent.com/220205/142717815-09828c9e-6ff4-445a-8ccc-31e028fd4985.png" width=700>

2 years agoRollup merge of #90420 - GuillaumeGomez:rustdoc-internals-feature, r=camelid
Guillaume Gomez [Wed, 24 Nov 2021 21:56:37 +0000 (22:56 +0100)]
Rollup merge of #90420 - GuillaumeGomez:rustdoc-internals-feature, r=camelid

Create rustdoc_internals feature gate

As suggested by ``@camelid`` [here](https://github.com/rust-lang/rust/pull/90398#issuecomment-955093851), since `doc_keyword` and `doc_primitive` aren't meant to be stabilized, we could put them behind a same feature flag.

This is pretty much what it would look like (needs to update the tests too).

The tracking issue is https://github.com/rust-lang/rust/issues/90418.

What do you think ``@rust-lang/rustdoc`` ?

2 years agoRollup merge of #90044 - rusticstuff:disable_arm_outline_atomics_for_musl, r=workingj...
Guillaume Gomez [Wed, 24 Nov 2021 21:56:36 +0000 (22:56 +0100)]
Rollup merge of #90044 - rusticstuff:disable_arm_outline_atomics_for_musl, r=workingjubilee

Restrict aarch64 outline atomics to glibc for now.

The introduced dependency on `getauxval` causes linking problems with musl, making compiling any binaries for `aarch64-unknown-linux-musl` impossible without workarounds such as using lld or adding liblibc.rlib again to the linker invocation, see #89626.

This is a workaround until libc>0.2.108 is merged.

2 years agoRollup merge of #89542 - jhpratt:stabilize-duration-const-fns, r=oli-obk
Guillaume Gomez [Wed, 24 Nov 2021 21:56:35 +0000 (22:56 +0100)]
Rollup merge of #89542 - jhpratt:stabilize-duration-const-fns, r=oli-obk

Partially stabilize `duration_consts_2`

Methods that were only blocked on `const_panic` have been stabilized.
The remaining methods of `duration_consts_2` are all related to floats,
and as such have been placed behind the `duration_consts_float` feature
gate.

2 years agorustdoc: Add test for mixing doc comments and attrs
Noah Lev [Wed, 24 Nov 2021 21:16:10 +0000 (13:16 -0800)]
rustdoc: Add test for mixing doc comments and attrs

This is a step toward adding more test coverage to make it easier to
remove the distinction between collapsed and uncollapsed doc values.

2 years agoAdd test for merged features
Guillaume Gomez [Wed, 17 Nov 2021 20:09:45 +0000 (21:09 +0100)]
Add test for merged features

2 years agoUpdate error message for doc(keyword)
Guillaume Gomez [Mon, 8 Nov 2021 19:00:22 +0000 (20:00 +0100)]
Update error message for doc(keyword)

2 years agoAdd feature gate test for "rustdoc_internal" feature
Guillaume Gomez [Mon, 8 Nov 2021 16:27:56 +0000 (17:27 +0100)]
Add feature gate test for "rustdoc_internal" feature

2 years agoCreate rustdoc_internals feature gate
Guillaume Gomez [Sat, 30 Oct 2021 15:44:50 +0000 (17:44 +0200)]
Create rustdoc_internals feature gate

2 years agoImproving the readability
Stefan Lankes [Wed, 24 Nov 2021 20:12:56 +0000 (21:12 +0100)]
Improving the readability

Co-authored-by: kennytm <kennytm@gmail.com>
2 years agoRemove `ResolvedPath.did`
Noah Lev [Thu, 11 Nov 2021 23:45:45 +0000 (15:45 -0800)]
Remove `ResolvedPath.did`

2 years agoAuto merge of #91188 - jsha:fix-click-items, r=Manishearth
bors [Wed, 24 Nov 2021 20:03:33 +0000 (20:03 +0000)]
Auto merge of #91188 - jsha:fix-click-items, r=Manishearth

Fix clicking on anchors inside summary tags

Fixes #91184

r? `@camelid`

2 years agoChange how the fn params span is calculated
Esteban Kuber [Wed, 24 Nov 2021 17:11:15 +0000 (17:11 +0000)]
Change how the fn params span is calculated

Use the available Generics span field to avoid issues with `T: Fn()` bounds.

This is necessary to land #85346.

2 years agoAccount for incorrect `impl Foo<const N: ty> {}` syntax
Esteban Küber [Sat, 15 May 2021 21:56:28 +0000 (14:56 -0700)]
Account for incorrect `impl Foo<const N: ty> {}` syntax

Fix #84946

2 years agoUse `path.def_id()` in `Type::inner_def_id()`
Noah Lev [Thu, 11 Nov 2021 23:35:10 +0000 (15:35 -0800)]
Use `path.def_id()` in `Type::inner_def_id()`

2 years agoReturn the actual `DefId` for assoc. items in `register_res`
Noah Lev [Thu, 11 Nov 2021 23:05:25 +0000 (15:05 -0800)]
Return the actual `DefId` for assoc. items in `register_res`

Before, if `register_res` were called on an associated item or enum
variant, it would return the parent's `DefId`. Now, it returns the
actual `DefId`.

This change is a step toward removing `Type::ResolvedPath.did` and
potentially removing `kind_side_channel` in rustdoc. It also just
simplifies rustdoc's behavior.

2 years agoFix clicking on anchors inside summary tags.
Jacob Hoffman-Andrews [Wed, 24 Nov 2021 18:43:58 +0000 (10:43 -0800)]
Fix clicking on anchors inside summary tags.

2 years agoRemove `-Z force-overflow-checks`
Noah Lev [Wed, 24 Nov 2021 18:19:23 +0000 (10:19 -0800)]
Remove `-Z force-overflow-checks`

It was replaced several years ago by the stable option `-C
overflow-checks`. The goal was to delete the `-Z` flag once users had
migrated [1]. Now that it's been several years, it makes sense to delete
the old flag.

See also the discussion on Zulip [2].

[1]: https://github.com/rust-lang/rust/issues/33134#issuecomment-280484097
[2]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/overflow.20checks/near/262497224

2 years agoAuto merge of #90491 - Mark-Simulacrum:push-pred-faster, r=matthewjasper
bors [Wed, 24 Nov 2021 15:51:46 +0000 (15:51 +0000)]
Auto merge of #90491 - Mark-Simulacrum:push-pred-faster, r=matthewjasper

Optimize live point computation

This refactors the live-point computation to lower per-MIR-instruction costs by operating on a largely per-block level. This doesn't fundamentally change the number of operations necessary, but it greatly improves the practical performance by aggregating bit manipulation into ranges rather than single-bit; this scales much better with larger blocks.

On the benchmark provided in #90445, with 100,000 array elements, walltime for a check build is improved from 143 seconds to 15.

I consider the tiny losses here acceptable given the many small wins on real world benchmarks and large wins on stress tests. The new code scales much better, but on some subset of inputs the slightly higher constant overheads decrease performance somewhat. Overall though, this is expected to be a big win for pathological cases (as illustrated by the test case motivating this work) and largely not material for non-pathological cases. I consider the new code somewhat easier to follow, too.

2 years agoIf the thread does not get the lock in the short term, yield the CPU
Stefan Lankes [Wed, 24 Nov 2021 14:59:28 +0000 (15:59 +0100)]
If the thread does not get the lock in the short term, yield the CPU

Reduces the amount of wasted processor cycles

2 years agoUpdate GUI tests for <a> color
Guillaume Gomez [Wed, 24 Nov 2021 12:35:25 +0000 (13:35 +0100)]
Update GUI tests for <a> color

2 years agoFix more <a> color
Guillaume Gomez [Wed, 24 Nov 2021 12:35:15 +0000 (13:35 +0100)]
Fix more <a> color

2 years agoAuto merge of #90579 - cjgillot:no-ee-ii, r=Aaron1011
bors [Wed, 24 Nov 2021 12:51:19 +0000 (12:51 +0000)]
Auto merge of #90579 - cjgillot:no-ee-ii, r=Aaron1011

Remove eval_always for inherent_impls.

Split off https://github.com/rust-lang/rust/pull/86056
r? `@ghost`

2 years agoAuto merge of #91171 - jsha:fix-rustdoc-gui-test, r=GuillaumeGomez
bors [Wed, 24 Nov 2021 09:43:47 +0000 (09:43 +0000)]
Auto merge of #91171 - jsha:fix-rustdoc-gui-test, r=GuillaumeGomez

Fix toggle-click-deadspace rustdoc-gui test

In #91103 I introduced a rustdoc-gui test for clicks on toggles. I introduced some documentation on a method in lib2/struct.Foo.html so there would be something to toggle, but accidentally left the test checking test_docs/struct.Foo.html. That caused the test to reliably fail.

I'm not sure how that test got past GitHub Actions and bors, but it's manifesting in test failures at https://github.com/rust-lang/rust/pull/91062#issuecomment-977589705 and https://github.com/rust-lang/rust/pull/91170#issuecomment-977636159.

This fixes by pointing at the right file.

r? `@GuillaumeGomez`

2 years agoFix toggle-click-deadspace rustdoc-gui test
Jacob Hoffman-Andrews [Wed, 24 Nov 2021 08:58:07 +0000 (00:58 -0800)]
Fix toggle-click-deadspace rustdoc-gui test

2 years agoAdd impl polarity to fields
Deadbeef [Wed, 24 Nov 2021 08:07:38 +0000 (16:07 +0800)]
Add impl polarity to fields

2 years agoAllow features like const_try in d_m_b_i_c
Deadbeef [Wed, 29 Sep 2021 12:15:35 +0000 (12:15 +0000)]
Allow features like const_try in d_m_b_i_c

2 years agoAllow more cases to match ~const Drop.
Deadbeef [Wed, 29 Sep 2021 12:15:17 +0000 (12:15 +0000)]
Allow more cases to match ~const Drop.