Commit Graph

137023 Commits

Author SHA1 Message Date
Manish Goregaokar
83e73e013d
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.
2022-11-08 21:03:54 -05:00
Manish Goregaokar
75c239402c
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`.
2022-11-08 21:03:53 -05:00
Manish Goregaokar
7521a974d3
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
2022-11-08 21:03:52 -05:00
Manish Goregaokar
bd4e608f7b
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](47d1cdb0bc/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.*
2022-11-08 21:03:52 -05:00
Manish Goregaokar
f162e3a1b1
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 🙃)

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.
2022-11-08 21:03:51 -05:00
bors
bc2504a83c 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.
2022-11-09 02:02:28 +00:00
bors
8d36948b15 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
2022-11-08 22:50:12 +00:00
Boxy
983a90d716 tests 2022-11-08 22:15:40 +00:00
Eric Huss
ef40824fda Update books 2022-11-08 13:37:49 -08:00
Guillaume Gomez
3d20047f40
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``````
2022-11-08 20:40:52 +01:00
Guillaume Gomez
02db37a18a
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````
2022-11-08 20:40:51 +01:00
Guillaume Gomez
92f1c6f884
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.
2022-11-08 20:40:50 +01:00
Guillaume Gomez
3abf329040
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
2022-11-08 20:40:49 +01:00
bors
85f4f41deb 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 

r? types cc `@estebank`
2022-11-08 19:35:08 +00:00
bors
c5842b0be7 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.
2022-11-08 14:37:40 +00:00
lcnr
91d5a32bc5 ignore wasm in test 2022-11-08 14:48:07 +01:00
lcnr
f1551bfc02 selection failure: recompute applicable impls 2022-11-08 14:48:07 +01:00
yukang
9e7d2287cd use subdiagnostic for sugesting add let 2022-11-08 16:25:37 +08:00
yukang
667b15bb0e fix #103587, Recover from common if let syntax mistakes/typos 2022-11-08 14:10:04 +08:00
Dylan DPC
799648a61f
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.
2022-11-08 11:23:52 +05:30
Dylan DPC
4946ee7c8f
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
2022-11-08 11:23:51 +05:30
bors
6184a963f7 Auto merge of #104013 - notriddle:notriddle/rustdoc-sizeof, r=GuillaumeGomez
rustdoc: use `ThinVec` and `Box<str>` to shrink `clean::ItemKind`
2022-11-08 00:02:45 +00:00
Jack Huey
3c71fafd6d Add a known that this is a known limitation 2022-11-07 17:52:08 -05:00
Jack Huey
cececca7c7 Get spans for a couple more region types, add some optimizations, and extend test 2022-11-07 17:39:30 -05:00
Jack Huey
00e314d5ed Add an optional Span to BrAnon and use it to print better error for HRTB error from generator interior 2022-11-07 17:39:29 -05:00
Tanner Davies
66e8a29640 Only set config.config to None when using default path 2022-11-07 15:27:42 -07:00
onestacked
87c190c425 Reworked const fn ref tests 2022-11-07 21:16:22 +01:00
bors
d69c33ad4c 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`
2022-11-07 17:04:06 +00:00
Guillaume Gomez
d97fa2536f
Fix invalid background-image file name 2022-11-07 17:46:46 +01:00
onestacked
0c9896bfaa Fix const_fn_trait_ref_impl, add test for it 2022-11-07 17:41:58 +01:00
Kamil Koczurek
4c3cad0620 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.
2022-11-07 16:11:32 +01:00
bors
68f77297c0 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
2022-11-07 13:19:36 +00:00
Dylan DPC
81b8db2675
Rollup merge of #104090 - wanghaha-dev:master, r=Dylan-DPC
Modify comment syntax error

Modify comment syntax error
2022-11-07 18:35:26 +05:30
Dylan DPC
498efa6273
Rollup merge of #104052 - TaKO8Ki:fix-103997, r=notriddle
Fix `resolution_failure` ICE

Fixes #103997
2022-11-07 18:35:26 +05:30
Dylan DPC
f0bd2cdde4
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 😅

Fixes #104025
r? types
2022-11-07 18:35:25 +05:30
Dylan DPC
c590396914
Rollup merge of #104003 - c410-f3r:moar-errors, r=petrochenkov
Move some tests to more reasonable directories

r? `@petrochenkov`
2022-11-07 18:35:25 +05:30
Dylan DPC
170ad4a0ab
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)
2022-11-07 18:35:24 +05:30
bors
391ba78ab4 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`
2022-11-07 10:36:48 +00:00
Ralf Jung
397e5bb8c8 add FIXME to replace this env var in the future 2022-11-07 09:14:49 +01:00
wanghaha-dev
009f80b987 Modify comment syntax error 2022-11-07 14:33:33 +08:00
Jack Grigg
ee7a80211a 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.
2022-11-07 03:25:54 +00:00
Takayuki Maeda
6b2257b1b8 return None when def_kind is DefKind::Use 2022-11-07 11:14:13 +09:00
Yuki Okushi
fe6161a6a5
Rollup merge of #104065 - GuillaumeGomez:css-migrate-logo-filter, r=notriddle
Migrate rust logo filter to CSS variables
2022-11-07 09:46:28 +09:00
Yuki Okushi
458b132bf9
Rollup merge of #104062 - notriddle:notriddle/sidebar-filler, r=GuillaumeGomez
rustdoc: remove unused CSS `#sidebar-filler`

This hack was removed in 6a5f8b1aef, but the CSS was left in.
2022-11-07 09:46:27 +09:00
Yuki Okushi
19c780ab13
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``
2022-11-07 09:46:26 +09:00
Yuki Okushi
63f78d17b4
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``
2022-11-07 09:46:25 +09:00
Nicholas Bishop
42cbb40157 Use aapcs for efiapi calling convention on arm
On arm, llvm treats the C calling convention as `aapcs` on soft-float
targets and `aapcs-vfp` on hard-float targets [1]. UEFI specifies in the
arm calling convention that floating point extensions aren't used [2],
so always translate `efiapi` to `aapcs` on arm.

[1]: https://github.com/rust-lang/compiler-builtins/issues/116#issuecomment-261057422
[2]: https://uefi.org/specs/UEFI/2.10/02_Overview.html#detailed-calling-convention

https://github.com/rust-lang/rust/issues/65815
2022-11-06 18:05:24 -05:00
Nicholas Nethercote
dba6fc3ef5 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.
2022-11-07 10:00:36 +11:00
Nicholas Bishop
16edaa56ba Limit efiapi calling convention to supported arches
Supported architectures in UEFI are described here:
https://uefi.org/specs/UEFI/2.10/02_Overview.html#calling-conventions

Changes to tests modeled on 8240e7aa10.

https://github.com/rust-lang/rust/issues/65815
2022-11-06 17:04:42 -05:00
Ben Kimock
b97ec85e96 Add a codegen test for rust-lang/rust#96152 2022-11-06 16:56:47 -05:00
Guillaume Gomez
0e23d90e26 Extend rust-logo GUI test to check there is no filter for other logos 2022-11-06 20:20:43 +01:00
bors
7eef946fc0 Auto merge of #99943 - compiler-errors:tuple-trait, r=jackh726
Implement `std::marker::Tuple`, use it in `extern "rust-call"` and `Fn`-family traits

Implements rust-lang/compiler-team#537

I made a few opinionated decisions in this implementation, specifically:
1. Enforcing `extern "rust-call"` on fn items during wfcheck,
2. Enforcing this for all functions (not just ones that have bodies),
3. Gating this `Tuple` marker trait behind its own feature, instead of grouping it into (e.g.) `unboxed_closures`.

Still needing to be done:
1. Enforce that `extern "rust-call"` `fn`-ptrs are well-formed only if they have 1/2 args and the second one implements `Tuple`. (Doing this would fix ICE in #66696.)
2. Deny all explicit/user `impl`s of the `Tuple` trait, kinda like `Sized`.
3. Fixing `Tuple` trait built-in impl for chalk, so that chalkification tests are un-broken.

Open questions:
1. Does this need t-lang or t-libs signoff?

Fixes #99820
2022-11-06 17:48:33 +00:00
Guillaume Gomez
24d86a1c08 Migrate rust logo filter to CSS variables 2022-11-06 18:23:13 +01:00
Michael Howell
b34fdd32bb rustdoc: remove unused CSS #sidebar-filler
This hack was removed in 6a5f8b1aef, but the
CSS was left in.
2022-11-06 09:55:16 -07:00
Boxy
c0889a6005 fixyfixfix 2022-11-06 13:39:18 +00:00
Ralf Jung
a9edee7d1a bootstrap: put Miri sysroot into local build dir 2022-11-06 10:15:34 +01:00
Ralf Jung
c199a39884 bootstrap: add support for running Miri on a file 2022-11-06 09:52:31 +01:00
bors
88935e0bea Auto merge of #104043 - matthiaskrgr:rollup-sttf9e8, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #103012 (Suggest use .. to fill in the rest of the fields of Struct)
 - #103851 (Fix json flag in bootstrap doc)
 - #103990 (rustdoc: clean up `.logo-container` layout CSS)
 - #104002 (fix a comment in UnsafeCell::new)
 - #104014 (Migrate test-arrow to CSS variables)
 - #104016 (Add internal descriptions to a few queries)
 - #104035 (Add 'closure match' test to weird-exprs.rs.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-06 08:13:56 +00:00
Matthias Krüger
619add319f
Rollup merge of #104035 - m-ou-se:weird-expr-closure-match, r=compiler-errors
Add 'closure match' test to weird-exprs.rs.

Having fun with patterns that look like closures.
2022-11-06 08:35:28 +01:00
Matthias Krüger
ef0d79f865
Rollup merge of #104014 - GuillaumeGomez:run-button-css-var, r=notriddle
Migrate test-arrow to CSS variables

There should be no UI changes. I kept both `color` and `background-color` properties even though only the ayu theme is actually completely making use of them on hover.

r? ``@notriddle``
2022-11-06 08:35:27 +01:00
Matthias Krüger
c013962695
Rollup merge of #103990 - notriddle:notriddle/logo-container, r=GuillaumeGomez
rustdoc: clean up `.logo-container` layout CSS

This commit should result in no appearance changes.

To make the logo container exactly the desired height, you want to get rid of the part of the box used for typographic descenders (you know, the part of g, y, and j that descends below the baseline). After all, it contains no text, but the space is still left open in the layout by default, because `<img>` is `display:inline`. The CSS used to employ three different tricks to accomplish this:

* By making `.sidebar .logo-container` a flex container, the image becomes a flex item and is [blockified], without synthesizing any inline boxes. No inline boxes means no descenders.
* By giving `.mobile-topbar .logo-container` a max-height exactly the same as the height of the image plus the padding, the descender area gets cut off.
* By setting `.sub-logo-container { line-height: 0 }`, we ensure that the only box that contributes to the height of the line box is the image itself, and not any zero-content text boxes that neighbor it. See the [logical height algorithm].

This commit gets rid of the first two hacks, leaving only the third, since it requires only one line of code to accomplish and doesn't require setting the value based on math.

[blockified]: https://drafts.csswg.org/css-flexbox-1/#flex-items
[logical height algorithm]: https://www.w3.org/TR/css-inline-3/#inline-height
2022-11-06 08:35:26 +01:00
Matthias Krüger
131ef95808
Rollup merge of #103851 - viandoxdev:103816_bootstrap_fix_json_doc, r=jyn514
Fix json flag in bootstrap doc

Fix the `--json` flag not working with x.py (Closes #103816)

While this works I'm not sure about the `should_run` of `JsonStd`, had to change it because ab5a2bc731/src/bootstrap/builder.rs (L334) would match with JsonStd and remove the paths that Std matched. So I did [this](ffd4078264/src/bootstrap/doc.rs (L526-L534)) but that looks more like a hack/workaround than anything. I'm guessing there's something to do with the default condition thing but idk how it works
2022-11-06 08:35:26 +01:00
Matthias Krüger
58f5d57b5d
Rollup merge of #103012 - chenyukang:fix-102806, r=davidtwco,compiler-errors
Suggest use .. to fill in the rest of the fields of Struct

Fixes #102806
2022-11-06 08:35:26 +01:00
bors
e30fb6a26f Auto merge of #102618 - aliemjay:simplify-closure-promote, r=compiler-errors
rework applying closure requirements in borrowck

Previously the promoted closure constraints were registered under the category `ConstraintCategory::ClosureBounds` in `type_check::prove_closure_bounds()` and then mapped back their original category in `regions_infer::best_blame_constraint` using the complicated map `closure_bounds_mapping`.

Now we're registering promoted constraints under their original category and span earlier in `type_check::prove_closure_bounds`.

See commit messages.

Fixes #99245
2022-11-06 05:26:09 +00:00
Michael Goulet
9a1043eac7 Normalize signature when deducing closure signature from supertraits 2022-11-06 02:07:34 +00:00
Mara Bos
84fe2ee9d2 Add more nonsense to weird-exprs.rs. 2022-11-06 01:37:22 +01:00
Michael Howell
e410cd25b2 rustdoc: print usize with less string manipulation 2022-11-05 16:55:40 -07:00
clubby789
7df4b0b662 Rebase and update test 2022-11-05 23:07:57 +00:00
clubby789
7e38c8a750 Update UI test 2022-11-05 22:56:38 +00:00
clubby789
cef19b80f7 Split non-fixable case to different test 2022-11-05 22:56:38 +00:00
clubby789
da588e6df7 Attempt to fix arguments of associated functions 2022-11-05 22:56:37 +00:00
clubby789
02025b54ea Use FmtPrinter instead of creating Instance 2022-11-05 22:56:20 +00:00
clubby789
d1ec75da7c Update UI test 2022-11-05 22:56:20 +00:00
Michael Howell
21894801c6 rustdoc: add test case for huge logo 2022-11-05 14:26:13 -07:00
Tanner Davies
13d4c61b5f Place config.toml in current working directory if config not found 2022-11-05 15:07:10 -06:00
bors
1286ee23e4 Auto merge of #102458 - JohnTitor:stabilize-instruction-set, r=oli-obk
Stabilize the `instruction_set` feature

Closes https://github.com/rust-lang/rust/issues/74727
FCP is complete on https://github.com/rust-lang/rust/issues/74727#issuecomment-1242773253
r? `@pnkfelix` and/or `@nikomatsakis`
cc `@xd009642`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-11-05 20:39:06 +00:00
Michael Goulet
ff8f84ccf6 Bless more tests 2022-11-05 18:05:45 +00:00
Michael Goulet
d9891563d3 Merge conflicts and rebase onto master 2022-11-05 18:05:44 +00:00
Michael Goulet
29dccfe9e4 Bless chalk tests 2022-11-05 18:05:44 +00:00
Michael Goulet
2257ba92db Adjust diagnostics, bless tests 2022-11-05 18:05:44 +00:00
viandoxdev
900af414a3
fix out dir being wrong in json 2022-11-05 18:30:01 +01:00
Matthias Krüger
e51e4a4ecf
Rollup merge of #103988 - GuillaumeGomez:fix-bottom-border-color, r=notriddle
Fix search result bottom border color

It reverts a color change while keeping the improvement made in #103938.

I think it'll need to be backported once merged too.

r? `@notriddle`
2022-11-05 18:06:07 +01:00
Matthias Krüger
51287f264c
Rollup merge of #103927 - fee1-dead-contrib:E0425-no-typo-when-pattern-matching, r=cjgillot
Do not make typo suggestions when suggesting pattern matching

Fixes #103909.
2022-11-05 18:06:06 +01:00
Matthias Krüger
305cb7133f
Rollup merge of #103920 - ferrocene:pa-maybe-open-in-browser, r=jyn514
Move browser opening logic in `Builder`

This allows `open()` to be called from other places in bootstrap (I need this for Ferrocene, as we keep our custom steps in `src/bootstrap/ferrocene`), and it simplifies the callers by moving the `was_invoked_explicitly` check into the function.
2022-11-05 18:06:06 +01:00
Matthias Krüger
3eac639e1e
Rollup merge of #101702 - jsha:static-files2, r=notriddle,GuillaumeGomez
rustdoc: add hash to filename of toolchain files

All static files used by rustdoc are now stored in static.files/ and their filenames include a hash of their contents. Their filenames no longer include the contents of the --resource-suffix flag. This clarifies caching semantics. Anything in static.files can use Cache-Control: immutable because any updates will show up as a new URL.

Invocation-specific files like crates-NN.js, search-index-NN.js, and sidebar-items-NN.js still get the resource suffix.

This has a useful side effect: once toolchain files aren't affected by resource suffix, it will become possible for docs.rs to include crate version in the resource suffix. That should fix a caching issue with `/latest/` URLs: https://github.com/rust-lang/docs.rs/issues/1593. My goal is that it should be safe to serve all rustdoc JS, CSS, and fonts with infinite caching headers, even when new versions of a crate are uploaded in the same place as old versions.

The --disable-minification flag is removed because it would vary the output of static files based on invocation flags. Instead, for rustdoc development purposes it's preferable to symlink static files to a non-minified copy for quick iteration.

Example listing:

```
$ cd build/x86_64-unknown-linux-gnu/doc/ && find . | egrep 'js$|css$' | egrep -v 'sidebar-items|implementors' | sort
./crates1.65.0.js
./rust.css
./search-index1.65.0.js
./source-files1.65.0.js
./static.files/ayu-2bfd0af01c176fd5.css
./static.files/dark-95d11b5416841799.css
./static.files/light-c83a97e93a11f15a.css
./static.files/main-efc63f77fb116394.js
./static.files/normalize-76eba96aa4d2e634.css
./static.files/noscript-5bf457055038775c.css
./static.files/rustdoc-7a422337900fa894.css
./static.files/scrape-examples-3dd10048bcead3a4.js
./static.files/search-47f3c289722672cf.js
./static.files/settings-17b08337296ac774.js
./static.files/settings-3f95eacb845293c0.css
./static.files/source-script-215e9db86679192e.js
./static.files/storage-26d846fcae82ff09.js
```

Fixes #98413
2022-11-05 18:06:05 +01:00
Alex Gaynor
c33ee13391
Remove linuxkernel targets
These are not used by the actual Rust-for-Linux project, so they're mostly just confusing.
2022-11-05 12:30:28 -04:00
Guillaume Gomez
8e2956d4a9 Extend GUI test for run button 2022-11-05 17:22:38 +01:00
Guillaume Gomez
ffb28690aa Migrate test-arrow to CSS variables 2022-11-05 17:22:25 +01:00
Michael Howell
a69d43493a rustdoc: use ThinVec and Box<str> to shrink clean::ItemKind 2022-11-05 09:02:10 -07:00
Guillaume Gomez
666873b1bb Update GUI test for bottom border color 2022-11-05 16:43:09 +01:00
Guillaume Gomez
94ba7f09df Fix search result bottom border color 2022-11-05 16:43:08 +01:00
Deadbeef
b1994ce806 Do not make typo suggestions when suggesting pattern matching
Fixes #103909.
2022-11-05 15:33:25 +00:00
bors
6b8d9dd0a0 Auto merge of #103831 - chenyukang:yukang/fix-103751-ice, r=nagisa
Fix capacity overflow issue during transmutability check

Fixes #103751
2022-11-05 13:48:30 +00:00
Caio
f63ac6a13f Tidy 2022-11-05 09:59:27 -03:00
Caio
c72c646625 Move some tests to more reasonable directories 2022-11-05 09:58:13 -03:00
Vadim Petrochenkov
bb401bd04d privacy: Print effective visibilities of constructors 2022-11-05 16:22:23 +04:00
Vadim Petrochenkov
24093fc6bd resolve: More detailed effective visibility tracking for imports
Also drop `extern` blocks from the effective visibility table, they are nominally private and it doesn't make sense to keep them there.
2022-11-05 15:46:22 +04:00
Mateusz Mikuła
d5899efbda Update several crates for improved support of the new targets
This helps with `*-windows-gnullvm` targets
2022-11-05 12:19:55 +01:00
bors
b0f3940c35 Auto merge of #103691 - michaelwoerister:consistent-slice-and-str-cpp-like-debuginfo-names, r=wesleywiser
[debuginfo] Make cpp-like debuginfo type names for slices and str consistent.

Before this PR, the compiler would emit the debuginfo name `slice$<T>` for all kinds of slices, regardless of whether they are behind a reference or not and regardless of the kind of reference. As a consequence, the types `Foo<&[T]>`, `Foo<[T]>`, and `Foo<&mut [T]>` would end up with the same type name `Foo<slice$<T> >` in debuginfo, making it impossible to disambiguate between them by name. Similarly, `&str` would get the name `str` in debuginfo, so the debuginfo name for `Foo<str>` and `Foo<&str>` would be the same. In contrast, `*const [bool]` and `*mut [bool]` would be `ptr_const$<slice$<bool> >` and `ptr_mut$<slice$<bool> >`, i.e. the encoding does not lose information about the type.

This PR removes all special handling for slices and `str`. The types `&[bool]`, `&mut [bool]`, and `&str` thus get the names `ref$<slice2$<bool> >`, `ref_mut$<slice2$<bool> >`, and `ref$<str$>` respectively -- as one would expect.

The new special name for slices is `slice2$` to differentiate it from the previous name `slice$`, which has different semantics. The same is true for `str` and `str$`. This kind of versioning already has a precedent with the case of `enum$` and `enum2$` and hopefully will make it easier to transition existing consumers of these names.

cc `@rust-lang/wg-debugging` `@vadimcn`

r? `@wesleywiser`

UPDATE: Here is a table to clarify the changes

| Rust type | DWARF name | C++-like name (before) | C++-like name (after) |
|-----------|------------|------------------------|------------------------|
| `[T]`        | `[T]`        | `slice$<T>`              | `slice2$<T>`           |
| `&[T]`       | `&[T]`       | `slice$<T>`              | `ref$<slice2$<T> >`    |
| `&mut [T]`   | `&mut [T]`   | `slice$<T>`              | `ref_mut$<slice2$<T> >`|
| `str`        | `str`        | `str`                    | `str$`           |
| `&str`       | `&str`       | `str`                    | `ref$<str$>`    |
| `&mut str`   | `&mut str`   | `str`                    | `ref_mut$<str$>`|
| `*const [T]` | `*const [T]` | `ptr_const$<slice$<T> >` | `ptr_const$<slice2$<T> >` |
| `*mut [T]`   | `*mut [T]`   | `ptr_mut$<slice$<T> >`   | `ptr_mut$<slice2$<T> >` |

As you can see, before the PR many types would end up with the same name, making it impossible to distinguish between them in NatVis or other places where types are matched or looked up by name. The DWARF version of names is not changed.
2022-11-05 11:07:50 +00:00
bors
452cf4f710 Auto merge of #103998 - Dylan-DPC:rollup-2nbmtc9, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #103621 (Correctly resolve Inherent Associated Types)
 - #103660 (improve `filesearch::get_or_default_sysroot`)
 - #103866 (Remove some return-type diagnostic booleans from `FnCtxt`)
 - #103867 (Remove `has_errors` from `FnCtxt`)
 - #103994 (Specify that `break` cannot be used outside of loop *or* labeled block)
 - #103995 (Small round of typo fixes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-05 07:32:09 +00:00