Commit graph

217938 commits

Author SHA1 Message Date
Deadbeef ed34354bfa Do not lint unresolved trait for ineffective unstable trait impl 2023-02-25 10:12:20 +00:00
bors bd4a96a12d Auto merge of #108300 - oli-obk:elsa, r=eholk
Use a lock-free datastructure for source_span

follow up to the perf regression in https://github.com/rust-lang/rust/pull/105462

The main regression is likely the CStore, but let's evaluate the perf impact of this on its own
2023-02-22 08:44:30 +00:00
bors f9216b7564 Auto merge of #108325 - matthiaskrgr:rollup-73qihie, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #104239 (Better debug logs for borrowck constraint graph)
 - #108202 (Make sure `test_type_match` doesn't ICE with late-bound types)
 - #108295 (Use DefKind to give more item kind information during BindingObligation note )
 - #108306 (compiletest: up deps)
 - #108313 (Fix compiletest possible crash in option only-modified)
 - #108322 (Clean ConstProp)
 - #108323 (hir-analysis: make one diagnostic translatable)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-22 02:39:09 +00:00
bors 375d5ace70 Auto merge of #108302 - Kobzol:revert-107834, r=albertlarsan68
Revert #107834

This reverts commit [41c6c5d499](https://github.com/rust-lang/rust/pull/107834). Trying to check if this fixes building `rustc` for perf bot.
2023-02-21 23:24:59 +00:00
Matthias Krüger d39fc2111b
Rollup merge of #108323 - tshepang:translatable-hir-analysis, r=compiler-errors
hir-analysis: make one diagnostic translatable
2023-02-21 23:02:02 +01:00
Matthias Krüger 82dc2ebfe3
Rollup merge of #108322 - cjgillot:clean-const-prop, r=oli-obk
Clean ConstProp

Small simplifications from the time when there that pass output lints.
2023-02-21 23:02:01 +01:00
Matthias Krüger c21b7f6914
Rollup merge of #108313 - chenyukang:yukang/fix-only-modified, r=oli-obk
Fix compiletest possible crash in option only-modified

`fixed` files maybe removed, `unwrap` will crash in this scenario.
2023-02-21 23:02:01 +01:00
Matthias Krüger c292def803
Rollup merge of #108306 - klensy:compiletest-up, r=wesleywiser
compiletest: up deps

update `miow` 0.3.7 -> 0.5.0 (which moved from `winapi` to `windows-rs`, [changelog](https://github.com/yoshuawuyts/miow/blob/master/CHANGELOG.md#v050---2022-11-10))
replace `lazy_static` with `once_cell` (there is slow transition to the second crate, in hope of eventually stable stdlib version, yes?)
2023-02-21 23:02:00 +01:00
Matthias Krüger ae01430078
Rollup merge of #108295 - compiler-errors:wtf-is-this, r=cjgillot
Use DefKind to give more item kind information during BindingObligation note

The current label says "required by a bound in this". When I see that label, my immediate impression is "this... **what**?". It feels like it was cut short.

Alternative to this would be saying "in this item", but adding the item kind is strictly more informational and adds very little overhead to the existing error presentation.
2023-02-21 23:02:00 +01:00
Matthias Krüger 8a5843f07f
Rollup merge of #108202 - compiler-errors:non_lifetime_binders-type-match-ice, r=davidtwco
Make sure `test_type_match` doesn't ICE with late-bound types

Fixes #108190 (in a kind of hacky way, anyways doesn't really matter)
2023-02-21 23:01:59 +01:00
Matthias Krüger 314fe4d170
Rollup merge of #104239 - b-naber:sccs-info, r=jackh726
Better debug logs for borrowck constraint graph

It's really cumbersome to work with `RegionVar`s when trying to debug borrowck code or when trying to understand how the borrowchecker works. This PR collects some region information (behind `cfg(debug_assertions)`) for created `RegionVar`s (NLL region vars, this PR doesn't touch canonicalization) and prints the nodes and edges of the strongly connected constraints graph using representatives that use that region information (either lifetime names, locations in MIR or spans).
2023-02-21 23:01:58 +01:00
b-naber 8252a6eddf address review 2023-02-21 21:54:53 +00:00
Tshepang Mbambo b483816d88 hir-analysis: make one diagnostic translatable 2023-02-21 22:27:16 +02:00
bors 246eae2fab Auto merge of #108307 - jedisct1:z-link-flags, r=wesleywiser
Linker: use -z <params> instead of -z<params>

The GNU linker accepts -z<params>, but this is undocumented, and not supported by other linkers.

In particular, `zig cc`, when used as the C compiler/linker (e.g. when using `cargo-zigbuild`), will not accept this undocumented syntax.

In `linker.rs`, both syntaxes are also used inconsistently.

The Go compiler used to have the same issue, but fixed it:

38607c5538
2023-02-21 18:53:34 +00:00
klensy 58e7470b10 replace lazy_static with once_cell 2023-02-21 19:23:16 +03:00
bors f4c7596ac3 Auto merge of #108311 - oli-obk:invert_defines, r=lcnr
Make hidden type registration opt-in, so that each site can be reviewed on its own and we have the right defaults for trait solvers

r? `@lcnr`

pulled out of https://github.com/rust-lang/rust/pull/107891 as it is the uncontroversial part
2023-02-21 15:48:40 +00:00
yukang 6e34e651a6 Fix compiletest crash when test file path does not exist 2023-02-21 15:32:45 +00:00
Oli Scherer 88a7b6803b Make hidden type registration opt-in, so that each site can be reviewed on its own and we have the right defaults for trait solvers 2023-02-21 14:50:51 +00:00
Frank Denis 8e250c3c64 Linker: use -z <params> instead of -z<params>
The GNU linker accepts -z<params>, but this is undocumented, and
not supported by other linkers.

In particular, `zig cc`, when used as the C compiler/linker
(e.g. when using `cargo-zigbuild`), will not accept this
undocumented syntax.

In `linker.rs`, both syntaxes are also used inconsistently.

The Go compiler used to have the same issue, but fixed it:

38607c5538
2023-02-21 14:52:20 +01:00
Jakub Beránek 6ca499bf2b
Revert "Copy bin/* and lib/*.dylib files to stage0-sysroot"
This reverts commit 6990ab9ad2.
2023-02-21 14:41:11 +01:00
bors 3200982b76 Auto merge of #108138 - compiler-errors:malformed-fn-trait, r=TaKO8Ki
Move `Fn*` traits malformedness protections to typeck

I found it strange that we were doing a custom well-formedness check just for the `Fn*` traits' `call_*` fn items. My understanding from the git history is that this is just to avoid ICEs later on in typeck.

Well, that well-formedness check isn't even implemented correctly for `FnOnce::call_once`, or `FnMut::call_mut` for that matter. Instead, this PR just makes the typeck checks more robust, and leaves it up to the call-site to report errors when lang items are implemented in funny ways.

This coincidentally fixes another ICE where a the `Add` lang item is implemented with a `add` item that's a const instead of a method.
2023-02-21 12:59:11 +00:00
klensy 1397a5ef92 compiletest: bump miow crate 2023-02-21 15:13:03 +03:00
bors bda32a4023 Auto merge of #108301 - Dylan-DPC:rollup-70zpkt0, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #108000 (lint: don't suggest MaybeUninit::assume_init for uninhabited types)
 - #108105 (Explain the default panic hook better)
 - #108141 (Add rpitit queries)
 - #108272 (docs: wrong naming convention in struct keyword doc)
 - #108285 (remove unstable `pick_stable_methods_before_any_unstable` flag)
 - #108289 (Name placeholder in some region errors)
 - #108290 (Add a test for default trait method with RPITITs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-21 09:51:03 +00:00
Jakub Beránek a5d27316fe
Revert "port over symlink_file function from Build to Config and create symlink for legacy rustfmt path"
This reverts commit 41c6c5d499.
2023-02-21 10:04:19 +01:00
Dylan DPC 60c0972af7
Rollup merge of #108290 - compiler-errors:rpitit-trait-default-constraint, r=oli-obk
Add a test for default trait method with RPITITs

This didn't work in #107013, but now that #108203 has landed, let's make sure we don't regress it.

r? types
2023-02-21 14:20:01 +05:30
Dylan DPC 270f45e172
Rollup merge of #108289 - compiler-errors:name-placeholder, r=petrochenkov
Name placeholder in some region errors

Also don't print `ReVar` or `ReLateBound` as debug... these error messages are super uncommon anyways, but in the case they do trigger, let's be slightly more helpful.
2023-02-21 14:20:01 +05:30
Dylan DPC 6a21237bb8
Rollup merge of #108285 - BoxyUwU:remove_pick_stable_before_unstable_flag, r=oli-obk
remove unstable `pick_stable_methods_before_any_unstable` flag

This flag was only added in #90329 in case there was any issue with the impl so that it would be easy to tell nightly users to use the flag to disable the new logic to fix their code. It's now been enabled for two years and also I can't find any issues corresponding to this new functionality? This flag made it way harder to understand how this code works so it would be nice to remove it and simplify what's going on.

cc `@nbdd0121`

r? `@oli-obk`
2023-02-21 14:20:00 +05:30
Dylan DPC 7dcf7fe737
Rollup merge of #108272 - MrNossiom:master, r=thomcc
docs: wrong naming convention in struct keyword doc

Noticed that the naming convention mentioned is not the right one.

As far as I know, PacalCase is the naming convention used for structs names. PacalCase is not the same as camelCase
2023-02-21 14:20:00 +05:30
Dylan DPC 076e627023
Rollup merge of #108141 - spastorino:add_rpitit_queries, r=compiler-errors
Add rpitit queries

This is part of the changes we are making to lower RPITITs as an associated type. The rest of the stuff will follow under a `-Z` flag.

I still need to add comments to the code, explain stuff and also I'd need to avoid encoding in metadata when rpitit queries return `&[]`

r? `@compiler-errors`
2023-02-21 14:19:59 +05:30
Dylan DPC e781a6ff3b
Rollup merge of #108105 - majaha:patch-1, r=cuviper
Explain the default panic hook better

This changes the documentation of `std::panic::set_hook` and `take_hook` to explain how the default panic hook works. In particular the fact that `take_hook` registers the default hook, rather than no hook at all, was missing from the docs.

I also reworded a few things for clarity.
2023-02-21 14:19:59 +05:30
Dylan DPC 4dea3a295f
Rollup merge of #108000 - y21:no-zero-init-for-uninhabited, r=jackh726
lint: don't suggest MaybeUninit::assume_init for uninhabited types

Creating a zeroed uninhabited type such as `!` or an empty enum with `mem::zeroed()` (or transmuting `()` to `!`) currently triggers this lint:
```rs
warning: the type `!` does not permit zero-initialization
 --> test.rs:5:23
  |
5 |         let _val: ! = mem::zeroed();
  |                       ^^^^^^^^^^^^^
  |                       |
  |                       this code causes undefined behavior when executed
  |                       help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
  |
  = note: the `!` type has no valid value
```
The `MaybeUninit` suggestion in the help message seems confusing/useless for uninhabited types, as such a type cannot be fully initialized in the first place (as the note implies).
This PR limits this help message to inhabited types which can be initialized
2023-02-21 14:19:58 +05:30
Oli Scherer decfb4d123 Use a lock-free datastructure for source_span 2023-02-21 08:38:24 +00:00
Oli Scherer a04e78730e Use source_span query instead of passing the untracked vec around 2023-02-21 08:29:55 +00:00
Oli Scherer a6b381a11b Remove unused Debug impl 2023-02-21 08:13:50 +00:00
bors 3fee48c161 Auto merge of #104754 - nnethercote:more-ThinVec-in-ast, r=the8472
Use `ThinVec` more in the AST

r? `@ghost`
2023-02-21 07:02:57 +00:00
Michael Goulet a58682d7cc Specify what 'this' actually is 2023-02-21 05:21:07 +00:00
bors f715e430aa Auto merge of #107728 - RalfJung:miri-dyn-star, r=RalfJung,oli-obk
Miri: basic dyn* support

As usual I am very unsure about the dynamic dispatch stuff, but it passes even the `Pin<&mut dyn* Trait>` test so that is something.

TBH I think it was a mistake to make `dyn Trait` and `dyn* Trait` part of the same `TyKind` variant. Almost everywhere in Miri this lead to the wrong default behavior, resulting in strange ICEs instead of nice "unimplemented" messages. The two types describe pretty different runtime data layout after all.

Strangely I did not need to do the equivalent of [this diff](https://github.com/rust-lang/rust/pull/106532#discussion_r1087095963) in Miri. Maybe that is because the unsizing logic matches on `ty::Dynamic(.., ty::Dyn)` already? In `unsized_info` I don't think the `target_dyn_kind` can be `DynStar`, since then it wouldn't be unsized!

r? `@oli-obk` Cc `@eholk` (dyn-star) https://github.com/rust-lang/rust/issues/102425
2023-02-21 04:22:23 +00:00
Michael Goulet dfc4a580f2 Add a test for default trait method with RPITITs 2023-02-21 02:01:26 +00:00
bors 2deff71719 Auto merge of #105462 - oli-obk:feeding_full, r=cjgillot,petrochenkov
give the resolver access to TyCtxt

The resolver is now created after TyCtxt is created. Then macro expansion and name resolution are run and the results fed into queries just like before this PR.

Since the resolver had (before this PR) mutable access to the `CStore` and the source span table, these two datastructures are now behind a `RwLock`. To ensure that these are not mutated anymore after the resolver is done, a read lock to them is leaked right after the resolver finishes.

### PRs split out of this one and leading up to it:

* https://github.com/rust-lang/rust/pull/105423
* https://github.com/rust-lang/rust/pull/105357
* https://github.com/rust-lang/rust/pull/105603
* https://github.com/rust-lang/rust/pull/106776
* https://github.com/rust-lang/rust/pull/106810
* https://github.com/rust-lang/rust/pull/106812
* https://github.com/rust-lang/rust/pull/108032
2023-02-21 01:19:25 +00:00
Nicholas Nethercote 9c7570b429 Fix a test. 2023-02-21 11:53:20 +11:00
Mara Bos c7f443a6e3 Enable --cfg=parallel_compiler in rustdoc. 2023-02-21 11:53:17 +11:00
Guillaume Gomez 953a71a328 Allow disabling of auto and blanket trait impls retrieval in rustdoc when in parallel_compiler mode. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote 7e855d5f31 Use ThinVec in a few more AST types. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote 549f1c60af Use ThinVec in ast::ExprKind::Match. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote 912b825002 Use ThinVec in ast::PatKind::Struct. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote 1807027248 Use ThinVec in ast::AngleBracketedArgs. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote b14b7ba5dd Use ThinVec in ast::Block. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote 4143b101f9 Use ThinVec in various AST types.
This commit changes the sequence parsers to produce `ThinVec`, which
triggers numerous conversions.
2023-02-21 11:51:56 +11:00
Nicholas Nethercote 6a56c3a930 Use ThinVec in ast::Impl and related types. 2023-02-21 11:51:55 +11:00
Nicholas Nethercote 068db466e8 Use ThinVec in ast::WhereClause. 2023-02-21 11:51:55 +11:00