Commit Graph

221520 Commits

Author SHA1 Message Date
Obei Sideg
066638b94a Migrate rustc_hir_analysis to session diagnostic
Part 3: Finishing `collect.rs` file
2023-04-08 01:24:54 +03:00
Eric Holk
f8b62ff535
Remove myself from reviewers list
I'm going to be unable to review for the next few weeks, so I'm
removing myself from the review queue. Once I'm back and able to review
again, I'll add myself back to the list.
2023-04-07 15:24:08 -07:00
Sergei Belokon
081e222d99 fix(tcp): remove redundant format! macro call 2023-04-08 08:20:05 +10:00
Jörn Bethune
7e9e91c3d3 Fix wrong type in docs: i16 -> u16
@rustbot label +A-docs

r? docs
2023-04-07 23:49:20 +02:00
ozkanonur
eeec73244d download beta compiler toolchain in bootstrap if it doesn't yet exist
This is needed for when the shell scripts bypass python altogether and run the downloaded
bootstrap directly. Changes are mainly provided from @jyn514, I just fixed the review notes.

Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-04-08 00:30:49 +03:00
bors
23ee2af2f7 Auto merge of #109788 - compiler-errors:trait-item-from-non-trait, r=petrochenkov
More descriptive error when qself path doesnt have a trait on the RHS of `as`

`<Ty as Enum>::Assoc` should report that `Enum` is a trait. Main question is whether to eagerly report the error, or raise it with `return Err(..)` -- i'll note that in an inline comment though.

cc `@GuillaumeGomez` who said this came up at a Paris Rust meetup.

r? `@petrochenkov`
2023-04-07 20:40:05 +00:00
Matthew Jasper
f7f2eb3e41 Move FnPtrAddr error to SessionDiagnostic 2023-04-07 19:48:27 +01:00
Maybe Waffle
5f50c0f7ac Document that &T and &mut T are Sync if T is 2023-04-07 18:36:48 +00:00
kadmin
b76dd8c807 Add feature gate 2023-04-07 11:18:07 -07:00
bors
da636956dd Auto merge of #109983 - tmiasko:inline-try, r=bjorn3
Inline try_from and try_into

To avoid link time dependency between core and compiler-builtins, when using opt-level that implicitly enables -Zshare-generics.

While compiler-builtins should be compiled with -Zshare-generics disabled, the -Zbuild-std does not ensure this at the moment.

r? `@bjorn3`
2023-04-07 17:06:24 +00:00
bors
94524020ea Auto merge of #110036 - jackh726:placeholder_boundvar, r=nnethercote
Remove u32 on BrAnon and BoundTyKind::Anon in favor of BoundVar on Placeholder types

r? `@nnethercote`

Better alternative to #110025
2023-04-07 14:26:24 +00:00
Nicholas Nethercote
f08f15481a Add a size assertion for RegionKind. 2023-04-07 09:15:38 -04:00
bors
da14081468 Auto merge of #102906 - nbdd0121:mir, r=wesleywiser,tmiasko
Refactor unwind in MIR

This makes unwinding from current `Option<BasicBlock>` into
```rust
enum UnwindAction {
	Continue,
	Cleanup(BasicBlock),
	Unreachable,
	Terminate,
}
```

cc `@JakobDegen` `@RalfJung` `@Amanieu`
2023-04-07 10:31:14 +00:00
Maybe Waffle
fbe0591c68 Mark OwnedSlice::{deref, borrow} as #[inline] 2023-04-07 10:14:50 +00:00
Gary Guo
ea69dad8fa Fix coverage test 2023-04-07 10:18:28 +01:00
Scott McMurray
1042b5df9b Avoid some manual slice length calculation
No need for us to write the multiplication when `size_of_val` does exactly what we need.
2023-04-07 01:32:12 -07:00
bors
b6f6104a1f Auto merge of #110019 - jplatte:jplatte/stabilize-is-some-and, r=Amanieu
Stabilize is_some_and

This stabilizes the following public API:

```rust
impl<T> Option<T> {
    pub fn is_some_and(self, f: impl FnOnce(T) -> bool) -> bool;
}

impl<T, E> Result<T, E> {
    pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool;
    pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool;
}
```

Closes #93050 (tracking issue).

`@rustbot` label +T-libs-api -T-libs
2023-04-07 08:09:20 +00:00
ickk
30f458ed1e update tests/ui 2023-04-07 18:07:11 +10:00
ickk
726598ed9a fix infer_source_kind_subdiag_let help message - remove double "the" 2023-04-07 17:42:17 +10:00
León Orell Valerian Liehr
f2acafe9e2 suggest adding const param 2023-04-07 09:11:53 +02:00
bors
97879ce24b Auto merge of #109990 - gwy15:remove-bufwriter-useless-mut-pointer, r=jyn514
Remove an unnecessary `mut` in `BufWriter::into_parts`.

`ptr::read` takes `*const T` so `&mut` is not necessary.
2023-04-07 05:49:34 +00:00
Michael Goulet
d5b1ef1c3f Use smart-resolve when checking for trait in RHS of UFCS 2023-04-07 05:33:52 +00:00
bors
32ea4bb9e3 Auto merge of #109663 - fee1-dead-contrib:rustc_macros-syn-2.0, r=Nilstrieb
migrate rustc_macros to syn 2.0

WIP at this point since I need to work on migrating the code that heavily uses `NestedMeta` for parsing. Perhaps a full refactor would be nice..
2023-04-07 03:37:21 +00:00
Michael Howell
5cad51c0c5 rustdoc: add test and bug fix for theme defaults 2023-04-06 20:25:07 -07:00
Jack Huey
b15195a304 Remove u32 on BoundTyKind::Anon 2023-04-06 23:08:04 -04:00
Jack Huey
f0edcc8a6f Remove index from BrAnon 2023-04-06 23:01:40 -04:00
Jack Huey
e4edf00f12 Don't use BrAnon index in diagnostics 2023-04-06 23:01:38 -04:00
Jack Huey
167b70692b Remove expect_anon and expect_anon_placeholder in favor of var 2023-04-06 23:01:38 -04:00
Jack Huey
4646b3df6a Use BoundTy and BoundRegion instead of kind of PlaceholderTy and PlaceholderRegion 2023-04-06 23:01:35 -04:00
bors
c934ce9e0a Auto merge of #110024 - matthiaskrgr:rollup-mydkufd, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #109806 (Workaround #109797 on windows-gnu)
 - #109957 (diagnostics: account for self type when looking for source of unsolved type variable)
 - #109960 (Fix buffer overrun in bootstrap and (test-only) symlink_junction)
 - #110013 (Label `non_exhaustive` attribute on privacy errors from non-local items)
 - #110016 (Run collapsed GUI test in mobile mode as well)
 - #110022 (fix: fix regression in #109203)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-07 00:11:26 +00:00
Tomasz Miąsko
7ddc245b14 ./x.py test --bless 2023-04-07 00:00:00 +00:00
Tomasz Miąsko
67b4614180 Inline try_from and try_into
To avoid link time dependency between core and compiler-builtins, when
using opt-level that implicitly enables -Zshare-generics.

While compiler-builtins should be compiled with -Zshare-generics
disabled, the -Zbuild-std does not ensure this at the moment.
2023-04-07 14:59:10 +02:00
Michael Goulet
2cd0729d63 Get rid of elaborate_trait_ref{s} too 2023-04-06 23:30:22 +00:00
Michael Goulet
758bedc104 Make elaborator generic 2023-04-06 23:30:22 +00:00
Michael Howell
815f5bbcc5 rustdoc: clean up JS
* Stop checking `func` in `onEach`. It's always hard-coded right
  at the call site, so there's no point.
* Use the ternary operator in a few spots where it makes sense.
* No point in making `onEach` store `arr.length` in a variable if
  it's only used once anyway.
2023-04-06 16:25:38 -07:00
Matthias Krüger
903b439cac
Rollup merge of #110022 - Ezrashaw:fix-parser-ident-regression, r=compiler-errors
fix: fix regression in #109203

Fixes #110014

r? `@compiler-errors`
2023-04-07 00:00:26 +02:00
Matthias Krüger
273b221537
Rollup merge of #110016 - GuillaumeGomez:gui-collapsed-mobile, r=notriddle
Run collapsed GUI test in mobile mode as well

Extending test from https://github.com/rust-lang/rust/pull/109818 to be run on mobile as well.

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

r? `@notriddle`
2023-04-07 00:00:26 +02:00
Matthias Krüger
e70818983b
Rollup merge of #110013 - compiler-errors:non-exhaustive-privacy-reason, r=WaffleLapkin
Label `non_exhaustive` attribute on privacy errors from non-local items

Label when an ADT is `non_exhaustive` and we get a privacy error, help with confusion in a case like this:

```rust
#[non_exhaustive]
pub struct Foo;

// other crate
let x = Foo;
//~^ ERROR unit struct `Foo` is private
```
2023-04-07 00:00:25 +02:00
Matthias Krüger
17ed06aad2
Rollup merge of #109960 - thomcc:symlink-junction-buffer-overrun, r=ChrisDenton
Fix buffer overrun in bootstrap and (test-only) symlink_junction

I don't think these can be hit in practice, due to their inputs being valid paths. It's also not security-sensitive code, but just... bad vibes.

I think this is still not really the right way to do this (in terms of path correctness), but is no worse than it was.

r? `@ChrisDenton`
2023-04-07 00:00:25 +02:00
Matthias Krüger
e63586f386
Rollup merge of #109957 - fmease:fix-109905, r=petrochenkov
diagnostics: account for self type when looking for source of unsolved type variable

Fixes #109905.

When searching for the source of an unsolved infer var inside of a list of generic args, we look through the `tcx.generics_of(…).own_substs(…)` which *skips* the self type if present. However, the computed `argument_index` is later[^1] used to index into `tcx.generics_of(…).params` which may still contain the self type. In such case, we are off by one when indexing into the parameters.

From now on, we account for this immediately after calling `own_substs` which keeps things local.

This also fixes the wrong output in the preexisting UI test `inference/need_type_info/concrete-impl.rs` which was overlooked. It used to claim that the *type of type parameter `Self`* couldn't be inferred in `<Struct as Ambiguous<_>>::method()` which of course isn't true: `Self` equals `Struct` here, `A` couldn't be inferred.

`@rustbot` label A-diagnostics

[^1]: f98a271814/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs (L471)
2023-04-07 00:00:24 +02:00
Matthias Krüger
b7e6973287
Rollup merge of #109806 - Zoxc:gnu-tls, r=pnkfelix
Workaround #109797 on windows-gnu

The addition of `#[inline]` here in https://github.com/rust-lang/rust/pull/108089 caused an unrelated linking issue (https://github.com/rust-lang/rust/issues/109797). This PR removes this attribute again on Windows to avoid regressions.
2023-04-07 00:00:23 +02:00
Gary Guo
1499a6faad UnwindAction::Terminate edge is also critical edge 2023-04-06 22:24:47 +01:00
bors
28a29282f6 Auto merge of #109162 - ozkanonur:extend_detect_src_and_out_test, r=jyn514
extend `detect_src_and_out` test

> I was thinking about the following cases when I wrote the comment in #109055
>
> 1. Running bootstrap from the source root.
> 2. Running from a subdirectory of the source root.
> 3. Running from outside the source root.
> 4. Running on a different machine from where bootstrap was compiled (which will be important > for #107812). You can mostly replicate this by renaming the source root so it no longer exists on disk.
> 5. Running with `--build-dir`.
> 6. Running with `$RUST_BOOTSTRAP_CONFIG` set in the environment and `build-dir` set in the file.

Tested all the topics mentioned above. All worked fine. The test is now also covers if build dir is manually specified in config.

r? `@jyn514`

helps #109120 partially
2023-04-06 21:18:49 +00:00
Jonas Platte
443928f7e3
Stabilize is_some_and 2023-04-06 23:14:23 +02:00
Ezra Shaw
9dbf20ef27
fix: fix regression in #109203 2023-04-07 08:54:13 +12:00
Scott McMurray
454bca514a Check CastKind::Transmute sizes in a better way
Fixes #110005
2023-04-06 13:53:10 -07:00
bors
de74dab880 Auto merge of #110012 - matthiaskrgr:rollup-sgmm5xv, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #109395 (Fix issue when there are multiple candidates for edit_distance_with_substrings)
 - #109755 (Implement support for `GeneratorWitnessMIR` in new solver)
 - #109782 (Don't leave a comma at the start of argument list when removing arguments)
 - #109977 (rustdoc: avoid including line numbers in Google SERP snippets)
 - #109980 (Derive String's PartialEq implementation)
 - #109984 (Remove f32 & f64 from MemDecoder/MemEncoder)
 - #110004 (add `dont_check_failure_status` option in the compiler test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-06 18:48:42 +00:00
Guillaume Gomez
529ceeeefc Run collapsed GUI test in mobile mode as well 2023-04-06 20:26:27 +02:00
Maybe Waffle
2733c29bb1 Support multithreaded mode in OwnedSlice tests 2023-04-06 18:13:07 +00:00
Maybe Waffle
e0e39caf84 Add basic tests for OwnedSlice 2023-04-06 17:33:55 +00:00