Commit Graph

2414 Commits

Author SHA1 Message Date
Matthias Krüger
a656a2019a
Rollup merge of #110984 - cjgillot:const-infer-lifetime, r=compiler-errors
Do not resolve anonymous lifetimes in consts to be static.

Fixes https://github.com/rust-lang/rust/issues/110931
2023-04-30 01:14:59 +02:00
Matthias Krüger
549b3a13a1
Rollup merge of #110983 - GuillaumeGomez:foreign-repr, r=notriddle
rustdoc: Get `repr` information through `AdtDef` for foreign items

As suggested by `@notriddle,` this approach works too. The only downside is that the display of the original attribute isn't kept, but I think it's an acceptable downside.

r? `@notriddle`
2023-04-30 01:14:59 +02:00
Matthias Krüger
4b79276e60
Rollup merge of #110981 - jyn514:rustdoc-tests, r=notriddle
Move most rustdoc-ui tests into subdirectories

This makes it easier to know where to add a new test, and makes the top-level directory less overwhelming.
2023-04-30 01:14:58 +02:00
Matthias Krüger
791d33c5eb
Rollup merge of #110973 - bindsdev:packed-struct-ref-diagnostic-note, r=compiler-errors
improve error notes for packed struct reference diagnostic

Addresses #110199
2023-04-30 01:14:58 +02:00
Matthias Krüger
e4daa810ff
Rollup merge of #110652 - ojeda:core-no_global_oom_handling-test, r=Mark-Simulacrum
Add test for warning-free builds of `core` under `no_global_oom_handling`

`tests/run-make/alloc-no-oom-handling` tests that `alloc` under `no_global_oom_handling` builds and is warning-free.

Do the same for `core` to prevent issues such as [1].

Link: https://github.com/rust-lang/rust/pull/110649 [1]
2023-04-30 01:14:56 +02:00
Matthias Krüger
734e866e63
Rollup merge of #110586 - ChrisDenton:msvc-oem-output, r=workingjubilee
Fix Unreadable non-UTF-8 output on localized MSVC

Fixes #35785 by converting non UTF-8 linker output to Unicode using the OEM code page.

Before:

```text
  = note: Non-UTF-8 output: LINK : fatal error LNK1181: cannot open input file \'m\x84rchenhaft.obj\'\r\n
```

After:

```text
   = note: LINK : fatal error LNK1181: cannot open input file 'märchenhaft.obj'
```

The difference is more dramatic if using a non-ascii language pack for Windows.
2023-04-30 01:14:55 +02:00
Guillaume Gomez
2693e20aa3 Extend foreign inlined item with #[repr()] test 2023-04-29 22:53:10 +02:00
jyn
5da288f842 move lint tests into subdirectories 2023-04-29 11:36:19 -05:00
jyn
5fa975142f Move some rustdoc-ui tests to subdirectories 2023-04-29 11:36:19 -05:00
Camille GILLOT
9325a254f0 Make PlaceMention a non-mutating use. 2023-04-29 16:14:33 +00:00
Camille GILLOT
77dac91d4f Add test. 2023-04-29 16:14:32 +00:00
WANG Rui
4375d3b203 tests: Add tests for LoongArch64 2023-04-30 00:06:26 +08:00
Matthias Krüger
39ed894926
Rollup merge of #110964 - notriddle:notriddle/deref-impl, r=GuillaumeGomez
rustdoc: fix weird margins between Deref impl items

## Before

![image](https://user-images.githubusercontent.com/1593513/235245977-90770591-22c1-4a27-9464-248a3729a2b7.png)

## After

![image](https://user-images.githubusercontent.com/1593513/235246009-0e83113e-42b7-4e29-981d-969f9d20af01.png)

## Description

In the old setup, if the dereffed-to item has multiple impl blocks, each one gets its own `div.impl-items` in the section, but there are no headers separating them. Since the last method in a `div.impl-items` has no bottom margin, and there are no margins between these divs, there is no margin between the last method of one impl and the first method of the following impl.

This patch fixes it by simplifying the HTML. Each Deref block gets exactly one `div.impl-items`, no matter how many impl blocks it actually has.
2023-04-29 15:51:17 +02:00
Matthias Krüger
957a6ad4d9
Rollup merge of #110644 - pietroalbini:pa-json-formatting-tests, r=Mark-Simulacrum
Update tests for libtest `--format json`

This PR makes the test work on beta and stable, and adds a test ensuring the option is not available on beta and stable. Backported these commits from https://github.com/rust-lang/rust/pull/110414.
2023-04-29 15:51:15 +02:00
Matthias Krüger
825bc606f5
Rollup merge of #105848 - lukas-code:backticks, r=GuillaumeGomez,jyn514,notriddle
rustdoc: Add a new lint for broken inline code

This patch adds `rustdoc::unescaped_backticks`, a new rustdoc lint that will detect broken inline code nodes.

The lint woks by finding stray backticks and with some heuristics tries to guess where the second backtick might be missing.

Here is how it looks:
```rust
#![warn(rustdoc::unescaped_backticks)]

/// `add(a, b) is the same as `add(b, a)`.
pub fn add(a: i32, b: i32) -> i32 { a + b }
```
```text
warning: unescaped backtick
 --> src/lib.rs:3:41
  |
3 | /// `add(a, b) is the same as `add(b, a)`.
  |                                         ^
  |
help: a previous inline code might be longer than expected
  |
3 | /// `add(a, b)` is the same as `add(b, a)`.
  |               +
help: if you meant to use a literal backtick, escape it
  |
3 | /// `add(a, b) is the same as `add(b, a)\`.
  |                                         +
```

If we can't get proper spans, for example if the doc comment comes from a macro expansion, we print the suggestion in help messages instead. Here's a [real-world example](https://docs.rs/tracing-subscriber/0.3.17/tracing_subscriber/layer/trait.Filter.html#method.max_level_hint):

```text
warning: unescaped backtick
    --> /tracing-subscriber-0.3.17/src/layer/mod.rs:1400:9
     |
1400 | /         /// Returns an optional hint of the highest [verbosity level][level] that
1401 | |         /// this `Filter` will enable.
1402 | |         ///
1403 | |         /// If this method returns a [`LevelFilter`], it will be used as a hint to
...    |
1427 | |         /// [`Interest`]: tracing_core::subscriber::Interest
1428 | |         /// [rebuild]: tracing_core::callsite::rebuild_interest_cache
     | |_____________________________________________________________________^
     |
     = help: a previous inline code might be longer than expected
              change: Therefore, if the `Filter will change the value returned by this
             to this: Therefore, if the `Filter` will change the value returned by this
     = help: if you meant to use a literal backtick, escape it
              change: [`rebuild_interest_cache`][rebuild] is called after the value of the max
             to this: [`rebuild_interest_cache\`][rebuild] is called after the value of the max
```

You can find more examples [here](https://gist.github.com/lukas-code/7678ddf5c608aee97b3a669de80d3465).

A limitation of the current implementation is, that it cannot suggest removing misplaced backticks, for example [here](https://docs.rs/tikv-jemalloc-sys/0.5.3+5.3.0-patched/tikv_jemalloc_sys/fn.mallctl.html).

The lint is allowed by default ~~and nightly-only~~ for now, ~~but without a feature gate. This is similar to how `rustdoc::invalid_html_tags` and `rustdoc::bare_urls` were handled.~~
2023-04-29 15:51:15 +02:00
Gary Guo
de492a3894 Update tests 2023-04-29 13:01:46 +01:00
Lukas Markeffsky
4f15a772b3 Add rustdoc::unescaped_backtick lint 2023-04-29 13:13:25 +02:00
Camille GILLOT
63028ac3a1 Do not force anonymous lifetimes in consts to be static. 2023-04-29 10:32:31 +00:00
bors
f2299490c1 Auto merge of #108106 - the8472:layout-opt, r=wesleywiser
Improve niche placement by trying two strategies and picking the better result

Fixes #104807
Fixes #105371

Determining which sort order is better requires calculating the struct size (so we can calculate the niche offset). But that in turn depends on the field order, so happens after sorting. So the simple way to solve that is to run the whole thing twice and pick the better result.

1st commit is just code motion, the meat is in the later ones.
2023-04-29 08:55:04 +00:00
Dylan DPC
81910a1b21
Rollup merge of #110965 - compiler-errors:anon-lt-dupe-oops, r=cjgillot
Don't duplicate anonymous lifetimes for async fn in traits

`record_lifetime_params_for_async` needs to be called outside of the scope of the function, or else it'll end up collecting anonymous lifetimes twice (those on the function and those within the `AnonymousCreateParameter` rib). This matches how `record_lifetime_params_for_async` is being used for functions with bodies below.

This fixes (partially) #110963 when the lifetimes are late-bound, but does not do so when the lifetimes are early-bound (as seen from the known-bug that I added).
2023-04-29 11:27:56 +05:30
Dylan DPC
7721c7319d
Rollup merge of #110962 - cjgillot:no-hash-drops, r=compiler-errors
Make drop_flags an IndexVec.

Fixes https://github.com/rust-lang/rust/issues/91943
2023-04-29 11:27:56 +05:30
Dylan DPC
6da62a40f2
Rollup merge of #110614 - compiler-errors:new-solver-overflow-response, r=lcnr
Clear response values for overflow in new solver

When we have an overflow, return a trivial query response. This fixes an ICE with the code described in #110544:

```rust
trait Trait {}

struct W<T>(T);

impl<T, U> Trait for W<(W<T>, W<U>)>
where
    W<T>: Trait,
    W<U>: Trait,
{}

fn impls<T: Trait>() {}

fn main() {
    impls::<W<_>>()
}
```

Where, while proving `W<?0>: Trait`, we overflow but still apply the query response of `?0 = (W<?1>, W<?2>)`. Then while re-processing the query to validate that our evaluation result was stable, we get a different query response that looks like `?1 = (W<?3>, W<?4>), ?2 = (W<?5>, W<?6>)`, and so we trigger the ICE.

Also, by returning a trivial query response we also avoid the infinite-loop/OOM behavior of the old solver.

r? ``@lcnr``
2023-04-29 11:27:54 +05:30
bors
572c0d553f Auto merge of #110643 - pietroalbini:pa-bump-stage0, r=Mark-Simulacrum
[master] Bump stage0

r? `@Mark-Simulacrum`
2023-04-29 02:29:14 +00:00
bindsdev
107d480892 improve error notes for packed struct reference diagnostic 2023-04-28 20:28:56 -05:00
bors
7a96158b53 Auto merge of #110967 - matthiaskrgr:rollup-vfbl7gm, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #110877 (Provide better type hints when a type doesn't support a binary operator)
 - #110917 (only error combining +whole-archive and +bundle for rlibs)
 - #110921 (Use `NonNull::new_unchecked` and `NonNull::len` in `rustc_arena`.)
 - #110927 (Encoder/decoder cleanups)
 - #110944 (share BinOp::Offset between CTFE and Miri)
 - #110948 (run-make test: using single quotes to not trigger the shell)
 - #110957 (Fix an ICE in conflict error diagnostics)
 - #110960 (fix false negative for `unused_mut`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-28 23:13:42 +00:00
Augie Fackler
58537cde06 junit: fix typo in comment and don't include output for passes when not requested 2023-04-28 18:37:26 -04:00
The 8472
61fb5a91b7 layout-alignment-promotion logic should depend on the niche-bias
For start-biased layout we want to avoid overpromoting so that
the niche doesn't get pushed back.
For end-biased layout we want to avoid promoting fields that
may contain one of the niches of interest.
2023-04-28 23:08:54 +02:00
The 8472
67a835d755 fix codegen test 2023-04-28 23:08:54 +02:00
Matthias Krüger
34ef13b15b
Rollup merge of #110960 - lukas-code:unused-mut, r=compiler-errors
fix false negative for `unused_mut`

fixes https://github.com/rust-lang/rust/issues/110849

We want to avoid double diagnostics for code like this, but only if an error actually occurs:
```rust
fn main() {
    let mut x: (i32, i32);
    x.0 = 1;
}
```

The first commit fixes the lint and the second one removes all the unused `mut`s it found.
2023-04-28 22:56:47 +02:00
Matthias Krüger
235d088412
Rollup merge of #110957 - WaffleLapkin:reach_generator_conflict_error, r=cjgillot
Fix an ICE in conflict error diagnostics

Fixes  #110929
r? ``@cjgillot``
2023-04-28 22:56:47 +02:00
Matthias Krüger
afbb1881ab
Rollup merge of #110948 - TimNN:patch-1, r=WaffleLapkin
run-make test: using single quotes to not trigger the shell

This test got added in #110801.

I'm no expert on Makefiles, but IIUC this command is passed to the shell, which usually tries to execute commands specified in between backticks in double-quoted strings.

Using single quotes should fix this, I think. (Note: Waiting for CI to test this, since I only have a web browser available right now).

r? ``@jyn514``

cc ``@WaffleLapkin``

Since this is breaking our build bot, even if it is not directly LLVM related: ``@rustbot`` label: +llvm-main
2023-04-28 22:56:46 +02:00
Matthias Krüger
aba9fb4696
Rollup merge of #110877 - compiler-errors:binop-err, r=cjgillot
Provide better type hints when a type doesn't support a binary operator

For example, when checking whether `vec![A] == vec![A]` holds, we first evaluate the LHS's ty, then probe for any `PartialEq` implementations for that. If none is found, we report an error by evaluating `Vec<A>: PartialEq<?0>` for fulfillment errors, but the RHS is not yet evaluated and remains an inference variable `?0`!

To fix this, we evaluate the RHS and equate it to that RHS infer var `?0`, so that we are able to provide more detailed fulfillment errors for why `Vec<A>: PartialEq<Vec<A>>` doesn't hold (namely, the nested obligation `A: PartialEq<A>` doesn't hold).

Fixes #95285
Fixes #110867
2023-04-28 22:56:44 +02:00
bors
f495605381 Auto merge of #110901 - GuillaumeGomez:inlined-repr-rustdoc, r=notriddle
rustdoc: Fix missing `repr` attribute in doc(inline) on foreign items

Fixes https://github.com/rust-lang/rust/issues/110698.

r? `@notriddle`
2023-04-28 20:33:33 +00:00
Michael Goulet
4e05cfb5ff Don't duplicate anonymous lifetimes for async fn in traits 2023-04-28 20:21:03 +00:00
Michael Howell
2299ba1ca2 rustdoc: fix weird margins between Deref impl items
In the old setup, if the dereffed-to item has multiple impl blocks,
each one gets its own `div.impl-items` in the section, but there
are no headers separating them. Since the last method in a
`div.impl-items` has no bottom margin, and there are no margins
between these divs, there is no margin between the last method
of one impl and the first method of the following impl.

This patch fixes it by simplifying the HTML. Each Deref block gets
exactly one `div.impl-items`, no matter how many impl blocks it
actually has.
2023-04-28 13:16:10 -07:00
Camille GILLOT
7f26191aed Make drop_flags an IndexVec. 2023-04-28 20:12:45 +00:00
Michael Howell
10c77b1cd0 rustdoc: move deref tests into a directory 2023-04-28 12:54:26 -07:00
Lukas Markeffsky
fc63926e18 remove unused muts 2023-04-28 20:19:48 +02:00
Maybe Waffle
754a62c306 Fix an ICE in conflict errors diagnostics 2023-04-28 17:37:56 +00:00
Lukas Markeffsky
69c71dacda fix false negative for unused_mut 2023-04-28 19:35:40 +02:00
Deadbeef
5c99175a9e uplift clippy::clone_double_ref as suspicious_double_ref_op 2023-04-28 17:24:48 +00:00
Maybe Waffle
b29b56f520 Add regression test for issue 110929 2023-04-28 16:50:28 +00:00
Josh Stone
dc94522072 bless line changes in tests-listing-format-json.run.stdout 2023-04-28 09:22:29 -07:00
Pietro Albini
a7bb8c7851 handle cfg(bootstrap) 2023-04-28 08:47:55 -07:00
Tim Neumann
f1b88eab50
run-make test: using single quotes to not trigger the shell 2023-04-28 16:11:45 +02:00
Ralf Jung
6fcf165586 move some const-prop tests to appropriate folder 2023-04-28 14:42:03 +02:00
Ralf Jung
25e9b79060 interpret: fail more gracefully on uninit unsized locals 2023-04-28 14:42:03 +02:00
Maybe Waffle
182eee298c fixup tests wrt new normalization 2023-04-28 11:56:02 +00:00
Zalathar
a6fa0e0fdb Don't accidentally ignore all output in tests/run-make/coverage-reports diffs
Because the literal pipe `|` character was not escaped, these regexes ended up
accidentally ignoring every line in the coverage report output, so the tests
would not fail even if the output was wrong.
2023-04-28 20:45:34 +10:00
bors
43a78029b4 Auto merge of #110837 - scottmcm:offset-for-add, r=compiler-errors
Use MIR's `Offset` for pointer `add` too

~~Status: draft while waiting for #110822 to land, since this is built atop that.~~
~~r? `@ghost~~`

Canonical Rust code has mostly moved to `add`/`sub` on pointers, which take `usize`, instead of `offset` which takes `isize`.  (And, relatedly, when `sub_ptr` was added it turned out it replaced every single in-tree use of `offset_from`, because `usize` is just so much more useful than `isize` in Rust.)

Unfortunately, `intrinsics::offset` could only accept `*const` and `isize`, so there's a *huge* amount of type conversions back and forth being done.  They're identity conversions in the backend, but still end up producing quite a lot of unhelpful MIR.

This PR changes `intrinsics::offset` to accept `*const` *and* `*mut` along with `isize` *and* `usize`.  Conveniently, the backends and CTFE already handle this, since MIR's `BinOp::Offset` [already supports all four combinations](adaac6b166/compiler/rustc_const_eval/src/transform/validate.rs (L523-L528)).

To demonstrate the difference, I added some `mir-opt/pre-codegen/` tests around slice indexing.  Here's the difference to `[T]::get_mut`, since it uses `<*mut _>::add` internally:
```diff
`@@` -79,30 +70,21 `@@` fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
         StorageLive(_12);                // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
         StorageLive(_9);                 // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
         _9 = _8 as *mut u32 (PtrToPtr);  // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageLive(_13);                // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        _13 = _2 as isize (IntToInt);    // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageLive(_14);                // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageLive(_15);                // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        _15 = _9 as *const u32 (Pointer(MutToConstPointer)); // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        _14 = Offset(move _15, _13);     // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageDead(_15);                // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        _7 = move _14 as *mut u32 (PtrToPtr); // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageDead(_14);                // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageDead(_13);                // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+        _7 = Offset(_9, _2);             // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
         StorageDead(_9);                 // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
         StorageDead(_12);                // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
         StorageDead(_11);                // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
```
1c1c8e442a (diff-a841b6a4538657add3f39bc895744331453d0625e7aace128b1f604f0b63c8fdR80)
2023-04-28 09:26:59 +00:00
bors
2fce229086 Auto merge of #110924 - matthiaskrgr:rollup-jvznpq2, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #110766 (More core::fmt::rt cleanup.)
 - #110873 (Migrate trivially translatable `rustc_parse` diagnostics)
 - #110904 (rustdoc: rebind bound vars to type-outlives predicates)
 - #110913 (Add some missing built-in lints)
 - #110918 (`remove_dir_all`: try deleting the directory even if `FILE_LIST_DIRECTORY` access is denied)
 - #110920 (Fix unavailable url)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-28 06:32:01 +00:00
Scott McMurray
e1da77c76d Also use mir::Offset for pointer add 2023-04-27 22:44:42 -07:00
Matthias Krüger
901bab70d3
Rollup merge of #110913 - compiler-errors:missing-lints, r=Nilstrieb
Add some missing built-in lints

(and also sort them, so this is best reviewed one commit at a time)

Fixes #110911

I wonder if there's a good way to detect when a lint is built-in (i.e. not associated to a lint pass). If so, it needs to be added to this list, or else we're unable to `allow` or `deny` it. Leaving that for future work, I guess...
2023-04-28 07:34:03 +02:00
Matthias Krüger
8ce92daa85
Rollup merge of #110904 - fmease:rustdoc-fix-110900, r=compiler-errors
rustdoc: rebind bound vars to type-outlives predicates

Fixes #110900.
2023-04-28 07:34:03 +02:00
Matthias Krüger
29f5ec3640
Rollup merge of #110873 - clubby789:migrate-rustc-parse-trivial, r=compiler-errors
Migrate trivially translatable `rustc_parse` diagnostics

cc #100717

Migrate diagnostics in `rustc_parse` which are emitted in a single statement. I worked on this by expanding the lint introduced in #108760, although that isn't included here as there is much more work to be done to satisfy it
2023-04-28 07:34:02 +02:00
Matthias Krüger
cf911ac757
Rollup merge of #110766 - m-ou-se:fmt-rt, r=jyn514
More core::fmt::rt cleanup.

- Removes the `V1` suffix from the `Argument` and `Flag` types.

- Moves more of the format_args lang items into the `core::fmt::rt` module. (The only remaining lang item in `core::fmt` is `Arguments` itself, which is a public type.)

Part of https://github.com/rust-lang/rust/issues/99012

Follow-up to https://github.com/rust-lang/rust/pull/110616
2023-04-28 07:34:02 +02:00
bors
033aa092ab Auto merge of #110919 - JohnTitor:rollup-9phs2vx, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #109702 (configure --set support list as arguments)
 - #110620 (Document `const {}` syntax for `std::thread_local`.)
 - #110721 (format panic message only once)
 - #110881 (refactor(docs): remove macro resolution fallback)
 - #110893 (remove inline const deadcode in typeck)
 - #110898 (Remove unused std::sys_common::thread_local_key::Key)
 - #110909 (Skip `rustc` version detection on macOS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-28 03:27:33 +00:00
Yuki Okushi
0246af8664
Rollup merge of #110881 - bvanjoi:fix-110879, r=jyn514
refactor(docs): remove macro resolution fallback

close https://github.com/rust-lang/rust/issues/110879

r?`@jyn514`
2023-04-28 10:52:00 +09:00
Yuki Okushi
eea5f8a9c4
Rollup merge of #110721 - lukas-code:panic-fmt, r=Amanieu
format panic message only once

Formatting the panic message multiple times can cause problems for some real-world crates, so here's a test to ensure that we don't do that.

This was regressed in https://github.com/rust-lang/rust/pull/109507 and reverted in https://github.com/rust-lang/rust/pull/110782.

fixes https://github.com/rust-lang/rust/issues/110717
fixes https://github.com/rust-itertools/itertools/issues/694
2023-04-28 10:51:59 +09:00
bors
9a3258fa52 Auto merge of #110801 - WaffleLapkin:io-tests, r=jyn514
Fix `ui/io-checks/inaccessbile-temp-dir.rs` test

Fixes #110794

r? `@jyn514`
2023-04-28 00:17:47 +00:00
The 8472
1a51ec6864 bless tests 2023-04-27 22:29:04 +02:00
The 8472
4907dac54c don't promote large fields to higher alignments if that would affect niche placement 2023-04-27 22:29:03 +02:00
The 8472
faf2da3e2f try two different niche-placement strategies when layouting univariant structs 2023-04-27 22:29:03 +02:00
Matthias Krüger
1091a7a884
Rollup merge of #110878 - whtahy:105107/known-bug-tests-for-unsound-issues, r=jackh726
Add `known-bug` tests for 4 unsound issues

This PR adds `known-bug` tests for 4 unsound issues as part of #105107
- #40582
- #49682
- #74629
- #105782
2023-04-27 21:34:16 +02:00
Michael Goulet
183c7904e9 Add invalid_macro_export_arguments to built-in macro list 2023-04-27 18:33:39 +00:00
Michael Goulet
6d6c904431 Make async removal span more resilient to macro expansions 2023-04-27 18:25:07 +00:00
Maybe Waffle
1f44a24e72 --bless ConstParamTy ui tests 2023-04-27 17:26:59 +00:00
Michael Goulet
6c9249f689 Don't call await a method 2023-04-27 17:18:12 +00:00
Michael Goulet
e6077fc1b8 tweak removal span 2023-04-27 17:18:12 +00:00
Michael Goulet
f0fc4f9acf Tweak await span 2023-04-27 17:18:11 +00:00
Michael Goulet
12a2f24b15 Remove a bunch of orphaned test files 2023-04-27 17:17:38 +00:00
Michael Goulet
bd146c72ac Explicitly reject negative and reservation drop impls 2023-04-27 17:02:17 +00:00
León Orell Valerian Liehr
34d96886d4
rustdoc: rebind bound vars to type-outlives predicates 2023-04-27 18:12:53 +02:00
Maybe Waffle
26417a85e7 Add ConstParamTy tests 2023-04-27 15:59:07 +00:00
Maybe Waffle
51355ad92b Add a test for [NotParam; 0]: ConstParamTy (not holding) 2023-04-27 15:59:07 +00:00
Maybe Waffle
7234d63ea4 Add !StructuralEq test for ConstParamTy 2023-04-27 15:46:23 +00:00
Maybe Waffle
c45c4f2cb1 Rename/move a test 2023-04-27 15:46:23 +00:00
Maybe Waffle
81a2b856c8 Remove feature(const_param_ty_trait), use adt_const_params instead 2023-04-27 15:46:23 +00:00
Maybe Waffle
c8844e1337 derive(Eq) in a test 2023-04-27 15:46:23 +00:00
Maybe Waffle
9a716dafbe Add a ConstParamTy trait 2023-04-27 15:46:21 +00:00
Guillaume Gomez
3f082843aa Add regression test for #110698 2023-04-27 16:41:22 +02:00
Matthias Krüger
1ca3f33ef7
Rollup merge of #110866 - compiler-errors:test, r=jyn514
Make `method-not-found-generic-arg-elision.rs` error message not path dependent

Every time I bless `tests/ui/methods/method-not-found-generic-arg-elision.rs`, I get some nonsense "type is too long" + "written to disk" that shows up and have to manually revert because the combination of my rustc repo path + the UI test directory hits the length limit for printing types spilling to disk (since this happens before UI test path sanitization).

The fact that we use a closure in this test doesn't have to do with the UI test, so just box the closure to make the type name smaller and not path dependent.
2023-04-27 15:10:55 +02:00
Matthias Krüger
563eb04c5d
Rollup merge of #110864 - compiler-errors:into-future-stable, r=jackh726
`IntoFuture::into_future` is no longer unstable

We don't need to gate the `IntoFuture::into_future` call in `.await` lowering anymore.

``@bors`` rollup
2023-04-27 15:10:55 +02:00
Matthias Krüger
63fbb05839
Rollup merge of #110816 - clubby789:rustc-passes-diagnostics, r=compiler-errors
Migrate `rustc_passes` to translatable diagnostics

cc #100717
2023-04-27 15:10:54 +02:00
Matthias Krüger
5215782421
Rollup merge of #110804 - cuishuang:master, r=jyn514
Remove repeated definite articles
2023-04-27 15:10:53 +02:00
Maybe Waffle
1d847b8659 ignore failing test on arm 2023-04-27 13:09:41 +00:00
Maybe Waffle
e80b24cc14 fix typo in the inaccessible-temp-dir test name
(formally `...inaccessbile...`)
2023-04-27 13:07:14 +00:00
Chris Denton
73b65746e8
Fix Unreadable non-UTF-8 output on localized MSVC
Fixes #35785 by converting non UTF-8 linker output to Unicode using the OEM code page.

Before:

```text
  = note: Non-UTF-8 output: LINK : fatal error LNK1181: cannot open input file \'m\x84rchenhaft.obj\'\r\n
```

After:

```text
   = note: LINK : fatal error LNK1181: cannot open input file 'märchenhaft.obj'

```

The difference is more dramatic if using a non-ascii language pack for Visual Studio.
2023-04-27 09:58:18 +01:00
bohan
9156b03287 test(doc): no fallback marco resolution 2023-04-27 16:25:05 +08:00
whtahy
fcf8468efc add known-bug test for unsound issue 105782 2023-04-26 22:34:39 -04:00
whtahy
21b9f5c3bb add known-bug test for unsound issue 74629 2023-04-26 22:34:39 -04:00
whtahy
a87359d7c9 add known-bug test for unsound issue 49682 2023-04-26 22:34:30 -04:00
whtahy
bfdd1c4e35 add known-bug test for unsound issue 40582 2023-04-26 22:34:29 -04:00
Michael Goulet
3125979b78 Fix a bad binop error when we need a call 2023-04-27 01:34:03 +00:00
Michael Goulet
015acc2611 Provide RHS type hint when reporting operator error 2023-04-27 01:34:03 +00:00
Michael Goulet
20742ea21a Adjust obligation cause code for find_and_report_unsatisfied_index_impl 2023-04-27 00:58:26 +00:00
clubby789
1ce9d7254e Migrate trivially translatable rustc_parse diagnostics 2023-04-27 01:53:06 +01:00
Tomasz Miąsko
d1bd1be668 Use EMIT_MIR_FOR_EACH_BIT_WIDTH in transmute mir-opt test 2023-04-27 00:00:00 +00:00
Michael Goulet
c18e7b765f IntoFuture::into_future is no longer unstable 2023-04-26 22:44:18 +00:00
Tomasz Miąsko
4adb8fbda0 Remove workaround for CastKind::Transmute from const prop
Since constants are no longer validated before propagation the
workaround is obsolete. Remove it.
2023-04-27 00:33:52 +02:00
bors
cb9aa8c9c1 Auto merge of #110861 - m-ou-se:thread-local-restructure, r=workingjubilee
Restructure and rename std thread_local internals to make it less of a maze

Every time I try to work on std's thread local internals, it feels like I'm trying to navigate a confusing maze made of macros, deeply nested modules, and types with multiple names/aliases. Time to clean it up a bit.

This PR:

- Exports `Key` with its own name (`Key`), instead of `__LocalKeyInner`
- Uses `pub macro` to put `__thread_local_inner` into a (unstable, hidden) module, removing `#[macro_export]`, removing it from the crate root.
- Removes the `__` from `__thread_local_inner`.
- Removes a few unnecessary `allow_internal_unstable` features from the macros
- Removes the `libstd_thread_internals` feature. (Merged with `thread_local_internals`.)
    - And removes it from the unstable book
- Gets rid of the deeply nested modules for the `Key` definitions (`mod fast` / `mod os` / `mod statik`).
- Turns a `#[cfg]` mess into a single `cfg_if`, now that there's no `#[macro_export]` anymore that breaks with `cfg_if`.
- Simplifies the `cfg_if` conditions to not repeat the conditions.
- Removes useless `normalize-stderr-test`, which were left over from when the `Key` types had different names on different platforms.
- Removes a seemingly unnecessary `realstd` re-export on `cfg(test)`.

This PR changes nothing about the thread local implementation. That's for a later PR. (Which should hopefully be easier once all this stuff is a bit cleaned up.)
2023-04-26 22:07:17 +00:00
Michael Goulet
5fa82092ae Clear response values for overflow in new solver 2023-04-26 21:54:30 +00:00
Michael Goulet
0fabceb2df Make method-not-found-generic-arg-elision.rs error message not path dependent 2023-04-26 21:48:21 +00:00
Scott McMurray
8bcfc0e597 Add some MIR pre-codegen tests for slice indexing 2023-04-26 14:43:36 -07:00
Mara Bos
12fee7b004 Update tests. 2023-04-26 21:02:56 +02:00
bors
1c42cb4ef0 Auto merge of #110852 - matthiaskrgr:rollup-jz3eosr, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #108760 (Add lint to deny diagnostics composed of static strings)
 - #109444 (Change tidy error message for TODOs)
 - #110419 (Spelling library)
 - #110550 (Suggest deref on comparison binop RHS even if type is not Copy)
 - #110641 (Add new rustdoc book chapter to describe in-doc settings)
 - #110798 (pass `unused_extern_crates` in `librustdoc::doctest::make_test`)
 - #110819 (simplify TrustedLen impls)
 - #110825 (diagnostics: add test case for already-solved issue)
 - #110835 (Make some region folders a little stricter.)
 - #110847 (rustdoc-json: Time serialization.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-26 18:32:57 +00:00
Matthias Krüger
bcd55cebfa
Rollup merge of #110825 - notriddle:notriddle/issue-70082, r=compiler-errors
diagnostics: add test case for already-solved issue

Fixes #70082
2023-04-26 18:51:44 +02:00
Matthias Krüger
1d73549982
Rollup merge of #110798 - ozkanonur:rustdoc-unused-extern-crates, r=jyn514
pass `unused_extern_crates` in `librustdoc::doctest::make_test`

blocker for https://github.com/rust-lang/rust/pull/106621
2023-04-26 18:51:42 +02:00
Matthias Krüger
8e6fffcbaa
Rollup merge of #110550 - compiler-errors:deref-on-binop-rhs, r=wesleywiser
Suggest deref on comparison binop RHS even if type is not Copy

Fixes #110500
2023-04-26 18:51:41 +02:00
cui fliter
ef6d4c504d Remove repeated definite articles
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-04-27 00:48:00 +08:00
bors
9c044d77a3 Auto merge of #110822 - scottmcm:lower-offset-to-mir, r=compiler-errors
Lower `intrinsics::offset` to `mir::BinOp::Offset`

They're [semantically the same](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.Rvalue.html#variant.BinaryOp), so this means the backends don't need to handle the intrinsic and means fewer MIR basic blocks in pointer arithmetic code.
2023-04-26 15:52:33 +00:00
clubby789
6a41cfe095 Migrate rustc_passes to translatable diagnostics 2023-04-26 11:40:21 +01:00
jyn
8c0dfa31f4
Rollup merge of #110817 - fmease:fix-109759, r=compiler-errors
Add regression tests for const-generic inherent associated types

Fixes #109759.
The tests are no longer failing since #96840 which was merged recently (#109410 is no longer necessary for them).

`@rustbot` label F-inherent_associated_types
2023-04-26 01:55:53 -05:00
jyn
a1d47188a7
Rollup merge of #110329 - aDotInTheVoid:json-inline-again, r=jyn514
Improve tests for #110138

These should live in rustdoc-json, not rustdoc-ui, so we can run assertions, and not just check there's no ICE

CC #100515, as we never document this suite

r? rustdoc
2023-04-26 01:55:51 -05:00
jyn
fff8503613
Rollup merge of #109379 - flba-eb:108596_fixtest_sigpipe, r=jyn514
Replace `yes` command by `while-echo` in test `tests/ui/process/process-sigpipe.rs`

The `yes` command is not available on all platforms.

Fixes #108596.

Inviting `@mvf` as he contributed to this patch. Thanks! This issue has been discussed in https://github.com/rust-lang/rust/pull/106673 but was moved to #108596 to get going.

CC `@gh-tr`

r? `@workingjubilee`
`@rustbot` label +O-neutrino

Notes about the comments https://github.com/rust-lang/rust/pull/106673#discussion_r1117324265:
- The `echo` command is `/proc/boot/echo` (not built-in)
- `/bin/sh` is a symlink to `/proc/boot/ksh`
```sh
# ls -l /bin/sh /proc/boot/ksh /proc/boot/echo
lrwxrwxrwx   1 root      root             14 Mar 20 07:52 /bin/sh -> /proc/boot/ksh
-r-xr-xr-x   1 root      root           9390 Sep 12  2022 /proc/boot/echo
-r-xr-xr-x   1 root      root         308114 Sep 12  2022 /proc/boot/ksh
```
2023-04-26 01:55:50 -05:00
Scott McMurray
05a665f21a Lower intrinsics::offset to mir::BinOp::Offset
They're semantically the same, so this means the backends don't need to handle the intrinsic and means fewer MIR basic blocks in pointer arithmetic code.
2023-04-25 19:23:45 -07:00
bors
f33379b0a6 Auto merge of #110811 - compiler-errors:vars-are-question-mark, r=WaffleLapkin
Use `?0` notation for ty/ct/int/float/region vars

Aligns the notation for infer vars that T-types and friends most often uses for inference variables with the notation in the compiler (which is kinda a sigil nightmare IMO: `_#`) by adopting `?0` style infer vars.

This mostly affects debug output since verbose infer vars shouldn't show up in user-facing places.

Does this need an MCP? It's debug output, so I'm thinking no, but happy to open one. 🤔

r? types
2023-04-25 22:11:09 +00:00
León Orell Valerian Liehr
2f354482b8
Add regression tests for const-generic IATs 2023-04-25 23:32:13 +02:00
Michael Goulet
183f1a6a70 Fix lifetime suggestion for type aliases with objects in them 2023-04-25 20:41:59 +00:00
Michael Howell
1bfbac7903 diagnostics: add test case for already-solved issue
Fixes #70082
2023-04-25 13:07:09 -07:00
Michael Goulet
bb99cdc7cd vars are ? 2023-04-25 19:53:09 +00:00
Matthias Krüger
95e9f68eb5
Rollup merge of #110671 - compiler-errors:polarity, r=lcnr
Consider polarity in new solver

It's kinda ugly to have a polarity check in all of the builtin impls -- I guess I could consider the polarity at the top of assemble-builtin but that would require adding a polarity fn to `GoalKind`...

🤷 putting this up just so i dont forget, since it's needed to bootstrap core during coherence (this alone does not allow core to bootstrap though, additional work is needed!)

r? ``@lcnr``
2023-04-25 21:06:34 +02:00
Lukas Markeffsky
cd398a6de9 test that we format the panic message only once 2023-04-25 18:11:28 +02:00
Maybe Waffle
e6ed0ca3dd Improve non-ice-error-on-worker-io-fail.rs test
- Remove unrelated code
- Use a local dir path
2023-04-25 15:25:19 +00:00
Maybe Waffle
39fa192d8b Fix ui/io-checks/inaccessbile-temp-dir.rs test 2023-04-25 15:22:09 +00:00
ozkanonur
f56b6d0b12 pass unused_extern_crates in librustdoc::doctest::make_test
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-04-25 17:20:58 +03:00
bors
a7aa20517c Auto merge of #110325 - obeis:hir-analysis-migrate-diagnostics-4, r=davidtwco
Migrate `rustc_hir_analysis` to session diagnostic [Part 4]

Part 4: Finishing `check/mod.rs` file

r? `@compiler-errors`
2023-04-25 13:45:20 +00:00
bors
20d90b14ff Auto merge of #103093 - rytheo:linked-list-alloc-api, r=Mark-Simulacrum
Add support for allocators in `LinkedList`

Allows `LinkedList` to use a custom allocator
2023-04-25 11:34:58 +00:00
bors
999e6e5afb Auto merge of #101069 - zhaixiaojuan:loongarch64-inline-asm, r=Amanieu
Add loongarch64 asm! support
2023-04-25 09:18:58 +00:00
zhaixiaojuan
5f2fa4c11d Add loongarch64 asm! support 2023-04-25 14:15:31 +08:00
Michael Goulet
bb2cb89ead Negative coherence test 2023-04-25 05:02:39 +00:00
Ryan Lowe
34136ab598 Add support for allocators in LinkedList 2023-04-24 22:30:16 -04:00
Matthias Krüger
f54dbe6e31 Revert "Remove #[alloc_error_handler] from the compiler and library"
This reverts commit abc0660118.
2023-04-25 00:08:35 +02:00
Matthias Krüger
33253fa6a4 Revert "Rename -Zoom=panic to -Zoom=unwind"
This reverts commit 4b981c2648.
2023-04-25 00:08:33 +02:00
Matthias Krüger
653cfdb436 Revert "Adjust expected result for coverage test"
This reverts commit 4da05e0b88.
2023-04-25 00:08:29 +02:00
Michael Howell
c4e00f7bd5 rustdoc-search: add slices and arrays to index
This indexes them as primitives with generics, so `slice<u32>` is
how you search for `[u32]`, and `array<u32>` for `[u32; 1]`.
A future commit will desugar the square bracket syntax to search
both arrays and slices at once.
2023-04-24 12:14:35 -07:00
bors
521de433f4 Auto merge of #110778 - JohnTitor:rollup-7f51qwk, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #110480 (Add `known-bug` tests for 11 unsound issues)
 - #110539 (Move around `{Idx, IndexVec, IndexSlice}` adjacent code)
 - #110590 (Add some tests around (lack of) object safety of associated types and consts)
 - #110602 (Ignore src/bootstrap formatting commit in .git-blame-ignore-revs)
 - #110667 (pointer-auth-link-with-c: Fix cross compilation.)
 - #110681 (drop few unused crates, gate libc under unix for rustc_codegen_ssa)
 - #110685 (Some cleanups to DataflowConstProp)
 - #110744 (bootstrap: update paths cargo-credential crate)
 - #110750 (Add size asserts for MIR `SourceScopeData` & `VarDebugInfo`)
 - #110760 (rustdoc: Add regression test for #60522)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-24 19:09:19 +00:00
Yuki Okushi
513c0cc5ba
Rollup merge of #110760 - GuillaumeGomez:regression-60522, r=notriddle
rustdoc: Add regression test for #60522

Fixes https://github.com/rust-lang/rust/issues/60522.

r? `@notriddle`
2023-04-25 02:33:31 +09:00
Yuki Okushi
2a2df56db5
Rollup merge of #110667 - pcc:fix-pointer-auth-link-with-c, r=Mark-Simulacrum
pointer-auth-link-with-c: Fix cross compilation.
2023-04-25 02:33:29 +09:00
Yuki Okushi
1a906f2b3c
Rollup merge of #110590 - oli-obk:object_safe_assoc_types, r=jackh726
Add some tests around (lack of) object safety of associated types and consts

See https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/.60where.20Self.3ASized.60.20on.20assoc.20types/near/351260928 for some discussion around why this isn't allowed.

We didn't have any tests for these, so I decided to add them now, even if we don't end up doing anything about it.
2023-04-25 02:33:26 +09:00
Yuki Okushi
42467d57cb
Rollup merge of #110480 - whtahy:105107/known-bug-tests-for-unsound-issues, r=jackh726
Add `known-bug` tests for 11 unsound issues

r? ``@jackh726``

Should tests for other issues be in separate PRs?  Thanks.

Edit: Partially addresses #105107.  This PR adds `known-bug` tests for 11 unsound issues:
- #25860
- #49206
- #57893
- #84366
- #84533
- #84591
- #85099
- #98117
- #100041
- #100051
- #104005
2023-04-25 02:33:25 +09:00
bors
253b727f46 Auto merge of #110713 - cjgillot:track-mir-opt, r=scottmcm
Add mir-opt tests to track MIR quality.

cc `@scottmcm` `@saethlin`

If you have other ideas, please say so.
2023-04-24 17:01:02 +00:00
Mara Bos
9cc5949f9f Update tests. 2023-04-24 16:16:14 +02:00
bors
b72460fe46 Auto merge of #110672 - Ezrashaw:allow-array-simd-in-inline-asm, r=workingjubilee
allow array-style simd in inline asm

Required for [MCP#621](https://github.com/rust-lang/compiler-team/issues/621) to be implemented.

r? `@workingjubilee`
2023-04-24 13:51:04 +00:00
Guillaume Gomez
5c70287c51 Add regression test for #60522 2023-04-24 13:12:24 +02:00
Matthias Krüger
3ecae2932c
Rollup merge of #110706 - scottmcm:transmute_unchecked, r=oli-obk
Add `intrinsics::transmute_unchecked`

This takes a whole 3 lines in `compiler/` since it lowers to `CastKind::Transmute` in MIR *exactly* the same as the existing `intrinsics::transmute` does, it just doesn't have the fancy checking in `hir_typeck`.

Added to enable experimenting with the request in <https://github.com/rust-lang/rust/pull/106281#issuecomment-1496648190> and because the portable-simd folks might be interested for dependently-sized array-vector conversions.

It also simplifies a couple places in `core`.

See also https://github.com/rust-lang/rust/pull/108442#issuecomment-1474777273, where `CastKind::Transmute` was added having exactly these semantics before the lang meeting (which I wasn't in) independently expressed interest.
2023-04-24 07:53:25 +02:00
Matthias Krüger
8aab707131
Rollup merge of #110566 - compiler-errors:bad-projection-term, r=cjgillot,BoxyUwU
Don't create projection ty for const projection

Fixes #110549
2023-04-24 07:53:24 +02:00
Matthias Krüger
0f271619e4
Rollup merge of #110255 - clubby789:proc-macro-test-help, r=jackh726
Suggest using integration tests for test crate using own proc-macro

cc #110247
2023-04-24 07:53:23 +02:00
Miguel Ojeda
3938541d29 tests: add test for warning-free builds of core under no_global_oom_handling
`tests/run-make/alloc-no-oom-handling` tests that `alloc` under
`no_global_oom_handling` builds and is warning-free.

Do the same for `core` to prevent issues such as [1].

Link: https://github.com/rust-lang/rust/pull/110649 [1]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-04-24 01:56:37 +02:00
Michael Goulet
cde5bcafe8 Don't create projection ty for const projection 2023-04-23 18:09:30 +00:00
Matthias Krüger
12858d9a61
Rollup merge of #110700 - compiler-errors:fn-ret-fn, r=oli-obk
Don't infer fn return type to return itself

Fixes #110687
2023-04-23 20:06:33 +02:00
Matthias Krüger
4064bdd914
Rollup merge of #110661 - notriddle:notriddle/settings-js-handlekey, r=GuillaumeGomez
rustdoc: clean up settings.css and settings.js

`handleKey` was added in 9dc5dfb975 and 704050da23 because the browser-native checkbox was `display: none`, breaking native keyboard accessibility.

The native checkbox is now merely `appearance: none`, which does not turn off [behavior semantics], so JavaScript to reimplement it isn't needed any more.

[behavior semantics]: https://w3c.github.io/csswg-drafts/css-ui/#appearance-semantics

The other, one line change to settings.css is follow-up to #110205
2023-04-23 20:06:30 +02:00
Camille GILLOT
baa13123ef Make some tests unit. 2023-04-23 17:13:18 +00:00
Camille GILLOT
332b7f51d6 Add mir-opt tests to track MIR quality. 2023-04-23 17:10:53 +00:00
bors
915aa06700 Auto merge of #110705 - saethlin:ignore-locals-cost, r=cjgillot
Remove the size of locals heuristic in MIR inlining

This heuristic doesn't necessarily correlate to complexity of the MIR Body. In particular, a lot of straight-line code in MIR tends to never reuse a local, even though any optimizer would effectively reuse the storage or just put everything in registers. So it doesn't even necessarily make sense that this would be a stack size heuristic.

So... what happens if we just delete the heuristic? The benchmark suite improves significantly. Less heuristics better?

r? `@cjgillot`
2023-04-23 15:41:45 +00:00
bors
3462f79e94 Auto merge of #108118 - oli-obk:lazy_typeck, r=cjgillot
Run various queries from other queries instead of explicitly in phases

These are just legacy leftovers from when rustc didn't have a query system. While there are more cleanups of this sort that can be done here, I want to land them in smaller steps.

This phased order of query invocations was already a lie, as any query that looks at types (e.g. the wf checks run before) can invoke e.g. const eval which invokes borrowck, which invokes typeck, ...
2023-04-23 13:34:31 +00:00
Ezra Shaw
d31e8a499b
allow array-style simd in inline asm 2023-04-23 19:28:50 +12:00
Scott McMurray
1de2257c3f Add intrinsics::transmute_unchecked
This takes a whole 3 lines in `compiler/` since it lowers to `CastKind::Transmute` in MIR *exactly* the same as the existing `intrinsics::transmute` does, it just doesn't have the fancy checking in `hir_typeck`.

Added to enable experimenting with the request in <https://github.com/rust-lang/rust/pull/106281#issuecomment-1496648190> and because the portable-simd folks might be interested for dependently-sized array-vector conversions.

It also simplifies a couple places in `core`.
2023-04-22 17:22:03 -07:00
Ben Kimock
173845ce0e Remove the size of locals heuristic in MIR inlining 2023-04-22 19:17:11 -04:00
Camille GILLOT
b8c67d82d3 Fortify test. 2023-04-23 00:34:46 +02:00
Wesley Wiser
4e8b642646 Turn on ConstDebugInfo pass. 2023-04-22 23:41:48 +02:00
Michael Goulet
c8874e2445 Don't infer fn return type to return itself 2023-04-22 19:30:47 +00:00
whtahy
ebe61cefc4 add known-bug test for unsound issue 104005 2023-04-22 13:57:34 -04:00
whtahy
6f6550f156 add known-bug test for unsound issue 100051 2023-04-22 13:41:53 -04:00
whtahy
cff6c0e0c8 add known-bug test for unsound issue 100041 2023-04-22 13:37:13 -04:00
whtahy
314126257d add known-bug test for unsound issue 98117 2023-04-22 13:31:00 -04:00
bors
4396ceca05 Auto merge of #109753 - compiler-errors:replenish-region-constraints, r=aliemjay
Clone region var origins instead of taking them in borrowck

Fixes an issue with the new solver where reporting a borrow-checker error ICEs because it calls `InferCtxt::evaluate_obligation`.

This also removes a handful of unnecessary `tcx.infer_ctxt().build()` calls that are only there to mitigate this same exact issue, but with the old solver.

Fixes compiler-errors/next-solver-hir-issues#12.

----

This implements `@aliemjay's` solution where we just don't *take* the region constraints, but clone them. This potentially makes it easier to write a bug about taking region constraints twice or never at all, but again, not many folks are touching this code.
2023-04-22 15:15:51 +00:00
bors
39cf520299 Auto merge of #109507 - Amanieu:panic-oom-payload, r=davidtwco
Report allocation errors as panics

OOM is now reported as a panic but with a custom payload type (`AllocErrorPanicPayload`) which holds the layout that was passed to `handle_alloc_error`.

This should be review one commit at a time:
- The first commit adds `AllocErrorPanicPayload` and changes allocation errors to always be reported as panics.
- The second commit removes `#[alloc_error_handler]` and the `alloc_error_hook` API.

ACP: https://github.com/rust-lang/libs-team/issues/192

Closes #51540
Closes #51245
2023-04-22 12:27:45 +00:00
bors
21fab435da Auto merge of #104844 - cjgillot:mention-eval-place, r=jackh726,RalfJung
Evaluate place expression in `PlaceMention`

https://github.com/rust-lang/rust/pull/102256 introduces a `PlaceMention(place)` MIR statement which keep trace of `let _ = place` statements from surface rust, but without semantics.

This PR proposes to change the behaviour of `let _ =` patterns with respect to the borrow-checker to verify that the bound place is live.

Specifically, consider this code:
```rust
let _ = {
    let a = 5;
    &a
};
```

This passes borrowck without error on stable. Meanwhile, replacing `_` by `_: _` or `_p` errors with "error[E0597]: `a` does not live long enough", [see playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c448d25a7c205dc95a0967fe96bccce8).

This PR *does not* change how `_` patterns behave with respect to initializedness: it remains ok to bind a moved-from place to `_`.

The relevant test is `tests/ui/borrowck/let_underscore_temporary.rs`. Crater check found no regression.

For consistency, this PR changes miri to evaluate the place found in `PlaceMention`, and report eventual dangling pointers found within it.

r? `@RalfJung`
2023-04-22 09:54:21 +00:00
whtahy
3c5de9a2e8 add known-bug test for unsound issue 85099 2023-04-22 00:51:49 -04:00
whtahy
be68c69e71 add known-bug test for unsound issue 84591 2023-04-22 00:47:07 -04:00
whtahy
cac62ab2dd add known-bug test for unsound issue 84533 2023-04-22 00:47:07 -04:00
whtahy
fbfb620de8 add known-bug test for unsound issue 84366 2023-04-22 00:47:07 -04:00
whtahy
232d685e61 add known-bug test for unsound issue 57893 2023-04-22 00:47:07 -04:00
whtahy
2fb20985a0 add known-bug test for unsound issue 49206 2023-04-22 00:47:07 -04:00
whtahy
adb5ded7a7 add known-bug test for unsound issue 25860 2023-04-22 00:47:07 -04:00
bors
37b22cf2d5 Auto merge of #110469 - compiler-errors:encode-lt-param-span, r=oli-obk
Encode lifetime param spans too

Fixes #110464
Fixes #110591
2023-04-22 03:28:13 +00:00
Peter Collingbourne
fa3515679b pointer-auth-link-with-c: Fix cross compilation. 2023-04-21 18:38:17 -07:00
Michael Goulet
24c2c075cc Encode lifetime param spans too 2023-04-22 01:13:54 +00:00
bors
80a2ec49a4 Auto merge of #106934 - DrMeepster:offset_of, r=WaffleLapkin
Add offset_of! macro (RFC 3308)

Implements https://github.com/rust-lang/rfcs/pull/3308 (tracking issue #106655) by adding the built in macro `core::mem::offset_of`. Two of the future possibilities are also implemented:

* Nested field accesses (without array indexing)
* DST support (for `Sized` fields)

I wrote this a few months ago, before the RFC merged. Now that it's merged, I decided to rebase and finish it.

cc `@thomcc` (RFC author)
2023-04-22 00:10:44 +00:00
Michael Howell
5cefe75436 rustdoc: remove unneeded handleKey from settings.js
This code was added in 9dc5dfb975
and 704050da23 because the browser-
native checkbox was `display: none`, breaking native keyboard
accessibility.

The native checkbox is now merely `appearance: none`, which does
not turn off [behavior semantics], so JavaScript to
reimplement it isn't needed any more.

[behavior semantics]: https://w3c.github.io/csswg-drafts/css-ui/#appearance-semantics
2023-04-21 16:42:23 -07:00
Oli Scherer
334423263a Run check_match and check_liveness when MIR is built instead of having an explicit phase for them 2023-04-21 22:32:38 +00:00
Oli Scherer
e18d1f8d2e Leave it to the query system to invoke the typeck query instead of invoking it eagerly.
Later queries that are run on all body owners will invoke typeck as they need information from its result to perform their own logic
2023-04-21 22:12:45 +00:00
Camille GILLOT
ddfa2463e2 Evaluate place expression in PlaceMention. 2023-04-21 21:34:59 +00:00
Obei Sideg
06ff310cf9 Migrate rustc_hir_analysis to session diagnostic
Part 4: Finishing `check/mod.rs` file
2023-04-21 23:50:03 +03:00
bors
fec9adcdbc Auto merge of #110648 - Dylan-DPC:rollup-em3ovcq, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #110333 (rustc_metadata: Split `children` into multiple tables)
 - #110501 (rustdoc: fix ICE from rustc_resolve and librustdoc parse divergence)
 - #110608 (Specialize some `io::Read` and `io::Write` methods for `VecDeque<u8>` and `&[u8]`)
 - #110632 (Panic instead of truncating if the incremental on-disk cache is too big)
 - #110633 (More `mem::take` in `library`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-21 19:43:11 +00:00
bors
fa4cc63a6b Auto merge of #110107 - cjgillot:const-prop-lint-junk, r=oli-obk
Ensure mir_drops_elaborated_and_const_checked when requiring codegen.

mir_drops_elaborated_and_const_checked may emit errors while codegen has started, and the compiler would exit leaving object code files around.

Found by `@cuviper` in https://github.com/rust-lang/rust/issues/109731
2023-04-21 17:28:37 +00:00
Augie Fackler
610f827261 junit: also include per-case stdout in xml
By placing the stdout in a CDATA block we avoid almost all escaping, as
there's only two byte sequences you can't sneak into a CDATA and you can
handle that with some only slightly regrettable CDATA-splitting. I've
done this in at least two other implementations of the junit xml format
over the years and it's always worked out. The only quirk new to this
(for me) is smuggling newlines as &#xA; to avoid literal newlines in the
output.
2023-04-21 13:15:04 -04:00
Augie Fackler
d77f636c63 libtest: add tests for junit output format
I'm about to make some changes here, and it was making me uneasy to
modify the output format without test coverage.
2023-04-21 13:15:04 -04:00
Amanieu d'Antras
4da05e0b88 Adjust expected result for coverage test 2023-04-21 09:29:55 -07:00
Camille GILLOT
7e214bfc8a Do not rely on exact error code. 2023-04-21 16:14:44 +00:00
Camille GILLOT
ed7e50e08b Ensure mir_drops_elaborated_and_const_checked when requiring codegen. 2023-04-21 16:14:43 +00:00
bors
4a03f14b09 Auto merge of #110569 - saethlin:mir-pass-cooperation, r=cjgillot
Deduplicate unreachable blocks, for real this time

In https://github.com/rust-lang/rust/pull/106428 (in particular 41eda69516) we noticed that inlining `unreachable_unchecked` can produce duplicate unreachable blocks. So we improved two MIR optimizations: `SimplifyCfg` was given a simplify to deduplicate unreachable blocks, then `InstCombine` was given a combiner to deduplicate switch targets that point at the same block. The problem is that change doesn't actually work.

Our current pass order is
```
SimplifyCfg (does nothing relevant to this situation)
Inline (produces multiple unreachable blocks)
InstCombine (doesn't do anything here, oops)
SimplifyCfg (produces the duplicate SwitchTargets that InstCombine is looking for)
```

So in here, I have factored out the specific function from `InstCombine` and placed it inside the simplify that produces the case it is looking for. This should ensure that it runs in the scenario it was designed for.

Fixes https://github.com/rust-lang/rust/issues/110551
r? `@cjgillot`
2023-04-21 15:08:02 +00:00
Dylan DPC
fbc905e16a
Rollup merge of #110501 - notriddle:notriddle/ice-110495, r=petrochenkov
rustdoc: fix ICE from rustc_resolve and librustdoc parse divergence

Fixes #110495
2023-04-21 20:35:28 +05:30
Pietro Albini
eb00459737
update tests for the test harness's json formatting 2023-04-21 15:34:38 +02:00
DrMeepster
a642563d49 major test improvements 2023-04-21 02:45:48 -07:00
DrMeepster
f92294f76b bless 2023-04-21 02:14:03 -07:00
DrMeepster
2bcb018253 fmt 2023-04-21 02:14:03 -07:00
DrMeepster
b92c2f792c fix incorrect param env in dead code lint 2023-04-21 02:14:03 -07:00
DrMeepster
b95852b93c test improvements 2023-04-21 02:14:03 -07:00