Commit Graph

26000 Commits

Author SHA1 Message Date
Oli Scherer
307b5ffff3 Make all generics_require_sized_self go through the query to get caching. 2023-07-05 07:46:05 +00:00
Oli Scherer
62fbbac2d9 tidy: move a large function out of an even larger file 2023-07-05 07:46:04 +00:00
Oli Scherer
9e98feb84c Add some extra information to opaque type cycle errors 2023-07-05 07:43:35 +00:00
Oli Scherer
66ae9998d5 Remove redundant delay_span_bug 2023-07-05 07:43:35 +00:00
Oli Scherer
a49b736568 Lint now-unnecessary associated type bounds 2023-07-05 07:42:53 +00:00
Oli Scherer
ca581f9161 Don't require associated types with Self: Sized bounds in dyn Trait objects 2023-07-05 07:42:53 +00:00
Oli Scherer
97d831d008 Show which type was not specialized on query cycle misuse 2023-07-05 07:30:28 +00:00
Oli Scherer
d6b82ff761 Remove a redundant argument 2023-07-05 07:30:28 +00:00
Michael Goulet
d2a1803d6f Winnow specializing impls 2023-07-05 06:18:48 +00:00
bors
6dab6dc5fc Auto merge of #112697 - tgross35:explain-markdown, r=oli-obk
Add simple markdown formatting to `rustc --explain` output

This is a second attempt at #104540, which is #63128 without dependencies.

This PR adds basic markdown formatting to `rustc --explain` output when available. Currently, the output just displays raw markdown: this works of course, but it really doesn't look very elegant. (output is `rustc --explain E0038`)

<img width="583" alt="image" src="https://github.com/rust-lang/rust/assets/13724985/ea418117-47af-455b-83c0-6fc59276efee">

After this patch, sample output from the same file:

<img width="693" alt="image" src="https://github.com/rust-lang/rust/assets/13724985/12f7bf9b-a3fe-4104-b74b-c3e5227f3de9">

This also obeys the `--color always/auto/never` command option. Behavior:

- If pager is available and supports color, print with formatting to the pager
- If pager is not available or fails print with formatting to stdout - otherwise without formatting
- Follow `--color always/never` if suppied
- If everything fails, just print plain text to stdout

r? `@oli-obk`
cc `@estebank`
(since the two of you were involved in the previous discussion)
2023-07-05 06:18:46 +00:00
bors
9227ff28af Auto merge of #113329 - lcnr:probe_candidate, r=BoxyUwU
add `ecx.probe_candidate`

Not yet changing the candidate source to an enum because that would be more involved, but this by itself should already be a significant improvement imo

r? `@BoxyUwU`
2023-07-05 03:50:36 +00:00
bors
b7bc6f88ac Auto merge of #113330 - matthiaskrgr:rollup-zm3owin, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #113192 (`assemble_candidates_after_normalizing_self_ty` docs)
 - #113251 (Use scoped-tls for SMIR to  map between TyCtxt and SMIR datastructures)
 - #113282 (Update platform-support.md to improve ARM target descriptions)
 - #113296 (add flag for enabling global cache usage for proof trees and printing proof trees on error)
 - #113324 (implement `ConstEvaluatable` goals in new solver)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-04 23:51:52 +00:00
bors
f20afcc455 Auto merge of #113325 - BoxyUwU:move_mk_methods_to_const, r=lcnr
Replace `mk_const` with `Const::new_x` methods

Part of rust-lang/compiler-team#616. Instead of just havign `Const::new(` and nothing else I did it like this since this is more like how the `mk_x` works for `Ty`, and also another PR of mine will require changing from `Const::new(` to `Const::new_x(` anyway.

r? `@oli-bok`
2023-07-04 21:33:25 +00:00
Deadbeef
25fc6c1586 add fixme 2023-07-04 17:21:52 +00:00
Deadbeef
58c105af04 include host_effect_index in Generics 2023-07-04 17:21:52 +00:00
Matthias Krüger
7996908c4f
Rollup merge of #113324 - lcnr:const-evaluatable-goal, r=BoxyUwU
implement `ConstEvaluatable` goals in new solver

this only supports stable const generics. `feature(generic_const_exprs)` needs to extend that function is non-trivial ways. Leaving this for someone else or some later date.

r? `@BoxyUwU`
2023-07-04 17:46:28 +02:00
Matthias Krüger
494e67c63c
Rollup merge of #113296 - BoxyUwU:proof_trees_on_error, r=lcnr
add flag for enabling global cache usage for proof trees and printing proof trees on error

This adds a few new things:
- `-Zdump-solver-proof-tree=always/never/on-error`
    - `always`/`never` were previosuly specifiable by whether the flag exists or not, th new flag is `on_error` which reruns obligations of fulfillment and selection errors with proof tree generation enabled and prints them out
- `-Zdump-solver-proof-tree-uses-cache`
    - allows forcing global cache to be used or unused for all generated proof trees, global cache is enabled by default for `always` so that it accurately represents what happend. This flag currently would affect misc uses of `GenerateProofTree::Yes` which will be added in the future for things like diagnostics logic and rustdoc's auto_trait file. We can fix this when we start using proof tree generation for those use cases if it's desirable.

I also changed the output to go straight to stdout instead of going through `debug!` so that `-Zdump-solver-proof-tree` can be adequately used on `nightly` not just a locally built toolchain.

The idea for `on-error` is that it should hopefully make it easier to quickly figure out "why doesnt this code compile"- you just pass in `-Zdump-solver-proof-tree=on-error` and you'll only get proof trees you care about.

---

r? `@lcnr` `@compiler-errors`
2023-07-04 17:46:28 +02:00
Matthias Krüger
d3fae79178
Rollup merge of #113251 - chenyukang:yukang-fix-112940-smir, r=oli-obk
Use scoped-tls for SMIR to  map between TyCtxt and SMIR datastructures

Fixes #112940
r? `@oli-obk`
2023-07-04 17:46:27 +02:00
Matthias Krüger
6fb790ad1a
Rollup merge of #113192 - lcnr:add-comment, r=compiler-errors
`assemble_candidates_after_normalizing_self_ty` docs

I already explained that in different places a few times, should have added that explanation as a doc comment the first time I did so :3

r? `@BoxyUwU`
2023-07-04 17:46:26 +02:00
lcnr
795c2ef7d9 add ecx.probe_candidate 2023-07-04 17:08:07 +02:00
Boxy
d3cd406519
nit
Co-authored-by: lcnr <rust@lcnr.de>
2023-07-04 15:11:12 +01:00
Boxy
284b61417f reviews 2023-07-04 14:56:09 +01:00
lcnr
abcaf30f9b implement ConstEvaluatable goals in new solver
we don't yet handle `generic_const_exprs`, someone else
can do that :3
2023-07-04 15:54:18 +02:00
Boxy
d30f56dbf2 Replace const_error methods with Const::new_error 2023-07-04 14:46:32 +01:00
Boxy
ddbc774e74 Replace mk_const with Const::new_x methods 2023-07-04 14:26:33 +01:00
bors
4dbc7e3092 Auto merge of #113309 - chenyukang:yukang-fix-89640-space, r=Nilstrieb
Detect extra space in keyword for better hint

Fixes #89640

r? `@Nilstrieb`

I met the same issue, then found out this old issue :)
2023-07-04 12:04:57 +00:00
Deadbeef
30b21b758a add test 2023-07-04 11:47:46 +00:00
Deadbeef
0b095a60d2 allow host param to be lowercase 2023-07-04 11:47:46 +00:00
Deadbeef
8eb3e0bf30 enforce context effects in typeck 2023-07-04 11:47:46 +00:00
Deadbeef
1c837cb6f7 Add effects during lowering for ~const bounds 2023-07-04 11:47:45 +00:00
Deadbeef
2d5d56bb59 Add feature and attribute definition 2023-07-04 11:47:45 +00:00
yukang
799d2917e7 Detect extra space in keyword for better hint 2023-07-04 18:13:31 +08:00
lcnr
594cd84a94 TypeParameterDefinition always require a DefId 2023-07-04 11:51:07 +02:00
bors
cd68ead9ec Auto merge of #113303 - compiler-errors:yeet-chalk, r=lcnr
Remove chalk support from the compiler

Removes chalk (`-Ztrait-solver=chalk`) from the compiler and prunes any dead code resulting from this, mainly:
* Remove the chalk compatibility layer in `compiler/rustc_traits/src/chalk`
* Remove the chalk flag `-Ztrait-solver=chalk` and its `TraitEngine` implementation
* Remove `TypeWellFormedFromEnv` (and its many `bug!()` match arms)
* Remove the chalk migration mode from compiletest
* Remove the `chalkify` UI tests (do we want to keep any of these, but migrate them to `-Ztrait-solver=next`??)

Fulfills rust-lang/types-team#93.

r? `@jackh726`
2023-07-04 09:09:09 +00:00
Boxy
276d628cac move logic for flags into separate function 2023-07-04 10:01:54 +01:00
lcnr
312994243a extend comment 2023-07-04 10:34:27 +02:00
Boxy
adefeb80c3 change flag name 2023-07-04 09:17:41 +01:00
Boxy
2ad00f471a reviews 2023-07-04 09:13:10 +01:00
lcnr
b468bfb361 -Ztrait-solver=next: stop depending on old solver 2023-07-04 10:06:39 +02:00
bors
52d8c490a3 Auto merge of #113304 - cuviper:indexmap-2, r=Mark-Simulacrum
Upgrade to indexmap 2.0.0

The new version was already added to the tree as an indirect dependency
in #113046, but now our direct dependents are using it too.
2023-07-04 06:49:20 +00:00
bors
0130c3a06e Auto merge of #113215 - compiler-errors:rpitit-predicates-tweaks, r=spastorino
Make RPITITs assume/require their parent method's predicates

Removes a FIXME from the `param_env` query where we were manually adding the parent function's predicates to the RPITIT's assumptions.

r? `@spastorino`
2023-07-04 04:24:24 +00:00
bors
e728b5b98d Auto merge of #112917 - chenyukang:yukang-fix-112590, r=estebank
Suggest importing for partial mod path matching in name resolving

Fixes #112590
2023-07-04 02:01:24 +00:00
Michael Goulet
0c73b41cd6 remove TypeWellFormedFromEnv 2023-07-03 21:40:04 +00:00
Michael Goulet
810fbf086d Remove chalk from the compiler 2023-07-03 21:40:04 +00:00
Josh Stone
d9b1fa93c4 Upgrade to indexmap 2.0.0
The new version was already added to the tree as an indirect dependency
in #113046, but now our direct dependents are using it too.
2023-07-03 13:51:54 -07:00
bors
0ab38e95bb Auto merge of #108611 - davidtwco:issue-94223-external-abi-fn-ptr-in-internal-abi-fn, r=jackh726
lint/ctypes: ext. abi fn-ptr in internal abi fn

Fixes #94223.

- In the improper ctypes lint, instead of skipping functions with internal ABIs, check that the signature doesn't contain any fn-ptr types with external ABIs that aren't FFI-safe.
- When computing the ABI for fn-ptr types, remove an `unwrap` that assumed FFI-safe types in foreign fn-ptr types.
  - I'm not certain that this is the correct approach.
2023-07-03 20:30:28 +00:00
Trevor Gross
6a1c10bd85 Add a simple markdown parser for formatting rustc --explain
Currently, the output of `rustc --explain foo` displays the raw markdown in a
pager. This is acceptable, but using actual formatting makes it easier to
understand.

This patch consists of three major components:

1.  A markdown parser. This is an extremely simple non-backtracking recursive
    implementation that requires normalization of the final token stream
2.  A utility to write the token stream to an output buffer
3.  Configuration within rustc_driver_impl to invoke this combination for
    `--explain`. Like the current implementation, it first attempts to print to
    a pager with a fallback colorized terminal, and standard print as a last
    resort.

    If color is disabled, or if the output does not support it, or if printing
    with color fails, it will write the raw markdown (which matches current
    behavior).

    Pagers known to support color are: `less` (with `-r`), `bat` (aka `catbat`),
    and `delta`.

The markdown parser does not support the entire markdown specification, but
should support the following with reasonable accuracy:

-   Headings, including formatting
-   Comments
-   Code, inline and fenced block (no indented block)
-   Strong, emphasis, and strikethrough formatted text
-   Links, anchor, inline, and reference-style
-   Horizontal rules
-   Unordered and ordered list items, including formatting

This parser and writer should be reusable by other systems if ever needed.
2023-07-03 16:04:18 -04:00
Boxy
040aa58d0a add flag for disabling global cache and printing proof trees on error 2023-07-03 21:00:16 +01:00
bors
8931edf746 Auto merge of #113293 - GuillaumeGomez:rollup-2395uw0, r=GuillaumeGomez
Rollup of 3 pull requests

Successful merges:

 - #112869 (Implement selection via new trait solver)
 - #113285 ([rustdoc] Fix display of long inline cfg labels)
 - #113286 (Don't perform selection if inherent associated types are not enabled)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-03 17:21:14 +00:00
Guillaume Gomez
157bab670f
Rollup merge of #113286 - fmease:iat-dont-select-if-not-enabled, r=compiler-errors
Don't perform selection if inherent associated types are not enabled

Fixes #113265.

As discussed
r? `@compiler-errors`
2023-07-03 18:46:14 +02:00
Michael Goulet
f3f8793268 Helpers for creating EvalCtxts, some comments 2023-07-03 15:58:33 +00:00
Michael Goulet
298c0d1a62 Implement selection in new trait solver 2023-07-03 15:53:27 +00:00
David Wood
2227422920
lint: refactor to make logic a bit cleaner
Signed-off-by: David Wood <david@davidtw.co>
2023-07-03 14:29:04 +01:00
David Wood
f1e287948b
lint: stop normalizing types to avoid recur limits
This was causing compilation failures in the
performance benchmarking as diesel hit recursion
limits.

Signed-off-by: David Wood <david@davidtw.co>
2023-07-03 14:12:20 +01:00
Nilstrieb
ba0f5dcd14 Revert "Suggest x build library for a custom toolchain that fails to load core"
This reverts commit b913f5593d.

CI builds with profile=nightly, causing different test output.

Making the output depend on the release channel was not a great idea.
2023-07-03 12:48:52 +00:00
David Wood
9137fea30d
lint/ctypes: check other types for ext. fn-ptr ty
Extend previous checks for external ABI fn-ptrs to use in internal
statics, constants, type aliases and algebraic data types.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-07-03 13:40:20 +01:00
David Wood
c75b080d7d
lint/ctypes: multiple external fn-ptrs in ty
Extend previous commit's support for checking for external fn-ptrs in
internal fn types to report errors for multiple found fn-ptrs.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-07-03 13:40:20 +01:00
David Wood
eddfce53c1
abi: avoid ice for non-ffi-safe fn ptrs
Remove an `unwrap` that assumed FFI-safe types in foreign fn-ptr types.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-07-03 13:40:20 +01:00
David Wood
e3f90bca50
lint/ctypes: ext. abi fn-ptr in internal abi fn
Instead of skipping functions with internal ABIs, check that the
signature doesn't contain any fn-ptr types with external ABIs that
aren't FFI-safe.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-07-03 13:40:20 +01:00
León Orell Valerian Liehr
838f85d6f7
Don't perform selection if IATs are not enabled 2023-07-03 14:33:38 +02:00
bors
737b461555 Auto merge of #113086 - lcnr:rust8, r=compiler-errors
implement deep normalization via the new solver

together with #112869 this should remove all uses of the old solver with `-Ztrait-solver=next`.

see https://hackmd.io/V0qsUB_fTxexfQO_pcOcrg for a description of this PR. Will move that doc to the `rustc-dev-guide` after merging this.

r? `@compiler-errors`
2023-07-03 07:38:26 +00:00
lcnr
be6a344365 rebase 2023-07-03 09:24:02 +02:00
lcnr
412c6e0b07 review 2023-07-03 09:12:15 +02:00
lcnr
a2dfed6711 deeply_normalize pass in fulfill cx for old solver 2023-07-03 09:12:15 +02:00
lcnr
5378f07d64 use deeply_normalize for assumed_wf_types 2023-07-03 09:12:14 +02:00
lcnr
d2c7449189 add a try_structurally_resolve_type in coerce 2023-07-03 09:12:14 +02:00
lcnr
42067596c2 add deep normalization via the new solver 2023-07-03 09:12:14 +02:00
lcnr
4d42de6d1b add instrument to register_predicate_obligation 2023-07-03 09:12:14 +02:00
lcnr
bd0d533d23 fix structurally relate for weak aliases 2023-07-03 09:12:14 +02:00
lcnr
8ebb3d49e4 rename structurally_resolved_type 2023-07-03 09:12:14 +02:00
bors
1623634aa5 Auto merge of #113271 - matthiaskrgr:rollup-2ik4vaj, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #113253 (Fixed documentation of from<CString> for Rc<CStr>: Arc -> Rc)
 - #113258 (Migrate GUI colors test to original CSS color format)
 - #113259 (Suggest `x build library` for a custom toolchain that fails to load `core`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-03 05:07:26 +00:00
bors
d5a74249c8 Auto merge of #112882 - DrMeepster:new_un_derefer, r=oli-obk
Rewrite `UnDerefer`

Currently, `UnDerefer` is used by drop elaboration to undo the effects of the `Derefer` pass. However, it just recreates the original places with derefs in the middle of the projection. Because `ProjectionElem::Deref` is intended to be removed completely in the future, this will not work forever.

This PR introduces a `deref_chain` method that returns the places behind `DerefTemp` locals in a place and rewrites the move path code to use this. In the process, `UnDerefer` was merged into `MovePathLookup`. Now that move paths use the same places as in the MIR, the other uses of `UnDerefer` no longer require it.

See #98145
cc `@ouz-a`
r? `@oli-obk`
2023-07-03 02:46:39 +00:00
Matthias Krüger
1366ad36a6
Rollup merge of #113259 - MU001999:diag/add-std, r=Nilstrieb
Suggest `x build library` for a custom toolchain that fails to load `core`

Fixes #113222

r? `@jyn514`
2023-07-02 23:30:47 +02:00
Nilstrieb
fd49b1d37f Downgrade rustix
See https://github.com/rust-lang/rust/pull/113046#issuecomment-1616094626.
2023-07-02 21:02:31 +02:00
Nilstrieb
171be8ce94 Downgrade tracing and syn
There's currently a deadlock with tracing when RUSTC_LOG is enabled.
Downgrade tracing-core for now to avoid blocking the other updates.

syns upgrades cause some nontrivial changes in the diagnostics derive tests,
which are best dealt with in another PR.
2023-07-02 21:02:31 +02:00
bors
131a03664e Auto merge of #113040 - Kobzol:llvm-remark-streamer, r=tmiasko
Add `-Zremark-dir` unstable flag to write LLVM optimization remarks to YAML

This PR adds an option for `rustc` to emit LLVM optimization remarks to a set of YAML files, which can then be digested by existing tools, like https://github.com/OfekShilon/optview2. When `-Cremark-dir` is passed, and remarks are enabled (`-Cremark=all`), the remarks will be now written to the specified directory, **instead** of being printed to standard error output.  The files are named based on the CGU from which they are being generated.

Currently, the remarks are written using the LLVM streaming machinery, directly in the diagnostics handler. It seemed easier than going back to Rust and then form there back to C++ to use the streamer from the diagnostics handler. But there are many ways to implement this, of course, so I'm open to suggestions :)

I included some comments with questions into the code. Also, I'm not sure how to test this.

r? `@tmiasko`
2023-07-02 12:48:44 +00:00
Jakub Beránek
62728c7aaf
Add rustc option to output LLVM optimization remarks to YAML files 2023-07-02 13:41:36 +02:00
bors
4c3f8c728b Auto merge of #113256 - matthiaskrgr:rollup-poex8w2, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #113147 (Fix document examples of Vec::from_raw_parts and Vec::from_raw_parts_in)
 - #113202 (std docs: factorize literal in Barrier example)
 - #113228 (Migrate GUI colors test to original CSS color format)
 - #113231 (Fix `dropping_copy_types` lint from linting in match-arm with side-effects)
 - #113233 (Update chalk)
 - #113234 (Don't pass --test-args to `python -m unitest`)
 - #113244 (Make Rust Analyzer tests faster by compiling less code)
 - #113249 (Document tracking issue for rustdoc `show-type-layout`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-02 10:22:49 +00:00
Mu001999
b913f5593d Suggest x build library for a custom toolchain that fails to load core 2023-07-02 17:53:44 +08:00
Matthias Krüger
fda22efbf0
Rollup merge of #113233 - Nilstrieb:chaaalk, r=jackh726
Update chalk

For #109302

r? jackh726
2023-07-02 10:27:21 +02:00
Matthias Krüger
74a272d3d7
Rollup merge of #113231 - Urgau:fix_false_positive_drop_copy, r=Nilstrieb
Fix `dropping_copy_types` lint from linting in match-arm with side-effects

This PR fixes an issue with the `dropping_copy_types` and `dropping_references` lints when not all patterns that can have side-effects were detected and ignored.

Nearly _fixes_ https://github.com/rust-lang/rust/issues/112653 (will need beta-backport to completely fix the issue)
r? ``@Nilstrieb``
2023-07-02 10:27:21 +02:00
bors
72b2101434 Auto merge of #112718 - oli-obk:SIMD-destructure_mir_const, r=cjgillot
Make simd_shuffle_indices use valtrees

This removes the second-to-last user of the `destructure_mir_constant` query. So in a follow-up we can remove the query and just move the query provider function directly into pretty printing (which is the last user).

cc `@rust-lang/clippy` there's a small functional change, but I think it is correct?
2023-07-02 07:43:36 +00:00
yukang
b26701ea79 add testcase for 112590 2023-07-02 15:35:18 +08:00
bors
8e2d5e3a58 Auto merge of #112910 - lqd:mcp510, r=petrochenkov
Implement most of MCP510

This implements most of what remains to be done for MCP510:
- turns `-C link-self-contained` into a `+`/`-` list of components, like `-C link-self-contained=+linker,+crto,+libc,+unwind,+sanitizers,+mingw`. The scaffolding is present for all these expected components to be implemented and stabilized in the future on their own time. This PR only handles the `-Zgcc-ld=lld` subset of these link-self-contained components as  `-Clink-self-contained=+linker`
- handles  `-C link-self-contained=y|n`  as-is today, for compatibility with `rustc_codegen_ssa:🔙🔗:self_contained`'s [explicit opt-in and opt-out](9eee230cd0/compiler/rustc_codegen_ssa/src/back/link.rs (L1671-L1676)).
- therefore supports our plan to opt out of `rust-lld` (when it's enabled by default) even for current `-Clink-self-contained` users, with e.g. `-Clink-self-contained -Clink-self-contained=-linker`
- turns `add_gcc_ld_path` into its expected final form, by using the `-C link-self-contained=+linker`  CLI flag, and whether the `LinkerFlavor`  has the expected `Cc::Yes` and `Lld::Yes` shape (this is not yet the case in practice for any CLI linker flavor)
- makes the [new clean linker flavors](https://github.com/rust-lang/rust/pull/96827#issuecomment-1208441595) selectable in the CLI in addition to the legacy ones, in order to opt-in to using `cc` and `lld` to emulate `-Zgcc-ld=lld`
- ensure the new `-C link-self-contained` components, and `-C linker-flavor`s are unstable, and require `-Z unstable-options` to be used

The up-to-date set of flags for the future stable CLI version of `-Zgcc-ld=lld` is currently: `-Clink-self-contained=+linker -Clinker-flavor=gnu-lld-cc -Zunstable-options`.

It's possible we'll also need to do something for distros that don't ship `rust-lld`, but maybe there are already no tool search paths to be added to `cc` in this situation anyways.

r? `@petrochenkov`
2023-07-02 02:25:01 +00:00
yukang
361df86a8d Use scoped-tls for SMIR to map between TyCtxt and SMIR datastructures 2023-07-02 07:48:41 +08:00
Nilstrieb
4be84771a7 Put FnAbiError behind reference to shrink result
The `FnAbi` is just a pointer, so the error type should not be bigger.
2023-07-01 21:16:27 +02:00
Nilstrieb
3019c1cb2a Put LayoutError behind reference to shrink result
`LayoutError` is 24 bytes, which is bigger than the `Ok` types, so let's
shrink that.
2023-07-01 21:16:25 +02:00
Nilstrieb
e43ec03968 Update chalk 2023-07-01 18:03:36 +02:00
Urgau
908574b5e7 Fix dropping_copy_types lint from linting in match-arm with side-effects 2023-07-01 16:05:55 +02:00
bors
5633798af6 Auto merge of #113229 - matthiaskrgr:rollup-gunqun4, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #113168 (fix(resolve): skip assertion judgment when NonModule is dummy)
 - #113174 (Better messages for next on a iterator inside for loops)
 - #113182 (Error when RPITITs' hidden types capture more lifetimes than their trait definitions)
 - #113196 (Fix associated items effective visibility calculation for type privacy lints)
 - #113226 (Fix try builds on the msvc builder)
 - #113227 (Update cargo)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-01 12:06:23 +00:00
Matthias Krüger
bcd804ba52
Rollup merge of #113196 - Bryanskiy:assoc_item, r=petrochenkov
Fix associated items effective visibility calculation for type privacy lints

Fixes https://github.com/rust-lang/rust/pull/113126#discussion_r1246555520.
2023-07-01 13:46:02 +02:00
Matthias Krüger
ca7e27a71c
Rollup merge of #113182 - compiler-errors:rpit-stricter-captures, r=oli-obk
Error when RPITITs' hidden types capture more lifetimes than their trait definitions

This implements a stricter set of captures rules for RPITITs. They now may only capture:
1. Lifetimes from the impl header (both the self type and any trait substs -- we may want to restrict just to the self type's lifetimes, but the PR makes that easy to do, too)
2. Lifetimes mentioned by the `impl Trait` in the trait method's definition.

Namely, they may not mention lifetimes from the method (early or late) that are not mentioned in the `impl Trait`.

cc #105258 which I think was trying to do this too, though I'm not super familiar with what exactly differs from that or why that one was broken.
cc #112194 (doesn't fix this issue per se, because it's still an open question, but I think this is objectively better than the status quo, and gets us closer to resolving that issue.)

Technically is a fix for the ICE in #108580, but it turns that issue into an error now. We can decide separately whether or not nested RPITITs should capture lifetimes from their parents.

r? ``@oli-obk``
2023-07-01 13:46:01 +02:00
Matthias Krüger
9082287213
Rollup merge of #113174 - chenyukang:yukang-fix-102972-loop-next, r=compiler-errors
Better messages for next on a iterator inside for loops

Fixes #102972
2023-07-01 13:46:01 +02:00
Matthias Krüger
b63bc0645f
Rollup merge of #113168 - bvanjoi:fix-85992, r=petrochenkov
fix(resolve): skip assertion judgment when NonModule is dummy

Fixes #85992

## Why #85992 panic

During `resolve_imports`, the `path_res` of the import `issue_85992_extern_2::Outcome` is pointing to `external::issue_85992_extern_2` instead of `crate::issue_85992_extern_2`. As a result `import.imported_module.set` had been executed.

Attached 1: the state of `early_resolve_ident_in_lexical_scope` during the `resolve_imports` for `use issue_85992_extern_2::Outcome` is as follows:

|iter in `visit_scopes`  | `scope` | `result.binding` |
| -    | -               | -                                                            |
| init | -               | -                                                            |
| 0    | `CrateRoot`     | Err(Determined)     |
| 1    | `ExternPrelude` | pointing to the `issue_85992_extern_2`(external) |

However, during finalization for `issue_85992_extern_2::Outcome`, the `innermost_result` was pointed to `crate::issue_85992_extern_2` and no ambiguity was generated, leading to a panic.

Attached 2: the state of `early_resolve_ident_in_lexical_scope` during the `finalize_import` for `use issue_85992_extern_2::Outcome` is as follows:

|iter in `visit_scopes`  | `scope` | `result.binding` | `innermost_result` |
| -    | -               | -                                                            | -                     |
| init | -               | -                                                            | `None`                |
| 0    | `CrateRoot`     | pointing to `use crate::issue_85992_extern_2` **(introdcued by dummy)**    | same as `result` but with a `Some` wapper|
| 1    | `ExternPrelude` | pointing to the `issue_85992_extern_2`(external) | smae as above |

## Try to solve

Skip assertion judgment when `NonModule` is dummy

r? `@petrochenkov`
2023-07-01 13:46:00 +02:00
bors
7905eff5f7 Auto merge of #112550 - loongarch-rs:fix-eflags, r=cjgillot
loongarch: Fix ELF header flags

This patch changes the ELF header flags so that the ABI matches the floating-point features. It also updates the link to the new official documentation.
2023-07-01 09:31:35 +00:00
bohan
549f48d0ed fix(resolve): skip assertion judgment when NonModule is dummy 2023-07-01 11:53:31 +08:00
bors
7383ab7378 Auto merge of #113154 - lcnr:better-probe-check, r=compiler-errors
change snapshot tracking in fulfillment contexts

use the exact snapshot number to prevent misuse even when created inside of a snapshot
2023-07-01 01:53:10 +00:00
Matthias Krüger
e1165300e8
Rollup merge of #113187 - compiler-errors:local-ty, r=b-naber
No need to distinguish `LocalTy` from `Ty`

I think the distinction between `decl_ty` and `revealed_ty` was from when you were allowed to put `impl Trait` in let bindings... I don't think we need that anymore, and it makes typeck that much more confusing 😆

Side-note: I don't know why we store this in a separate field [`locals`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_typeck/struct.Inherited.html#structfield.locals) in `Inherited`, rather than just the `TypeckResults`... Might look into changing that next.
2023-07-01 00:35:06 +02:00
Rémy Rakic
38dca73456 require -Zunstable-options to use new link-self-contained values and
linker flavors

- only the stable values for `-Clink-self-contained` can be used on stable until we
have more feedback on the interface
- `-Zunstable-options` is required to use unstable linker flavors
2023-06-30 21:11:42 +00:00
Rémy Rakic
051e94d50e implement -C linker-flavor modern flavors 2023-06-30 21:10:12 +00:00