Commit Graph

243728 Commits

Author SHA1 Message Date
Camille GILLOT
c6f83b8ff6 Inline 2 functions that appear in dep-graph profiles. 2024-01-14 12:57:13 +00:00
León Orell Valerian Liehr
5788f3d350
Remove Zulip rustdoc nomination alert 2024-01-14 13:55:18 +01:00
bors
8847bda592 Auto merge of #119361 - sjwang05:issue-119352, r=WaffleLapkin
Fix ICE when suggesting dereferencing binop operands

Fixes #119352
2024-01-14 09:39:03 +00:00
bors
0dab65b8a1 Auto merge of #119934 - compiler-errors:could-impl, r=jackh726
Make `InferCtxtExt::could_impl_trait` more precise, less ICEy

The implementation for `InferCtxtExt::could_impl_trait` was very wrong. Along with being pretty poorly named, way too specific to ADTs, it was also doing impl substitution wrong -- this caused an ICE (#119915).

This PR generalizes that code, gives it a clearer name, makes it stop using the new trait solver (lol), and fixes some fallout bad suggestions that are made worse with the code fix.

Fixes #119915
2024-01-14 06:37:15 +00:00
bors
aa5f781bd4 Auto merge of #119341 - sjwang05:issue-58462, r=WaffleLapkin
Suggest quoting unquoted idents in attrs

Closes #58462
2024-01-14 04:37:45 +00:00
Nicholas Nethercote
d71f535a6f Rework how diagnostic lints are stored.
`Diagnostic::code` has the type `DiagnosticId`, which has `Error` and
`Lint` variants. Plus `Diagnostic::is_lint` is a bool, which should be
redundant w.r.t. `Diagnostic::code`.

Seems simple. Except it's possible for a lint to have an error code, in
which case its `code` field is recorded as `Error`, and `is_lint` is
required to indicate that it's a lint. This is what happens with
`derive(LintDiagnostic)` lints. Which means those lints don't have a
lint name or a `has_future_breakage` field because those are stored in
the `DiagnosticId::Lint`.

It's all a bit messy and confused and seems unintentional.

This commit:
- removes `DiagnosticId`;
- changes `Diagnostic::code` to `Option<String>`, which means both
  errors and lints can straightforwardly have an error code;
- changes `Diagnostic::is_lint` to `Option<IsLint>`, where `IsLint` is a
  new type containing a lint name and a `has_future_breakage` bool, so
  all lints can have those, error code or not.
2024-01-14 14:04:25 +11:00
Zalathar
5eae9452b6 coverage: Simplify computing successors in the BCB graph 2024-01-14 12:11:26 +11:00
Zalathar
867950f8c6 coverage: Move helper add_basic_coverage_block into a local closure
This also switches from `split_off(0)` to `std::mem::take` when emptying the
accumulated list of blocks, because `split_off(0)` handles capacity in a way
that is unintuitive when used in a loop.
2024-01-14 12:11:25 +11:00
Zalathar
229d0983b5 coverage: Simplify the loop that combines blocks into BCBs
The old loop had two separate places where it would flush the acumulated list
of straight-line blocks into a new BCB. One occurred at the start of the loop
body when the current block couldn't be chained into, and the other occurred at
the end of the loop body when the current block couldn't be chained from.

The latter check can be hoisted to the start of the loop body by making it
examine the previous block (which has added itself to the list) instead of the
current block. With that done, we can combine the two separate flushes into one
flush with two possible trigger conditions.
2024-01-14 12:11:25 +11:00
Zalathar
c412cd4bc2 coverage: Indicate whether a block's successors allow BCB chaining 2024-01-14 12:11:25 +11:00
Zalathar
6d1c396399 coverage: Determine a block's successors from just the terminator
Filtering out unreachable successors is only needed by the main graph traversal
loop, so we can move the filtering step into that loop instead, eliminating the
need to pass the MIR body into `bcb_filtered_successors`.
2024-01-14 12:11:25 +11:00
clubby789
4ca6342eb3 Add note on SpecOptionPartialEq to newtype_index 2024-01-14 00:24:39 +00:00
Michael Goulet
985e1e031b Add a simpler test 2024-01-13 23:09:37 +00:00
Michael Goulet
24c1f4aa80 Make sure to instantiate placeholders correctly in old solver 2024-01-13 22:57:44 +00:00
Nicholas Nethercote
2de99ec787 Reformat struct_span_code_err!. 2024-01-14 09:46:02 +11:00
bors
3deb9bbf84 Auto merge of #119945 - matthiaskrgr:rollup-oy3e1j2, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #119189 (Move section "Installing from Source" to seperate file)
 - #119925 (store the segment name when resolution fails)
 - #119935 (Move personality implementation out of PAL)
 - #119937 (Improve UEFI target docs)
 - #119938 (Allow unauthorized users to user the has-merge-commits label)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-13 22:05:46 +00:00
Michael Goulet
7724ba7bd5 assert that trait solver is only created in proper infcx 2024-01-13 22:00:35 +00:00
Michael Goulet
04a6fd241b Make InferCtxtExt::could_impl_trait less messed up 2024-01-13 22:00:34 +00:00
Matthias Krüger
847aad75ad
Rollup merge of #119938 - Nilstrieb:has-merge-commits-unauthenticated, r=fmease
Allow unauthorized users to user the has-merge-commits label

So they can remove it after they've removed the merge commit.
2024-01-13 22:35:10 +01:00
Matthias Krüger
f7a76a9d0b
Rollup merge of #119937 - nicholasbishop:bishop-uefi-doc-improve, r=ehuss
Improve UEFI target docs

* Add a section showing exactly how to build a driver instead of an application
* Add links to the crates mentioned in the doc

CC `@dvdhrm`
2024-01-13 22:35:10 +01:00
Matthias Krüger
3a33a4b8f5
Rollup merge of #119935 - joboet:move_pal_personality, r=ChrisDenton
Move personality implementation out of PAL

The module already follows the new convention described in #117276. This PR also includes a small fix in the tidy pal check, that was just an oversight in #117285.
2024-01-13 22:35:09 +01:00
Matthias Krüger
70bc26d0e7
Rollup merge of #119925 - bvanjoi:fix-112672, r=Nilstrieb
store the segment name when resolution fails

Fixes #112672

The `find_cfg_stripped` does indeed get executed within `smart_resolve_report_errors`. However, this error is not reported as it is subsequently overridden by `parent_err`. (See: https://github.com/rust-lang/rust/blob/master/compiler/rustc_resolve/src/late.rs#L3760)

This PR changes `last_segment` to `segment`, which stores the name of the failed resolution, and ensures that the result of `find_cfg_stripped` is also included in `parent_err`.

r? ```@Nilstrieb```
2024-01-13 22:35:08 +01:00
Matthias Krüger
0bbc88809d
Rollup merge of #119189 - henrispriet:move-installing-from-source, r=Mark-Simulacrum
Move section "Installing from Source" to seperate file

cc #118627
2024-01-13 22:35:08 +01:00
Michael Goulet
0b45ff5dac Don't ICE when noting GAT bounds in report_no_match_method_error 2024-01-13 20:55:54 +00:00
bors
d78329b92e Auto merge of #119088 - George-lewis:glewis/suggest-upgrading-compiler, r=Nilstrieb
Suggest Upgrading Compiler for Gated Features

This PR addresses #117318

I have a few questions:

1. Do we want to specify the current version and release date of the compiler? I have added this in via environment variables, which I found in the code for the rustc cli where it handles the `--version` flag
  a. How can I handle the changing message in the tests?
3. Do we want to only show this message when the compiler is old?
  a. How can we determine when the compiler is old?

I'll wait until we figure out the message to bless the tests
2024-01-13 20:06:03 +00:00
Nilstrieb
ff84ecd68c
Allow unauthorized users to user the has-merge-commits label
So they can remove it after they've removed the merge commit.
2024-01-13 19:49:39 +01:00
Nicholas Bishop
3402f0741a Add doc and example for building a UEFI driver 2024-01-13 13:09:57 -05:00
Nicholas Bishop
074220296d Add crate links to unknown-uefi.md 2024-01-13 13:09:00 -05:00
bors
23148b175b Auto merge of #119409 - Kobzol:rustc-codegen-ssa-query-instability, r=Nilstrieb
rustc_codegen_ssa: Enforce `rustc::potential_query_instability` lint

Part of https://github.com/rust-lang/rust/issues/84447.
2024-01-13 18:07:59 +00:00
George-lewis
d56cdd48cb Bless tests
Update tests
2024-01-13 12:46:58 -05:00
joboet
b8d996c09e
tidy: allow platform-dependent code in sys 2024-01-13 18:36:47 +01:00
joboet
cb052d57b3
std: move personality implementation out of PAL 2024-01-13 18:30:44 +01:00
George-lewis
9f327a2385 Add todo comment 2024-01-13 12:11:13 -05:00
George-lewis
36a69e9d39 Add check for ui_testing via promoting parameters from ParseSess to Session 2024-01-13 12:11:13 -05:00
George-lewis
b55faad314 Add suggestion to upgrade the compiler 2024-01-13 12:11:12 -05:00
henrispriet
994d11ace9 Move section "Installing from Source" to seperate file 2024-01-13 17:22:55 +01:00
Urgau
41b69aae91 Add way to express no-values with check-cfg 2024-01-13 17:19:46 +01:00
bors
c6c4abf584 Auto merge of #119927 - matthiaskrgr:rollup-885ws57, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #119587 (Varargs support for system ABI)
 - #119891 (rename `reported_signature_mismatch` to reflect its use)
 - #119894 (Allow `~const` on associated type bounds again)
 - #119896 (Taint `_` placeholder types in trait impl method signatures)
 - #119898 (Remove unused `ErrorReporting` variant from overflow handling)
 - #119902 (fix typo in `fn()` docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-13 16:09:45 +00:00
Michael Woerister
ac58f9ae03 Update measureme crate to version 11 2024-01-13 16:32:03 +01:00
Jakub Beránek
4612edc53f
rustc_codegen_ssa: Enforce rustc::potential_query_instability lint 2024-01-13 16:05:53 +01:00
bors
1d8d7b16cb Auto merge of #117285 - joboet:move_platforms_to_pal, r=ChrisDenton
Move platform modules into `sys::pal`

This is the initial step of #117276. `sys` just re-exports everything from the current `sys` for now, I'll move the implementations for the individual features one-by-one after this PR merges.
2024-01-13 14:10:56 +00:00
Matthias Krüger
f53caa1106
Rollup merge of #119902 - asquared31415:patch-1, r=the8472
fix typo in `fn()` docs
2024-01-13 15:10:30 +01:00
Matthias Krüger
1037e75d8d
Rollup merge of #119898 - compiler-errors:error-reporting, r=oli-obk
Remove unused `ErrorReporting` variant from overflow handling

r? oli-obk
2024-01-13 15:10:30 +01:00
Matthias Krüger
9696ef7c12
Rollup merge of #119896 - oli-obk:variance_ice, r=compiler-errors
Taint `_` placeholder types in trait impl method signatures

We report an error right below for them, but that kind of broken type can cause subsequent ICEs.

fixes #119867
2024-01-13 15:10:29 +01:00
Matthias Krüger
2c7ce1c453
Rollup merge of #119894 - fmease:tilde-const-assoc-ty-bounds, r=compiler-errors
Allow `~const` on associated type bounds again

This follows from [this Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/419616-t-compiler.2Fproject-const-traits/topic/projections.20on.20.28~.29const.20Trait.20.26.20.28~.29const.20assoc.20ty.20bounds).

Basically in my opinion, it makes sense to allow `~const` on associated type bounds again since they're quite useful even though we haven't implemented the proposed syntax `<Ty as ~const Trait>::Proj`/`<Ty as const Trait>::Proj` yet; that can happen as a follow-up.

This already allows more code to compile since `T::Assoc` where `T` is a type parameter and where the predicate `<T as ~const Trait>` is in the environment gets elaborated to (pseudo) `<T as ~const Trait>::Assoc`.

```rs
#[const_trait]
trait Trait {
    type Assoc: ~const Trait;
    fn func() -> i32;
}

const fn function<T: ~const Trait>() -> i32 {
    T::Assoc::func()
}
```

`~const` associated type bounds also work together with `const` bounds:

```rs
struct Type<const N: i32>;

fn procedure<T: const Trait>() -> Type<{ T::Assoc::func() }> { // `Trait` comes from above
    Type
}
```

NB: This PR also starts allowing `~const` bounds in the generics and the where-clause of trait associated types since it's trivial to support them. However, I don't know if those bounds are actually useful. Maybe we should continue to reject them?
For reference, it wouldn't make any sense to allow `~const Trait` in GACs (generic associated constants, `generic_const_items`) because they'd be absolutely useless (contrary to `const Trait`).

~~[``@]rustbot`` ping project-const-traits~~
r? project-const-traits
2024-01-13 15:10:29 +01:00
Matthias Krüger
e79ccc4582
Rollup merge of #119891 - lcnr:rename-field, r=compiler-errors
rename `reported_signature_mismatch` to reflect its use

it's used for a lot of things, not only closures
2024-01-13 15:10:28 +01:00
Matthias Krüger
7b507db24b
Rollup merge of #119587 - beepster4096:system_varargs, r=petrochenkov
Varargs support for system ABI

This PR allows functions with the `system` ABI to be variadic (under the `extended_varargs_abi_support` feature tracked in #100189). On x86 windows, the `system` ABI is equivalent to `C` for variadic functions. On other platforms, `system` is already equivalent to `C`.

Fixes #110505
2024-01-13 15:10:28 +01:00
bohan
c288cb1f74 store the segment name when resolution fails 2024-01-13 21:06:38 +08:00
joboet
0cfc995814
don't break a good link
Co-authored-by: klensy <klensy@users.noreply.github.com>
2024-01-13 09:18:36 +01:00
bors
284cb714d2 Auto merge of #119871 - nnethercote:overhaul-treat-err-as-bug, r=compiler-errors
Overhaul `-Ztreat-err-as-bug`

It's current behaviour is surprising, in a bad way. This also makes the implementation more complex than it needs to be.

r? `@oli-obk`
2024-01-13 08:15:52 +00:00