Commit Graph

216925 Commits

Author SHA1 Message Date
Tshepang Mbambo c58202eb9b end entry paragprah with a period (.) 2023-02-06 11:22:44 +02:00
bors e7813fee92 Auto merge of #107667 - cjgillot:no-on-hit, r=lcnr,Zoxc
Remove `OnHit` callback from query caches.

This is not useful now that query results are `Copy`.
2023-02-06 09:09:09 +00:00
Maybe Waffle 23412dd105 Remove `arena_cache` modifier from `upstream_monomorphizations_for` 2023-02-06 09:06:01 +00:00
bors 0c13c17250 Auto merge of #107697 - kiranshila:patch-1, r=the8472
Fix typo in HashMap::with_capacity
2023-02-06 05:03:06 +00:00
许杰友 Jieyou Xu (Joe) 6b05b80690
Suggest return type for async function without return type 2023-02-06 13:02:04 +08:00
Wilfred Hughes 4a7a9b4e74 Clarify wording on f64::round() and f32::round()
"Round half-way cases" is a little confusing (it's a 'garden path
sentence' as it's not immediately clear whether round is an adjective
or verb).

Make this sentence longer and clearer.
2023-02-05 19:44:21 -08:00
bors 7c3f0d6f30 Auto merge of #107141 - notriddle:notriddle/max-lev-distance-2023, r=GuillaumeGomez
rustdoc: compute maximum Levenshtein distance based on the query

Preview: https://notriddle.com/notriddle-rustdoc-demos/search-lev-distance-2023/std/index.html?search=regex

The heuristic is pretty close to the name resolver, maxLevDistance = `Math.floor(queryLen / 3)`.

Fixes #103357
Fixes #82131

Similar to https://github.com/rust-lang/rust/pull/103710, but following the suggestion in https://github.com/rust-lang/rust/pull/103710#issuecomment-1296360267 to use `floor` instead of `ceil`, and unblocked now that https://github.com/rust-lang/rust/pull/105796 made it so that setting the max lev distance to `0` doesn't cause substring matches to be removed.
2023-02-06 02:09:00 +00:00
Eric Huss b46b7de1ca Update strip-ansi-escapes and vte 2023-02-05 16:00:50 -08:00
bors 14ea63a7e0 Auto merge of #107627 - nnethercote:optimize-fold_ty, r=compiler-errors
Optimize `fold_ty`

Micro-optimizing the heck out of the important `fold_ty` methods.

r? `@oli-obk`
2023-02-05 23:13:41 +00:00
Nicholas Nethercote 4aec1345aa Split and inline `TypeFreshener::fold_ty`. 2023-02-06 09:16:15 +11:00
Trevor Gross b51d3b9443 Mark 'atomic_mut_ptr' methods const 2023-02-05 17:03:46 -05:00
Nicholas Nethercote fb8e6819aa Split and inline `ShallowResolver::fold_ty`. 2023-02-06 08:52:04 +11:00
Nicholas Nethercote c2cf3f7b24 Inline `OpportunisticVarResolver::fold_ty`. 2023-02-06 08:52:04 +11:00
Nicholas Nethercote f08a3371b0 Improve early bailout test in `resolve_vars_if_possible`.
`!t.has_non_region_infer()` is the test used in
`OpportunisticVarResolver`, and catches a few cases that
`!t.needs_infer()` misses.
2023-02-06 08:52:04 +11:00
Lukas Markeffsky e2a1a2ab79 yet another ui test 2023-02-05 22:51:37 +01:00
Nicholas Nethercote bac7628eae Put a `ShallowResolver` within `OpportunisticVarResolver`.
So one doesn't have to be constructed every time.
2023-02-06 08:50:48 +11:00
Joshua Nelson 13588cc681 Run `expand-yaml-anchors` in `x test tidy`
Previously, the pre-commit hook which runs `x test tidy` could pass only to have CI fail within the first 30 seconds.
This adds about 30 seconds to `test tidy` (for an initial run, much less after the tool is built the first time)
in exchange for catching errors in `.github/workflows/ci.yml` before they're pushed.
2023-02-05 14:46:52 -06:00
bors 75a0be98f2 Auto merge of #107526 - obeis:for-missing-iterator, r=estebank,compiler-errors
Recover form missing expression in `for` loop

Close #78537
r? `@estebank`
2023-02-05 20:33:05 +00:00
Joshua Nelson 9dfec5d35b Run the tools builder on all PRs
Previously, it would only run on changes to subtrees, submodules, or select directories.
That made it so that changes to the compiler that broke tools would only be detected on a full bors merge.
This makes it so the tools builder runs by default, making it easier to catch breaking changes to clippy (which was the most effected).
2023-02-05 14:29:49 -06:00
bjorn3 5ab690d9e7
Merge pull request #1351 from bjorn3/global_asm_const
Implement const and sym operands for global asm
2023-02-05 20:41:49 +01:00
bjorn3 178e267977 Implement sym operands for global asm 2023-02-05 18:48:40 +00:00
bjorn3 df6b067900 Implement const operands for global asm 2023-02-05 18:17:51 +00:00
bjorn3 e238ea6155
Merge pull request #1350 from bjorn3/inline_asm_sym
Implement const and sym operands for inline asm
2023-02-05 19:17:00 +01:00
Kiran Shila f5c45ad284
Fix typo in HashMap::with_capacity 2023-02-05 10:13:30 -08:00
CastilloDel 9cdc07538d Add UI test for issue #92741 2023-02-05 19:12:41 +01:00
CastilloDel 3dd004470d Clean up and comment EmitterWriter.draw_code_line 2023-02-05 19:01:28 +01:00
bjorn3 a2719a285c Fix linker error when inline asm sym operand is not exported from local CGU 2023-02-05 17:39:00 +00:00
bors a676496750 Auto merge of #107663 - matthiaskrgr:107423-point-at-EOF-code, r=compiler-errors
don't point at nonexisting code beyond EOF when warning about delims

Previously we would show this:
```
warning: unnecessary braces around block return value
 --> /tmp/bad.rs:1:8
  |
1 | fn a(){{{
  |        ^  ^
  |
  = note: `#[warn(unused_braces)]` on by default
help: remove these braces
  |
1 - fn a(){{{
1 + fn a(){{
  |
```

which is now hidden in this case.
We would create a span spanning between the pair of redundant {}s but there is only EOF instead of the `}` so we would previously point at nothing. This would cause the debug assertion ice to trigger. I would have loved to just only point at the second delim and say "you can remove that" but I'm not sure how to do that without refactoring the entire diagnostic which seems tricky. :( But given that this does not seem to regress any other tests we have, I think this edge-casey enough be acceptable.

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

r? `@compiler-errors`
2023-02-05 17:32:26 +00:00
bjorn3 2e93be3a4c Add create_wrapper_function helper 2023-02-05 17:24:02 +00:00
bjorn3 044a3a65a0 Support const and sym operands in inline asm 2023-02-05 17:00:47 +00:00
Arpad Borsos dae00152e7
Sort Generator `print-type-sizes` according to their yield points
Especially when trying to diagnose runaway future sizes, it might be
more intuitive to sort the variants according to the control flow
(aka their yield points) rather than the size of the variants.
2023-02-05 17:34:33 +01:00
Vadim Petrochenkov f4e2b954a1 rustc_metadata: Encode/decode `DefPathHash`es without an `Option` 2023-02-05 18:53:47 +04:00
bjorn3 8b48138039
Merge pull request #1347 from bjorn3/dist_no_debug_assertions
Build CI dist artifacts without debug assertions
2023-02-05 15:47:23 +01:00
Obei Sideg 17b6bd6b70 Add ui test for missing expression in for loop 2023-02-05 17:33:17 +03:00
Obei Sideg 7a75278836 Recover from missing expression in for loop 2023-02-05 17:33:10 +03:00
Lukas Markeffsky 9d110847ab ReErased regions are local 2023-02-05 15:29:07 +01:00
Vadim Petrochenkov c60cc43985 rustc_metadata: Encode/decode some `LazyArray`s without an `Option`
Also add asserts to decoding `LazyArray`s with `Option`
2023-02-05 18:19:52 +04:00
Vadim Petrochenkov eb5f2d3980 rustc_metadata: Support encoding/decoding `LazyArray` without an `Option` 2023-02-05 18:19:52 +04:00
Vadim Petrochenkov 8cc5aa561c rustc_metadata: Refactor lazy table reading/writing
Change wording from "nullable" to "default".
Introduce a trait `IsDefault` for detecting values that are encoded as zeros or not encoded at all.
Add panics to impossible cases.
Some other minor cleanups.
2023-02-05 18:19:52 +04:00
bors 319b88c463 Auto merge of #102842 - rol1510:issue-85566-fix, r=notriddle
rustdoc: change trait bound formatting

Fixes #85566

Before
<img width="268" alt="image" src="https://user-images.githubusercontent.com/29011024/208326689-cc9b4bae-529c-473c-81e2-fc5ddb738f07.png">

Now
<img width="268" alt="image" src="https://user-images.githubusercontent.com/29011024/216216918-d7923787-3e3b-486d-9735-4cecd2988dba.png">
2023-02-05 14:01:49 +00:00
Camille GILLOT 51ef82d19b Bless 32bit tests. 2023-02-05 13:51:37 +00:00
Camille GILLOT 29856180a8 Simplify ReplacementMap. 2023-02-05 13:41:24 +00:00
Camille GILLOT 8e05ab04e5 Run SROA to fixpoint. 2023-02-05 12:08:42 +00:00
Camille GILLOT 42c9514629 Simplify construction of replacement map. 2023-02-05 11:44:18 +00:00
Camille GILLOT e465d647b1 Introduce helper. 2023-02-05 11:42:12 +00:00
Camille GILLOT dc4fe8e295 Make SROA expand assignments. 2023-02-05 11:42:11 +00:00
bors 7f97aeaf73 Auto merge of #107679 - est31:less_import_overhead, r=compiler-errors
Less import overhead for errors

This removes huge (3+ lines) import lists found in files that had their error reporting migrated. These lists are bad for developer workflows as adding, removing, or editing a single error's name might cause a chain reaction that bloats the git diff. As the error struct names are long, the likelihood of such chain reactions is high.

Follows the suggestion by `@Nilstrieb` in the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/massive.20use.20statements) to replace the `use errors::{FooErr, BarErr};` with `use errors;` and then changing to `errors::FooErr` on the usage sites.

I have used sed to do most of the changes, i.e. something like:

```
sed -i -E 's/(create_err|create_feature_err|emit_err|create_note|emit_fatal|emit_warning)\(([[:alnum:]]+|[A-Z][[:alnum:]:]*)( \{|\))/\1(errors::\2\3/' path/to/file.rs
```

& then I manually fixed the errors that occured. Most manual changes were required in `compiler/rustc_parse/src/parser/expr.rs`.

r? `@compiler-errors`
2023-02-05 11:10:11 +00:00
Camille GILLOT 0843acbea6 Fix SROA without deaggregation. 2023-02-05 08:37:03 +00:00
bors 2a6ff72923 Auto merge of #107434 - BoxyUwU:nll_const_equate, r=compiler-errors
emit `ConstEquate` in `TypeRelating<D>`

emitting `ConstEquate` during mir typeck is useful since it can help catch bugs in hir typeck incase our impl of `ConstEquate` is wrong.

doing this did actually catch a bug, when relating `Expr::Call` we `==` the types of all the argument consts which spuriously returns false if the type contains const projections/aliases which causes us to fall through to the `expected_found` error arm.
Generally its an ICE if the `Const`'s `Ty`s arent equal but `ConstKind::Expr` is kind of special since they are sort of like const items that are `const CALL<F: const Fn(...), const N: F>` though we dont actually explicitly represent the `F` type param explicitly in `Expr::Call` so I just made us relate the `Const`'s ty field to avoid getting ICEs from the tests I added and the following existing test:
```rust
// tests/ui/const-generics/generic_const_exprs/different-fn.rs
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

use std::mem::size_of;
use std::marker::PhantomData;

struct Foo<T>(PhantomData<T>);

fn test<T>() -> [u8; size_of::<T>()] {
    [0; size_of::<Foo<T>>()]
    //~^ ERROR unconstrained generic constant
    //~| ERROR mismatched types
}

fn main() {
    test::<u32>();
}
```
which has us relate two `ConstKind::Value` one for the fn item of `size_of::<Foo<T>>` and one for the fn item of `size_of::<T>()`, these only differ by their `Ty` and if we don't relate the `Ty` we'll end up getting an ICE from the checks that ensure the `ty` fields always match.

In theory `Expr::UnOp` has the same problem so I added a call to `relate` for the ty's, although I was unable to create a repro test.
2023-02-05 07:36:37 +00:00
Boxy d85d906f8c emit `ConstEquate` in `TypeRelating<D>` 2023-02-05 07:24:54 +00:00