]> git.lizzy.rs Git - rust.git/log
rust.git
19 months agoRollup merge of #103694 - WaffleLapkin:mask_doc_example, r=scottmcm
Dylan DPC [Wed, 9 Nov 2022 13:51:22 +0000 (19:21 +0530)]
Rollup merge of #103694 - WaffleLapkin:mask_doc_example, r=scottmcm

Add documentation examples for `pointer::mask`

The examples are somewhat convoluted, but I don't know how to make this better :(

19 months agoRollup merge of #103570 - lukas-code:stabilize-ilog, r=scottmcm
Dylan DPC [Wed, 9 Nov 2022 13:51:21 +0000 (19:21 +0530)]
Rollup merge of #103570 - lukas-code:stabilize-ilog, r=scottmcm

Stabilize integer logarithms

Stabilizes feature `int_log`.

I've also made the functions const stable, because they don't depend on any unstable const features. `rustc_allow_const_fn_unstable` is just there for `Option::expect`, which could be replaced with a `match` and `panic!`. cc ``@rust-lang/wg-const-eval``

closes https://github.com/rust-lang/rust/issues/70887 (tracking issue)

~~blocked on FCP finishing: https://github.com/rust-lang/rust/issues/70887#issuecomment-1289028216~~
FCP finished: https://github.com/rust-lang/rust/issues/70887#issuecomment-1302121266

19 months agoAuto merge of #102565 - jyn514:refactor-build-manifest, r=Mark-Simulacrum
bors [Wed, 9 Nov 2022 10:24:27 +0000 (10:24 +0000)]
Auto merge of #102565 - jyn514:refactor-build-manifest, r=Mark-Simulacrum

Refactor build-manifest to minimize the number of changes needed to add a new component

- Add all components to `PkgType`
- Automate functionality wherever possible, so functions often don't have to be manually edited
- Where that's not possible, use exhaustive matches on `PkgType` instead of adding individual strings.
- Add documentation for how to add a component. Improve the existing documentation for how to test changes.

I tested locally that this generates an identical manifest before and after my change, as follows:
```sh
git checkout d44e14225ab00e164aa9ea9e8d9e1bee40f96b3e
cargo +nightly run --manifest-path src/tools/build-manifest/Cargo.toml build/dist build/manifest-before 1970-01-01 http://example.com nightly
git checkout refactor-build-manifest
cargo +nightly run --manifest-path src/tools/build-manifest/Cargo.toml build/dist build/manifest-before 1970-01-01 http://example.com nightly
sort -u build/manifest-before/channel-rust-nightly.toml | diff - <(sort -u build/manifest-after/channel-rust-nightly.toml)
```
I then verified by hand that the differences before sorting are inconsequential (mostly targets being slightly reordered).

The only change in behavior is that `llvm-tools` is now properly renamed to `llvm-tools-preview`:
```
; sort -u build/manifest-before/channel-rust-nightly.toml | diff - <(sort -u build/manifest-after/channel-rust-nightly.toml)
784a785
> [renames.llvm-tools]
894a896
> to = "llvm-tools-preview"
```

This is based on https://github.com/rust-lang/rust/pull/102241 and should not be merged before.

19 months agoAuto merge of #104180 - fee1-dead-contrib:fix-wf-fndef, r=oli-obk
bors [Wed, 9 Nov 2022 07:37:49 +0000 (07:37 +0000)]
Auto merge of #104180 - fee1-dead-contrib:fix-wf-fndef, r=oli-obk

Use `nominal_obligations_without_const` in wf for FnDef

Fixes #104155.

19 months agoAuto merge of #104179 - Manishearth:rollup-yvsx5hh, r=Manishearth
bors [Wed, 9 Nov 2022 04:43:43 +0000 (04:43 +0000)]
Auto merge of #104179 - Manishearth:rollup-yvsx5hh, r=Manishearth

Rollup of 7 pull requests

Successful merges:

 - #100508 (avoid making substs of type aliases late bound when used as fn args)
 - #101381 (Test that target feature mix up with homogeneous floats is sound)
 - #103353 (Fix Access Violation when using lld & ThinLTO on windows-msvc)
 - #103521 (Avoid possible infinite  loop when next_point reaching the end of file)
 - #103559 (first move on a nested span_label)
 - #103778 (Update several crates for improved support of the new targets)
 - #103827 (Properly remap and check for substs compatibility in `confirm_impl_trait_in_trait_candidate`)

Failed merges:

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

19 months agoUse `nominal_obligations_without_const` in wf for FnDef
Deadbeef [Wed, 9 Nov 2022 02:08:22 +0000 (02:08 +0000)]
Use `nominal_obligations_without_const` in wf for FnDef

19 months agoRollup merge of #103827 - compiler-errors:rpitit-substs-compat, r=wesleywiser
Manish Goregaokar [Wed, 9 Nov 2022 02:03:54 +0000 (21:03 -0500)]
Rollup merge of #103827 - compiler-errors:rpitit-substs-compat, r=wesleywiser

Properly remap and check for substs compatibility in `confirm_impl_trait_in_trait_candidate`

Fixes #103824

19 months agoRollup merge of #103778 - mati865:update-deps, r=Mark-Simulacrum
Manish Goregaokar [Wed, 9 Nov 2022 02:03:54 +0000 (21:03 -0500)]
Rollup merge of #103778 - mati865:update-deps, r=Mark-Simulacrum

Update several crates for improved support of the new targets

This helps with `*-windows-gnullvm` targets by reducing amount of patching.

19 months agoRollup merge of #103559 - AndyJado:var_span_label, r=davidtwco
Manish Goregaokar [Wed, 9 Nov 2022 02:03:53 +0000 (21:03 -0500)]
Rollup merge of #103559 - AndyJado:var_span_label, r=davidtwco

first move on a nested span_label

trying not to be smart this time.

19 months agoRollup merge of #103521 - chenyukang:yukang/fix-103451-avoid-hang, r=jackh726,wesleywiser
Manish Goregaokar [Wed, 9 Nov 2022 02:03:53 +0000 (21:03 -0500)]
Rollup merge of #103521 - chenyukang:yukang/fix-103451-avoid-hang, r=jackh726,wesleywiser

Avoid possible infinite  loop when next_point reaching the end of file

Fixes #103451
If we return a span with `lo` = `hi`, `span_to_snippet` will always get `Ok("")`, which may introduce infinite loop if we don't care.

This PR make `find_width_of_character_at_span` return `width` with 1, so that `span_to_snippet` will get an `Err`.

19 months agoRollup merge of #103353 - wesleywiser:fix_lld_thinlto_msvc, r=michaelwoerister
Manish Goregaokar [Wed, 9 Nov 2022 02:03:52 +0000 (21:03 -0500)]
Rollup merge of #103353 - wesleywiser:fix_lld_thinlto_msvc, r=michaelwoerister

Fix Access Violation when using lld & ThinLTO on windows-msvc

Users report an AV at runtime of the compiled binary when using lld and ThinLTO on windows-msvc. The AV occurs when accessing a static value which is defined in one crate but used in another. Based on the disassembly of the cross-crate use, it appears that the use is not correctly linked with the definition and is instead assigned a garbage pointer value.

If we look at the symbol tables for each crates' obj file, we can see what is happening:

*lib.obj*:

```
COFF SYMBOL TABLE
...
00E 00000000 SECT2  notype       External     | _ZN10reproducer7memrchr2FN17h612b61ca0e168901E
...
```

*bin.obj*:

```
COFF SYMBOL TABLE
...
010 00000000 UNDEF  notype       External     | __imp__ZN10reproducer7memrchr2FN17h612b61ca0e168901E
...
```

The use of the symbol has the "import" style symbol name but the declaration doesn't generate any symbol with the same name. As a result, linking the files generates a warning from lld:

> rust-lld: warning: bin.obj: locally defined symbol imported: reproducer::memrchr::FN::h612b61ca0e168901 (defined in lib.obj) [LNK4217]

and the symbol reference remains undefined at runtime leading to the AV.

To fix this, we just need to detect that we are performing ThinLTO (and thus, static linking) and omit the `dllimport` attribute on the extern item in LLVM IR.

Fixes #81408

19 months agoRollup merge of #101381 - Urgau:target-mixup-homogenous-floats, r=Amanieu
Manish Goregaokar [Wed, 9 Nov 2022 02:03:52 +0000 (21:03 -0500)]
Rollup merge of #101381 - Urgau:target-mixup-homogenous-floats, r=Amanieu

Test that target feature mix up with homogeneous floats is sound

This pull-request adds a test in `src/test/abi/` that test that target feature mix up with homogeneous floats is sound.

This is basically is ripoff of [src/test/ui/simd/target-feature-mixup.rs](https://github.com/rust-lang/rust/blob/47d1cdb0bcac8e417071ce1929d261efe2399ae2/src/test/ui/simd/target-feature-mixup.rs) but for floats and without `#[repr(simd)]`.

*Extracted from https://github.com/rust-lang/rust/pull/97559 since I don't yet know what to do with that PR.*

19 months agoRollup merge of #100508 - BoxyUwU:make_less_things_late_bound, r=nikomatsakis
Manish Goregaokar [Wed, 9 Nov 2022 02:03:51 +0000 (21:03 -0500)]
Rollup merge of #100508 - BoxyUwU:make_less_things_late_bound, r=nikomatsakis

avoid making substs of type aliases late bound when used as fn args

fixes #47511
fixes #85533
(although I did not know theses issues existed when i was working on this :upside_down_face:)

currently `Alias<...>` is treated the same as `Struct<...>` when deciding if generics should be late bound or early bound but this is not correct as `Alias` might normalize to a projection which does not constrain the generics.

I think this needs more tests before merging
more explanation of PR [here](https://hackmd.io/v44a-QVjTIqqhK9uretyQg?view)

Hackmd inline for future readers:
---

This assumes reader is familiar with the concept of early/late bound lifetimes. There's a section on rustc-dev-guide if not (although i think some details are a bit out of date)

## problem & background

Not all lifetimes on a fn can be late bound:
```rust
fn foo<'a>() -> &'a ();
impl<'a> Fn<()> for FooFnDef {
    type Output = &'a (); // uh oh unconstrained lifetime
}
```
so we make make them early bound
```rust
fn foo<'a>() -> &'a ();
impl<'a> Fn<()> for FooFnDef<'a> {// wow look at all that lifetimey
     type Output = &'a ();
}
```
(Closures have the same constraint however it is not enforced leading to soundness bugs, [#84385](https://github.com/rust-lang/rust/pull/84385) implements this "downgrading late bound to early bound" for closures)

lifetimes on fn items are only late bound when they are "constrained" by the fn args:
```rust
fn foo<'a>(_: &'a ()) -> &'a ();
//               late bound, not present on `FooFnItem`
//               vv
impl<'a> Trait<(&'a (),)> for FooFnItem {
    type Output = &'a ();
}

// projections do not constrain inputs
fn bar<'a, T: Trait>(_: <T as Trait<'a>>::Assoc) -> &'a (); //  early bound
                                                            //  vv
impl<'a, T: Trait> Fn<(<T as Trait<'a>>::Assoc,)> for BarFnItem<'a, T> {
    type Output = &'a ();
}
```

current logic for determining if inputs "constrain" a lifetime works off of HIR so does not normalize aliases. It also assumes that any path with no self type constrains all its substs (i.e. `Foo<'a, u32>` has no self type but `T::Assoc` does). This falls apart for top level type aliases (see linked issues):

```rust
type Alias<'a, T> = <T as Trait<'a>>::Assoc;
//                      wow look its a path with no self type uwu
//                      i bet that constrains `'a` so it should be latebound
//                      vvvvvvvvvvv
fn foo<'a, T: Trait>(_: Alias<'a, T>) -> &'a ();
//                     `Alias` normalized to make things clearer
//                     vvvvvvvvvvvvvvvvvvvvvvv
impl<'a, T: Trait> Fn<(<T as Trait<'a>>::Assoc,)> for FooFnDef<T> {
    type Output = &'a ();
    // oh no `'a` isnt constrained wah wah waaaah *trumbone noises*
    // i think, idk what musical instrument that is
}
```

## solution

The PR solves this by having the hir visitor that checks for lifetimes in constraining uses check if the path is a `DefKind::Alias`. If it is we ""normalize"" it by calling `type_of` and walking the returned type. This is a bit hacky as it requires a mapping between the substs on the path in hir, and the generics of the `type Alias<...>` which is on the ty layer.

Alternative solutions may involve calculating the "late boundness" of lifetimes after/during astconv rather than relying on hir at all. We already have code to determine whether a lifetime SHOULD be late bound or not as this is currently how the error for `fn foo<'a, T: Trait>(_: Alias<'a, T>) -> &'a ();` gets emitted.

It is probably not possible to do this right now, late boundness is used by `generics_of` and `gather_explicit_predicates_of` as we currently do not put late bound lifetimes in `Generics`. Although this seems sus to me as the long term goal is to make all generics late bound which would result in `generics_of(function)` being empty? [#103448](https://github.com/rust-lang/rust/pull/103448) places all lifetimes in `Generics` regardless of late boundness so that may be a good step towards making this possible.

19 months agoAuto merge of #103171 - jackh726:gen-interior-hrtb-error, r=cjgillot
bors [Wed, 9 Nov 2022 02:02:28 +0000 (02:02 +0000)]
Auto merge of #103171 - jackh726:gen-interior-hrtb-error, r=cjgillot

Better error for HRTB error from generator interior

cc #100013

This is just a first pass at an error. It could be better, and shouldn't really be emitted in the first place. But this is better than what was being emitted before.

19 months agoAuto merge of #104168 - GuillaumeGomez:rollup-tf4edqc, r=GuillaumeGomez
bors [Tue, 8 Nov 2022 22:50:12 +0000 (22:50 +0000)]
Auto merge of #104168 - GuillaumeGomez:rollup-tf4edqc, r=GuillaumeGomez

Rollup of 12 pull requests

Successful merges:

 - #103928 (Add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed')
 - #104027 (Place config.toml in current working directory if config not found)
 - #104093 (disable btree size tests on Miri)
 - #104097 (run alloc benchmarks in Miri and fix UB)
 - #104104 (Add split-debuginfo print option)
 - #104109 (rustdoc: Add mutable to the description)
 - #104113 (Fix `const_fn_trait_ref_impl`, add test for it)
 - #104114 (Fix invalid background-image file name)
 - #104132 (fix: lint against lint functions)
 - #104139 (Clarify licensing situation of MPSC and SPSC queue)
 - #104147 (Remove an address comparison from the parser)
 - #104165 (Add llvm-main to triagebot.toml)

Failed merges:

 - #104115 (Migrate crate-search element to CSS variables)

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

19 months agotests
Boxy [Tue, 8 Nov 2022 22:15:40 +0000 (22:15 +0000)]
tests

19 months agocomment
Boxy [Tue, 8 Nov 2022 21:59:58 +0000 (21:59 +0000)]
comment

19 months agoRollup merge of #104165 - Manishearth:triagebot-llvm, r=Mark-Simulacrum
Guillaume Gomez [Tue, 8 Nov 2022 19:40:54 +0000 (20:40 +0100)]
Rollup merge of #104165 - Manishearth:triagebot-llvm, r=Mark-Simulacrum

Add llvm-main to triagebot.toml

19 months agoRollup merge of #104147 - WaffleLapkin:don't-compare-ptr-addresses-in-parser-, r...
Guillaume Gomez [Tue, 8 Nov 2022 19:40:53 +0000 (20:40 +0100)]
Rollup merge of #104147 - WaffleLapkin:don't-compare-ptr-addresses-in-parser-, r=compiler-errors

Remove an address comparison from the parser

Originally this check was added in #68985, as suggested by https://github.com/rust-lang/rust/pull/68985/commits/940f65782cc5df7fecad27b38cc25b6d1eeaf2e8#r376850175. I don't think that this address check is a robust way of making parser more robust.

This code is also extensively tested by [`ui/parser/issues/issue-35813-postfix-after-cast.rs`](https://github.com/rust-lang/rust/blob/57d3c58ed6e0faf89a62411f96c000ffc9fd3937/src/test/ui/parser/issues/issue-35813-postfix-after-cast.rs).

_Replaces #103700_

r? `@compiler-errors`

19 months agoRollup merge of #104139 - ferrocene:pa-channel-licensing, r=pnkfelix
Guillaume Gomez [Tue, 8 Nov 2022 19:40:53 +0000 (20:40 +0100)]
Rollup merge of #104139 - ferrocene:pa-channel-licensing, r=pnkfelix

Clarify licensing situation of MPSC and SPSC queue

Originally, these two files were licensed under the `BSD-2-Clause` license, as they were based off sample code on a blog licensing those snippets under that license:

* `library/std/src/sync/mpsc/mpsc_queue.rs`
* `library/std/src/sync/mpsc/spsc_queue.rs`

In 2017 though, the author of that blog agreed to relicense their code under the standard `MIT OR Apache-2.0` license in https://github.com/rust-lang/rust/pull/42149. This PR clarifies the situation in the files by expanding the comment at the top of the file.

r? ``@pnkfelix``

19 months agoRollup merge of #104132 - Rejyr:rustc_lint-function-lints, r=davidtwco
Guillaume Gomez [Tue, 8 Nov 2022 19:40:52 +0000 (20:40 +0100)]
Rollup merge of #104132 - Rejyr:rustc_lint-function-lints, r=davidtwco

fix: lint against lint functions

Add `#[rustc_lint_diagnostics]` to lint functions missing them. From [this discussion](https://github.com/rust-lang/rust/pull/101138#issuecomment-1306379999).

r? ```@davidtwco```

19 months agoRollup merge of #104114 - GuillaumeGomez:background-image-path, r=notriddle
Guillaume Gomez [Tue, 8 Nov 2022 19:40:52 +0000 (20:40 +0100)]
Rollup merge of #104114 - GuillaumeGomez:background-image-path, r=notriddle

Fix invalid background-image file name

This is a follow-up of https://github.com/rust-lang/rust/pull/101702.

Apparently the image hash was the wrong one. You can see the error in https://doc.rust-lang.org/nightly/core/primitive.u16.html?search=hello too.

I really need to check if I can adds check for resources load errors in `browser-ui-test`.

cc ``````@jsha``````
r? ``````@notriddle``````

19 months agoRollup merge of #104113 - ink-feather-org:fix_const_fn_ref_impls, r=compiler-errors
Guillaume Gomez [Tue, 8 Nov 2022 19:40:51 +0000 (20:40 +0100)]
Rollup merge of #104113 - ink-feather-org:fix_const_fn_ref_impls, r=compiler-errors

Fix `const_fn_trait_ref_impl`, add test for it

#99943 broke `#[feature(const_fn_trait_ref_impl)]`, this PR fixes this and adds a test for it.

r? ````@fee1-dead````

19 months agoRollup merge of #104109 - yancyribbens:add-mutable-to-comment-for-align-to-mut, r...
Guillaume Gomez [Tue, 8 Nov 2022 19:40:51 +0000 (20:40 +0100)]
Rollup merge of #104109 - yancyribbens:add-mutable-to-comment-for-align-to-mut, r=thomcc

rustdoc: Add mutable to the description

`mutable` is missing from the description.  Currently the description for [align_to](https://github.com/rust-lang/rust/blob/master/library/core/src/slice/mod.rs#L3498) is the same as [align_to_mut](https://github.com/rust-lang/rust/blob/master/library/core/src/slice/mod.rs#L3559)

19 months agoRollup merge of #104104 - kamirr:master, r=lcnr
Guillaume Gomez [Tue, 8 Nov 2022 19:40:50 +0000 (20:40 +0100)]
Rollup merge of #104104 - kamirr:master, r=lcnr

Add split-debuginfo print option

This option prints all supported values for `-Csplit-debuginfo=..`, i.e. only stable ones on stable/beta and all of them on nightly/dev.

Motivated by 1.65.0 regression causing builds with the following entry in `Cargo.toml` to fail on Windows:
```toml
[profile.dev]
split-debuginfo = "unpacked"
```

See https://github.com/rust-lang/cargo/pull/11347 for details.

This will lead to closing https://github.com/rust-lang/rust/issues/103976.

19 months agoRollup merge of #104097 - RalfJung:miri-alloc-benches, r=thomcc
Guillaume Gomez [Tue, 8 Nov 2022 19:40:50 +0000 (20:40 +0100)]
Rollup merge of #104097 - RalfJung:miri-alloc-benches, r=thomcc

run alloc benchmarks in Miri and fix UB

Miri since recently has a "fake monotonic clock" that works even with isolation. Its measurements are not very meaningful but it means we can run these benches and check them for UB.

And that's a good thing since there was UB here: fixes https://github.com/rust-lang/rust/issues/104096.

r? ``@thomcc``

19 months agoRollup merge of #104093 - RalfJung:test-sizes, r=thomcc
Guillaume Gomez [Tue, 8 Nov 2022 19:40:49 +0000 (20:40 +0100)]
Rollup merge of #104093 - RalfJung:test-sizes, r=thomcc

disable btree size tests on Miri

Seems fine not to run these in Miri, they can't have UB anyway. And this lets us do layout randomization in Miri.

r? ``@thomcc``

19 months agoRollup merge of #104027 - ted-tanner:issue-103697-fix, r=jyn514
Guillaume Gomez [Tue, 8 Nov 2022 19:40:49 +0000 (20:40 +0100)]
Rollup merge of #104027 - ted-tanner:issue-103697-fix, r=jyn514

Place config.toml in current working directory if config not found

Fixes an issue where bootsrapping a Rust build would place `config.toml` in `{src_root}` rather than the current working directory

#103697

19 months agoRollup merge of #103928 - chenyukang:yukang/fix-103874-add-ty_error_with_guaranteed...
Guillaume Gomez [Tue, 8 Nov 2022 19:40:48 +0000 (20:40 +0100)]
Rollup merge of #103928 - chenyukang:yukang/fix-103874-add-ty_error_with_guaranteed, r=lcnr

Add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed'

Part of #103874

19 months agoAuto merge of #103252 - lcnr:recompute_applicable_impls, r=jackh726
bors [Tue, 8 Nov 2022 19:35:08 +0000 (19:35 +0000)]
Auto merge of #103252 - lcnr:recompute_applicable_impls, r=jackh726

selection failure: recompute applicable impls

The way we currently skip errors for ambiguous trait obligations seems pretty fragile so we get some duplicate errors because of this.

Removing this info from selection errors changes this system to be closer to my image of our new trait solver and is also making it far easier to change overflow errors to be non-fatal :sparkles:

r? types cc `@estebank`

19 months agoAdd llvm-main to triagebot.toml
Manish Goregaokar [Tue, 8 Nov 2022 19:29:58 +0000 (11:29 -0800)]
Add llvm-main to triagebot.toml

19 months agoFix outdated comment
Waffle Maybe [Tue, 8 Nov 2022 17:49:58 +0000 (21:49 +0400)]
Fix outdated comment

Co-authored-by: clubby789 <jamie@hill-daniel.co.uk>
19 months agoAuto merge of #103965 - petrochenkov:effvisperf3, r=oli-obk
bors [Tue, 8 Nov 2022 14:37:40 +0000 (14:37 +0000)]
Auto merge of #103965 - petrochenkov:effvisperf3, r=oli-obk

resolve: More detailed effective visibility tracking for imports

Per-`DefId` tracking is not enough, due to glob imports in particular, which have a single `DefId` for the whole glob import item.
We need to track this stuff per every introduced name (`NameBinding`).

Also drop `extern` blocks from the effective visibility table, they are nominally private and it doesn't make sense to keep them there.

Later commits add some debug-only invariant checking and optimiaztions to mitigate regressions in https://github.com/rust-lang/rust/pull/103965#issuecomment-1304256445.

This is a bugfix and continuation of https://github.com/rust-lang/rust/pull/102026.

19 months agoignore wasm in test
lcnr [Tue, 8 Nov 2022 13:16:49 +0000 (14:16 +0100)]
ignore wasm in test

19 months agodelay errors as bug
lcnr [Mon, 31 Oct 2022 09:27:51 +0000 (10:27 +0100)]
delay errors as bug

19 months agoselection failure: recompute applicable impls
lcnr [Wed, 19 Oct 2022 15:17:19 +0000 (17:17 +0200)]
selection failure: recompute applicable impls

19 months agoRemove an address comparison from the parser
Maybe Waffle [Tue, 8 Nov 2022 11:51:10 +0000 (11:51 +0000)]
Remove an address comparison from the parser

19 months agoAuto merge of #104063 - compiler-errors:ct-norm-unless, r=jackh726
bors [Tue, 8 Nov 2022 10:02:11 +0000 (10:02 +0000)]
Auto merge of #104063 - compiler-errors:ct-norm-unless, r=jackh726

Don't normalize constants unless they need normalization

Maybe makes normalization a bit faster when we have many constants in a type

r? `@ghost`

19 months agoclarify licensing situation of mpsc and spsc queue
Pietro Albini [Tue, 8 Nov 2022 08:36:08 +0000 (09:36 +0100)]
clarify licensing situation of mpsc and spsc queue

19 months agoAuto merge of #104138 - Dylan-DPC:rollup-m3ojpjg, r=Dylan-DPC
bors [Tue, 8 Nov 2022 06:49:52 +0000 (06:49 +0000)]
Auto merge of #104138 - Dylan-DPC:rollup-m3ojpjg, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #103446 (Specialize `iter::ArrayChunks::fold` for TrustedRandomAccess iterators)
 - #103651 (Fix `rustc_parse_format` spans following escaped utf-8 multibyte chars)
 - #103865 (Move `fallback_has_occurred` state tracking to `FnCtxt`)
 - #103955 (Update linker-plugin-lto.md to contain up to Rust 1.65)
 - #103987 (Remove `in_tail_expr` from FnCtxt)
 - #104067 (fix debuginfo for windows_gnullvm_base.rs)
 - #104094 (fully move `on_unimplemented` to `error_reporting`)

Failed merges:

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

19 months agoRollup merge of #104094 - lcnr:on_unimplemented-move, r=wesleywiser
Dylan DPC [Tue, 8 Nov 2022 05:53:53 +0000 (11:23 +0530)]
Rollup merge of #104094 - lcnr:on_unimplemented-move, r=wesleywiser

fully move `on_unimplemented` to `error_reporting`

the `traits` module has a few too many submodules in my opinion.

19 months agoRollup merge of #104067 - jeremyd2019:patch-1, r=davidtwco
Dylan DPC [Tue, 8 Nov 2022 05:53:53 +0000 (11:23 +0530)]
Rollup merge of #104067 - jeremyd2019:patch-1, r=davidtwco

fix debuginfo for windows_gnullvm_base.rs

These lines (including the FIXME comment) were added to windows_gnu_base.rs in cf2c492ef8c87c049b4e3a62f43c841aafc88cba but windows_gnullvm_base.rs was not updated.  This resulted in an error `LLVM ERROR: dwo only supported with ELF and Wasm` attempting to build on aarch64-pc-windows-gnullvm.

See also https://github.com/msys2/MINGW-packages/pull/13921#issuecomment-1304391707

/cc ```@mati865``` ```@davidtwco```

r? ```@davidtwco```

19 months agoRollup merge of #103987 - compiler-errors:no-in_tail_expr, r=eholk
Dylan DPC [Tue, 8 Nov 2022 05:53:52 +0000 (11:23 +0530)]
Rollup merge of #103987 - compiler-errors:no-in_tail_expr, r=eholk

Remove `in_tail_expr` from FnCtxt

Cleans up yet another unneeded member from `FnCtxt`. The `in_tail_expr` condition wasn't even correct -- it was set for true while typechecking the whole fn body.

19 months agoRollup merge of #103955 - str4d:update-lto-doc-1.65, r=ehuss
Dylan DPC [Tue, 8 Nov 2022 05:53:52 +0000 (11:23 +0530)]
Rollup merge of #103955 - str4d:update-lto-doc-1.65, r=ehuss

Update linker-plugin-lto.md to contain up to Rust 1.65

The table rows were obtained via the script embedded in the page.

19 months agoRollup merge of #103865 - compiler-errors:fallback-has-occurred-tracking, r=eholk
Dylan DPC [Tue, 8 Nov 2022 05:53:51 +0000 (11:23 +0530)]
Rollup merge of #103865 - compiler-errors:fallback-has-occurred-tracking, r=eholk

Move `fallback_has_occurred` state tracking to `FnCtxt`

Removes a ton of callsites that defaulted to `false`

19 months agoRollup merge of #103651 - Alexendoo:parse-format-unicode-escapes, r=wesleywiser
Dylan DPC [Tue, 8 Nov 2022 05:53:51 +0000 (11:23 +0530)]
Rollup merge of #103651 - Alexendoo:parse-format-unicode-escapes, r=wesleywiser

Fix `rustc_parse_format` spans following escaped utf-8 multibyte chars

Currently too many skips are created for char escapes that are larger than 1 byte when encoded in UTF-8, [playground:](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c77a9dc669b69b167271b59ed2c8d88c)

```rust
fn main() {
    format!("\u{df}{a}");
    format!("\u{211d}{a}");
    format!("\u{1f4a3}{a}");
}
```
```
error[[E0425]](https://doc.rust-lang.org/stable/error-index.html#E0425): cannot find value `a` in this scope
 --> src/main.rs:2:22
  |
2 |     format!("\u{df}{a}");
  |                      ^ not found in this scope

error[[E0425]](https://doc.rust-lang.org/stable/error-index.html#E0425): cannot find value `a` in this scope
 --> src/main.rs:3:25
  |
3 |     format!("\u{211d}{a}");
  |                         ^ not found in this scope

error[[E0425]](https://doc.rust-lang.org/stable/error-index.html#E0425): cannot find value `a` in this scope
 --> src/main.rs:4:27
  |
4 |     format!("\u{1f4a3}{a}");
  |                           ^ not found in this scope
```

This reduces the number of skips to account for that

Fixes https://github.com/rust-lang/rust-clippy/issues/9727

19 months agoRollup merge of #103446 - the8472:tra-array-chunks, r=Mark-Simulacrum
Dylan DPC [Tue, 8 Nov 2022 05:53:50 +0000 (11:23 +0530)]
Rollup merge of #103446 - the8472:tra-array-chunks, r=Mark-Simulacrum

Specialize `iter::ArrayChunks::fold` for TrustedRandomAccess iterators

```
OLD:
test iter::bench_trusted_random_access_chunks                      ... bench:         368 ns/iter (+/- 4)
NEW:
test iter::bench_trusted_random_access_chunks                      ... bench:          30 ns/iter (+/- 0)
```

The resulting assembly is similar to #103166 but the specialization kicks in under different (partially overlapping) conditions compared to that PR. They're complementary.

In principle a TRA-based specialization could be applied to all `ArrayChunks` methods, including `next()` as we do for `Zip` but that would have all the same hazards as the Zip specialization. Only doing it for `fold` is far less hazardous. The downside is that it only helps with internal, exhaustive iteration. I.e. `for _ in` or `try_fold` will not benefit.

Note that the regular, `try_fold`-based and the specialized `fold()` impl have observably slightly different behavior. Namely the specialized variant does not fetch the remainder elements from the underlying iterator. We do have a few other places in the standard library where beyond-the-end-of-iteration side-effects are being elided under some circumstances but not others.

Inspired by https://old.reddit.com/r/rust/comments/yaft60/zerocost_iterator_abstractionsnot_so_zerocost/

19 months agocode cleanup with err.emit_unless
yukang [Fri, 4 Nov 2022 08:10:32 +0000 (16:10 +0800)]
code cleanup with err.emit_unless

19 months agodeprecate unchecked_claim_error_was_emitted in error_reported
yukang [Fri, 4 Nov 2022 02:02:54 +0000 (10:02 +0800)]
deprecate unchecked_claim_error_was_emitted in error_reported

19 months agoadd 'ty_error_with_guaranteed' and 'const_error_with_guaranteed'
yukang [Thu, 3 Nov 2022 06:15:17 +0000 (14:15 +0800)]
add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed'

19 months agoAuto merge of #104023 - Nilstrieb:cleanup-query, r=cjgillot
bors [Tue, 8 Nov 2022 03:03:38 +0000 (03:03 +0000)]
Auto merge of #104023 - Nilstrieb:cleanup-query, r=cjgillot

Several query cleanups

A few cleanups, mostly about naming in `rustc_query_system`.

r? `@cjgillot`

19 months agofix: lint against lint functions
Rejyr [Tue, 8 Nov 2022 00:23:29 +0000 (19:23 -0500)]
fix: lint against lint functions

fix: lint against the functions `LintContext::{lookup_with_diagnostics,lookup,struct_span_lint,lint}`, `TyCtxt::struct_lint_node`, `LintLevelsBuilder::struct_lint`.

19 months agoAuto merge of #104013 - notriddle:notriddle/rustdoc-sizeof, r=GuillaumeGomez
bors [Tue, 8 Nov 2022 00:02:45 +0000 (00:02 +0000)]
Auto merge of #104013 - notriddle:notriddle/rustdoc-sizeof, r=GuillaumeGomez

rustdoc: use `ThinVec` and `Box<str>` to shrink `clean::ItemKind`

19 months agodocument and improve array Guard type
The 8472 [Mon, 7 Nov 2022 23:13:26 +0000 (00:13 +0100)]
document and improve array Guard type

The type is unsafe and now exposed to the whole crate.
Document it properly and add an unsafe method so the
caller can make it visible that something unsafe is happening.

19 months agoAdd a known that this is a known limitation
Jack Huey [Mon, 7 Nov 2022 22:52:08 +0000 (17:52 -0500)]
Add a known that this is a known limitation

19 months agoGet spans for a couple more region types, add some optimizations, and extend test
Jack Huey [Wed, 19 Oct 2022 00:08:13 +0000 (20:08 -0400)]
Get spans for a couple more region types, add some optimizations, and extend test

19 months agoAdd an optional Span to BrAnon and use it to print better error for HRTB error from...
Jack Huey [Tue, 18 Oct 2022 02:08:15 +0000 (22:08 -0400)]
Add an optional Span to BrAnon and use it to print better error for HRTB error from generator interior

19 months agoOnly set config.config to None when using default path
Tanner Davies [Mon, 7 Nov 2022 22:27:42 +0000 (15:27 -0700)]
Only set config.config to None when using default path

19 months agosimplification: do not process the ArrayChunks remainder in fold()
The 8472 [Sun, 23 Oct 2022 19:29:15 +0000 (21:29 +0200)]
simplification: do not process the ArrayChunks remainder in fold()

19 months agospecialize iter::ArrayChunks::fold for TrustedRandomAccess iters
The 8472 [Sun, 23 Oct 2022 17:19:37 +0000 (19:19 +0200)]
specialize iter::ArrayChunks::fold for TrustedRandomAccess iters

This is fairly safe use of TRA since it consumes the iterator so
no struct in an unsafe state will be left exposed to user code

19 months agomake the array initialization guard available to other modules
The 8472 [Sun, 23 Oct 2022 17:17:41 +0000 (19:17 +0200)]
make the array initialization guard available to other modules

19 months agoadd benchmark for iter::ArrayChunks::fold specialization
The 8472 [Sun, 23 Oct 2022 17:16:49 +0000 (19:16 +0200)]
add benchmark for iter::ArrayChunks::fold specialization

This also updates the existing iter::Copied::next_chunk benchmark so
that the thing it benches doesn't get masked by the ArrayChunks specialization

19 months agoReworked const fn ref tests
onestacked [Mon, 7 Nov 2022 20:16:22 +0000 (21:16 +0100)]
Reworked const fn ref tests

19 months agoAuto merge of #103934 - notriddle:notriddle/backtrace-deps, r=Mark-Simulacrum
bors [Mon, 7 Nov 2022 20:05:09 +0000 (20:05 +0000)]
Auto merge of #103934 - notriddle:notriddle/backtrace-deps, r=Mark-Simulacrum

std: sync "Dependencies of the `backtrace` crate" with `backtrace`

Compare:

https://github.com/rust-lang/backtrace-rs/blob/07872f28cd8a65c3c7428811548dc85f1f2fb05b/Cargo.toml#L43

https://github.com/rust-lang/rust/blob/160b19429523ea44c4c3b7cad4233b2a35f58b8f/library/std/Cargo.toml#L26

19 months agoAuto merge of #103569 - RalfJung:miri-test-macos, r=Mark-Simulacrum
bors [Mon, 7 Nov 2022 17:04:06 +0000 (17:04 +0000)]
Auto merge of #103569 - RalfJung:miri-test-macos, r=Mark-Simulacrum

fix and (re-)enable Miri cross-target checks on macOS and Windows

Fixes https://github.com/rust-lang/rust/issues/103519
r? `@Mark-Simulacrum`

19 months agoFix invalid background-image file name
Guillaume Gomez [Mon, 7 Nov 2022 16:46:46 +0000 (17:46 +0100)]
Fix invalid background-image file name

19 months agoFix `const_fn_trait_ref_impl`, add test for it
onestacked [Mon, 7 Nov 2022 16:41:58 +0000 (17:41 +0100)]
Fix `const_fn_trait_ref_impl`, add test for it

19 months agorustdoc: Add mutable to the description
yancy [Mon, 7 Nov 2022 15:51:23 +0000 (16:51 +0100)]
rustdoc: Add mutable to the description

19 months agoAdd --print=split-debuginfo
Kamil Koczurek [Mon, 7 Nov 2022 14:21:35 +0000 (15:21 +0100)]
Add --print=split-debuginfo

This option prints all supported values for -Csplit-debuginfo=.., i.e.
only stable ones on stable/beta and all of them on nightly/dev.

19 months agofmt
Ralf Jung [Mon, 7 Nov 2022 14:24:49 +0000 (15:24 +0100)]
fmt

19 months agoAuto merge of #104102 - Dylan-DPC:rollup-0eakshe, r=Dylan-DPC
bors [Mon, 7 Nov 2022 13:19:36 +0000 (13:19 +0000)]
Auto merge of #104102 - Dylan-DPC:rollup-0eakshe, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #103757 (Mention const and lifetime parameters in error E0207)
 - #103986 (Don't silently eat label before block in block-like expr)
 - #104003 (Move some tests to more reasonable directories)
 - #104038 (Normalize types when deducing closure signature from supertraits)
 - #104052 (Fix `resolution_failure` ICE)
 - #104090 (Modify comment syntax error)

Failed merges:

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

19 months agoRollup merge of #104090 - wanghaha-dev:master, r=Dylan-DPC
Dylan DPC [Mon, 7 Nov 2022 13:05:26 +0000 (18:35 +0530)]
Rollup merge of #104090 - wanghaha-dev:master, r=Dylan-DPC

Modify comment syntax error

Modify comment syntax error

19 months agoRollup merge of #104052 - TaKO8Ki:fix-103997, r=notriddle
Dylan DPC [Mon, 7 Nov 2022 13:05:26 +0000 (18:35 +0530)]
Rollup merge of #104052 - TaKO8Ki:fix-103997, r=notriddle

Fix `resolution_failure` ICE

Fixes #103997

19 months agoRollup merge of #104038 - compiler-errors:super-norm-closure-sig, r=lcnr
Dylan DPC [Mon, 7 Nov 2022 13:05:25 +0000 (18:35 +0530)]
Rollup merge of #104038 - compiler-errors:super-norm-closure-sig, r=lcnr

Normalize types when deducing closure signature from supertraits

Elaborated supertraits should be normalized, since there's no guarantee they don't contain projections :sweat_smile:

Fixes #104025
r? types

19 months agoRollup merge of #104003 - c410-f3r:moar-errors, r=petrochenkov
Dylan DPC [Mon, 7 Nov 2022 13:05:25 +0000 (18:35 +0530)]
Rollup merge of #104003 - c410-f3r:moar-errors, r=petrochenkov

Move some tests to more reasonable directories

r? `@petrochenkov`

19 months agoRollup merge of #103986 - compiler-errors:oh-no-bad-block-should-not-have-label,...
Dylan DPC [Mon, 7 Nov 2022 13:05:24 +0000 (18:35 +0530)]
Rollup merge of #103986 - compiler-errors:oh-no-bad-block-should-not-have-label, r=lcnr

Don't silently eat label before block in block-like expr

Fixes #103983
cc #92823 (where the regression was introduced)

19 months agoRollup merge of #103757 - ffmancera:ff/clarify_E0207, r=jackh726
Dylan DPC [Mon, 7 Nov 2022 13:05:23 +0000 (18:35 +0530)]
Rollup merge of #103757 - ffmancera:ff/clarify_E0207, r=jackh726

Mention const and lifetime parameters in error E0207

Error Index for E0207 must mention const and lifetime parameters. In addition, add code examples for these situations.

Fixes #80862

19 months agoAuto merge of #101395 - saethlin:strict-provenance-codegen, r=nikic
bors [Mon, 7 Nov 2022 10:36:48 +0000 (10:36 +0000)]
Auto merge of #101395 - saethlin:strict-provenance-codegen, r=nikic

Add a codegen test for rust-lang/rust#96152

This is a regression test for https://github.com/rust-lang/rust/issues/96152, it is intended to check that our codegen for a particular strict provenance pattern is always as good as the ptr2int2ptr/provenance-ignoring style.

r? `@nikic`

19 months agorun alloc benchmarks in Miri and fix UB
Ralf Jung [Mon, 7 Nov 2022 09:33:54 +0000 (10:33 +0100)]
run alloc benchmarks in Miri and fix UB

19 months agodisable btree size tests on Miri
Ralf Jung [Mon, 7 Nov 2022 08:29:14 +0000 (09:29 +0100)]
disable btree size tests on Miri

19 months agoadd FIXME to replace this env var in the future
Ralf Jung [Mon, 7 Nov 2022 08:14:49 +0000 (09:14 +0100)]
add FIXME to replace this env var in the future

19 months agoAuto merge of #103218 - CastilloDel:infer, r=jackh726
bors [Mon, 7 Nov 2022 07:38:05 +0000 (07:38 +0000)]
Auto merge of #103218 - CastilloDel:infer, r=jackh726

Remove #![allow(rustc::potential_query_instability)] from rustc_infer

Related to #84447

This PR probably needs to be benchmarked to check for regressions.

19 months agofully move `on_unimplemented` to error reporting
lcnr [Mon, 7 Nov 2022 07:10:25 +0000 (08:10 +0100)]
fully move `on_unimplemented` to error reporting

19 months agoModify comment syntax error
wanghaha-dev [Mon, 7 Nov 2022 06:33:33 +0000 (14:33 +0800)]
Modify comment syntax error

19 months agoMigrate linker-plugin-lto.md compatibility table to show Rust ranges
Jack Grigg [Mon, 7 Nov 2022 03:25:54 +0000 (03:25 +0000)]
Migrate linker-plugin-lto.md compatibility table to show Rust ranges

The helper shell script has been rewritten as a helper Python script
that generates the range-based table.

19 months agoAuto merge of #104083 - JohnTitor:rollup-lo3wbzs, r=JohnTitor
bors [Mon, 7 Nov 2022 02:15:39 +0000 (02:15 +0000)]
Auto merge of #104083 - JohnTitor:rollup-lo3wbzs, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #103885 (rustdoc: various cross-crate reexport fixes)
 - #103914 (Make underscore_literal_suffix a hard error.)
 - #104045 (Add type_array to BaseTypeMethods)
 - #104056 (Vec: IntoIterator signature consistency)
 - #104059 (Fix typo in `rustc_middle/lint.rs`)
 - #104062 (rustdoc: remove unused CSS `#sidebar-filler`)
 - #104065 (Migrate rust logo filter to CSS variables)
 - #104066 (LLVM 16: Update RISCV data layout)
 - #104074 (rustdoc: Add an example for round that is different from truncate)

Failed merges:

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

19 months agoreturn `None` when def_kind is `DefKind::Use`
Takayuki Maeda [Sun, 6 Nov 2022 11:58:16 +0000 (20:58 +0900)]
return `None` when def_kind is `DefKind::Use`

19 months agofix debuginfo for windows_gnullvm_base.rs
jeremyd2019 [Sun, 6 Nov 2022 19:51:12 +0000 (11:51 -0800)]
fix debuginfo for windows_gnullvm_base.rs

These lines (including the FIXME comment) were added to windows_gnu_base.rs in cf2c492ef8c87c049b4e3a62f43c841aafc88cba but windows_gnullvm_base.rs was not updated.  This resulted in an error `LLVM ERROR: dwo only supported with ELF and Wasm` attempting to build on aarch64-pc-windows-gnullvm.

Signed-off-by: Jeremy Drake <github@jdrake.com>
19 months agoRollup merge of #104074 - yancyribbens:add-example-to-round, r=Mark-Simulacrum
Yuki Okushi [Mon, 7 Nov 2022 00:46:29 +0000 (09:46 +0900)]
Rollup merge of #104074 - yancyribbens:add-example-to-round, r=Mark-Simulacrum

rustdoc: Add an example for round that is different from truncate

The current examples for [round](https://github.com/rust-lang/rust/blob/master/library/std/src/f64.rs#L75) would have the same results as the example for [truncate](https://github.com/rust-lang/rust/blob/master/library/std/src/f64.rs#L95).  This PR adds one more example to `round` that will have a different result from `truncate`.

19 months agoRollup merge of #104066 - TimNN:riscv-layout, r=nikic
Yuki Okushi [Mon, 7 Nov 2022 00:46:28 +0000 (09:46 +0900)]
Rollup merge of #104066 - TimNN:riscv-layout, r=nikic

LLVM 16: Update RISCV data layout

The RISCV data layout was changed in https://github.com/llvm/llvm-project/commit/974e2e690b4024c2677dde26cc76ec31e0047c1d.

This updates all `riscv64*` targets, though I don't really know what the difference between the `gc` and `imac` ones is.

Passes `x test codegen` at LLVM head and with the currently bundled LLVM version. Without this patch, some tests fail with:

> error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:192:13: data-layout for target `riscv64gc-unknown-none-elf`, `e-m:e-p:64:64-i64:64-i128:128-n64-S128`, differs from LLVM target's `riscv64` default layout, `e-m:e-p:64:64-i64:64-i128:128-n32:64-S128

19 months agoRollup merge of #104065 - GuillaumeGomez:css-migrate-logo-filter, r=notriddle
Yuki Okushi [Mon, 7 Nov 2022 00:46:28 +0000 (09:46 +0900)]
Rollup merge of #104065 - GuillaumeGomez:css-migrate-logo-filter, r=notriddle

Migrate rust logo filter to CSS variables

19 months agoRollup merge of #104062 - notriddle:notriddle/sidebar-filler, r=GuillaumeGomez
Yuki Okushi [Mon, 7 Nov 2022 00:46:27 +0000 (09:46 +0900)]
Rollup merge of #104062 - notriddle:notriddle/sidebar-filler, r=GuillaumeGomez

rustdoc: remove unused CSS `#sidebar-filler`

This hack was removed in 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c, but the CSS was left in.

19 months agoRollup merge of #104059 - Rejyr:rustc_middle-lint-typo, r=petrochenkov
Yuki Okushi [Mon, 7 Nov 2022 00:46:27 +0000 (09:46 +0900)]
Rollup merge of #104059 - Rejyr:rustc_middle-lint-typo, r=petrochenkov

Fix typo in `rustc_middle/lint.rs`

19 months agoRollup merge of #104056 - ripytide:patch-1, r=Mark-Simulacrum
Yuki Okushi [Mon, 7 Nov 2022 00:46:26 +0000 (09:46 +0900)]
Rollup merge of #104056 - ripytide:patch-1, r=Mark-Simulacrum

Vec: IntoIterator signature consistency

Also makes the code dryer.

19 months agoRollup merge of #104045 - Ayush1325:type_array, r=nikic
Yuki Okushi [Mon, 7 Nov 2022 00:46:26 +0000 (09:46 +0900)]
Rollup merge of #104045 - Ayush1325:type_array, r=nikic

Add type_array to BaseTypeMethods

Moved `type_array` function to `rustc_codegen_ssa::BaseTypeMethods` trait. This allows using normal `alloca` function to create arrays as suggested in https://github.com/rust-lang/rust/pull/104022.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
19 months agoRollup merge of #103914 - nnethercote:close-42326, r=petrochenkov
Yuki Okushi [Mon, 7 Nov 2022 00:46:26 +0000 (09:46 +0900)]
Rollup merge of #103914 - nnethercote:close-42326, r=petrochenkov

Make underscore_literal_suffix a hard error.

It's been a warning for 5.5 years. Time to make it a hard error.

Closes #42326.

r? ``@pnkfelix``

19 months agoRollup merge of #103885 - fmease:rustdoc-various-cross-crate-reexport-fixes, r=cjgill...
Yuki Okushi [Mon, 7 Nov 2022 00:46:25 +0000 (09:46 +0900)]
Rollup merge of #103885 - fmease:rustdoc-various-cross-crate-reexport-fixes, r=cjgillot,GuillaumeGomez

rustdoc: various cross-crate reexport fixes

Fixes for various smaller cross-crate reexport issues.
The PR is split into several commits for easier review. Will be squashed after approval.

Most notable changes:

* We finally render late-bound lifetimes in the generic parameter list of cross-crate functions & methods.
  Previously, we would display the re-export of `pub fn f<'s>(x: &'s str) {}` as `pub fn f(x: &'s str)`
* We now render unnamed parameters of cross-crate functions and function pointers as underscores
  since that's exactly what we do for local definitions, too. Mentioned as a bug in #44306.
* From now on, the rendering of cross-crate trait-object types is more correct:
  * `for<>` parameter lists (for higher-ranked lifetimes) are now shown
  * the return type of `Fn{,Mut,Once}` trait bounds is now displayed

Regarding the last list item, here is a diff for visualization (before vs. after):

```patch
- dyn FnOnce(&'any str) + 'static
+ dyn for<'any> FnOnce(&'any str) -> bool + 'static
```

The redundant `+ 'static` will be removed in a follow-up PR that will hide trait-object lifetime-bounds if they coincide with [their default](https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes) (see [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/clean_middle_ty.3A.20I.20need.20to.20add.20a.20parameter/near/307143097)). `FIXME(fmease)`s were added.

``@rustbot`` label A-cross-crate-reexports
r? ``@GuillaumeGomez``

19 months agoDon't normalize constants unless they need normalization
Michael Goulet [Sun, 6 Nov 2022 17:14:05 +0000 (17:14 +0000)]
Don't normalize constants unless they need normalization

19 months agoMake underscore_literal_suffix a hard error.
Nicholas Nethercote [Thu, 3 Nov 2022 01:02:33 +0000 (12:02 +1100)]
Make underscore_literal_suffix a hard error.

It's been a warning for 5.5 years. Time to make it a hard error.

Closes #42326.

19 months agorustdoc: Add an example for round that is different from truncate
yancy [Sun, 6 Nov 2022 22:05:16 +0000 (23:05 +0100)]
rustdoc: Add an example for round that is different from truncate