Commit Graph

26632 Commits

Author SHA1 Message Date
León Orell Valerian Liehr
0ca432844c
Check lazy type aliases for well-formedness 2023-07-30 11:24:15 +02:00
bors
fb53384c94 Auto merge of #114226 - matthiaskrgr:rollup-wxdudsm, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #114129 (Rustdoc small cleanups)
 - #114152 ([rustc][data_structures] Simplify binary_search_slice.)
 - #114222 (Mark `lazy_type_alias` as incomplete)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-30 00:41:35 +00:00
Matthias Krüger
d4926b13aa
Rollup merge of #114222 - compiler-errors:lazy-type-alias-is-incomplete, r=oli-obk
Mark `lazy_type_alias` as incomplete

This feature is very not complete: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AF-lazy_type_alias

r? types
2023-07-30 01:22:43 +02:00
Matthias Krüger
b8895980bc
Rollup merge of #114152 - ttsugriy:master, r=WaffleLapkin
[rustc][data_structures] Simplify binary_search_slice.

Instead of using `binary_search_by_key`, it's possible to use `partition_point` to find the lower bound. This avoids the need to locate the leftmost matching entry separately.

It's also possible to use `partition_point` to find the upper bound, so I plan to send a separate PR for your consideration.
2023-07-30 01:22:42 +02:00
Michael Goulet
744e770939 some nits, bless test 2023-07-29 21:29:03 +00:00
Michael Goulet
50d21091ee Implement assumed_wf_types for RPITITs' implementations 2023-07-29 21:19:33 +00:00
Michael Goulet
349a2372ed Take RPITITs inherit the assumed_wf_types of their parent fn 2023-07-29 21:19:33 +00:00
Michael Goulet
4b58ae0bb8 Mark lazy_type_alias as incomplete 2023-07-29 19:47:15 +00:00
bors
03a57254b5 Auto merge of #114156 - calebzulawski:simd-bswap, r=compiler-errors
Add simd_bswap, simd_bitreverse, simd_ctlz, and simd_cttz intrinsics

cc `@workingjubilee`
2023-07-29 18:51:45 +00:00
bors
a04e649c09 Auto merge of #114028 - Centri3:ternary-operator, r=compiler-errors
Gracefully handle ternary operator

Fixes #112578

~~May not be the best way to do this as it doesn't check for a single `:`, so it could perhaps appear even when the actual issue is just a missing semicolon. May not be the biggest deal, though?~~

Nevermind, got it working properly now ^^
2023-07-29 16:45:29 +00:00
bors
4c96822796 Auto merge of #114148 - cuviper:drop-llvm-14, r=nikic
Update the minimum external LLVM to 15

With this change, we'll have stable support for LLVM 15 through 17 (pending release).
For reference, the previous increase to LLVM 14 was #107573.
2023-07-29 14:57:47 +00:00
Taras Tsugrii
31fadf621b [rustc][data_structures] Simplify binary_search_slice. 2023-07-29 07:22:56 -07:00
bors
f9f674f2bc Auto merge of #114150 - clubby789:improve-option-ref-suggestion, r=WaffleLapkin
Refactor + improve diagnostics for `&mut T`/`T` mismatch inside Option/Result

Follow up to #114052. This also makes the diagnostics structured + translatable.

r? `@WaffleLapkin`
2023-07-29 13:15:56 +00:00
bors
04411507be Auto merge of #113422 - Urgau:cast_ref_to_mut-pre-beta, r=Nilstrieb
Rename and allow `cast_ref_to_mut` lint

This PR is a small subset of https://github.com/rust-lang/rust/pull/112431, that is the renaming of the lint (`cast_ref_to_mut` -> `invalid_reference_casting`).

BUT also temporarily change the default level of the lint from deny-by-default to allow-by-default until https://github.com/rust-lang/rust/pull/112431 is merged.

r? `@Nilstrieb`
2023-07-29 07:48:44 +00:00
bors
2dc661037d Auto merge of #113099 - bvanjoi:fix-112713-2, r=petrochenkov
fix(resolve): update the ambiguity glob binding as warning recursively

Fixes #47525
Fixes #56593, but `issue-56593-2.rs` is not fixed to ensure backward compatibility.
Fixes #98467
Fixes #105235
Fixes #112713

This PR had added a field called `warn_ambiguous` in `NameBinding` which is only for back compatibly reason and used for lint.

More details: https://github.com/rust-lang/rust/pull/112743

r? `@petrochenkov`
2023-07-29 06:04:41 +00:00
bors
5ed61a4378 Auto merge of #114197 - matthiaskrgr:rollup-iluf7u4, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #113773 (Don't attempt to compute layout of type referencing error)
 - #114107 (Prevent people from assigning me as a PR reviewer)
 - #114124 (tests/ui/proc-macro/*: Migrate FIXMEs to check-pass)
 - #114171 (Fix switch-stdout test for none unix/windows platforms)
 - #114172 (Fix issue_15149 test for the SGX target)
 - #114173 (btree/map.rs: remove "Basic usage" text)
 - #114174 (doc: replace wrong punctuation mark)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-29 04:18:46 +00:00
Matthias Krüger
5dee519386
Rollup merge of #113773 - compiler-errors:err-layout-bail, r=cjgillot
Don't attempt to compute layout of type referencing error

Leads to more ICEs and strange diagnostics than are worth it.

Fixes #113760
2023-07-29 06:13:05 +02:00
bors
4734ac0943 Auto merge of #111916 - fee1-dead-contrib:noop-method-call-warn, r=compiler-errors
make `noop_method_call` warn by default

r? `@compiler-errors`
2023-07-29 01:40:50 +00:00
bors
ca1f813cc3 Auto merge of #114181 - matthiaskrgr:rollup-14m8s7f, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #114099 (privacy: no nominal visibility for assoc fns )
 - #114128 (When flushing delayed span bugs, write to the ICE dump file even if it doesn't exist)
 - #114138 (Adjust spans correctly for fn -> method suggestion)
 - #114146 (Skip reporting item name when checking RPITIT GAT's associated type bounds hold)
 - #114147 (Insert RPITITs that were shadowed by missing ADTs that resolve to [type error])
 - #114155 (Replace a lazy `RefCell<Option<T>>` with `OnceCell<T>`)
 - #114164 (Add regression test for `--cap-lints allow` and trait bounds warning)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-28 23:53:12 +00:00
León Orell Valerian Liehr
8c390286e4
Type-check generic const items 2023-07-28 22:21:41 +02:00
León Orell Valerian Liehr
da17134be0
Resolve generic const items 2023-07-28 22:21:41 +02:00
León Orell Valerian Liehr
9213aec762
Lower generic const items to HIR 2023-07-28 22:21:40 +02:00
León Orell Valerian Liehr
afd009a8d8
Parse generic const items 2023-07-28 22:21:33 +02:00
Matthias Krüger
048794d624
Rollup merge of #114155 - Zalathar:once-cell, r=lcnr
Replace a lazy `RefCell<Option<T>>` with `OnceCell<T>`

This code was using `RefCell<Option<T>>` to manually implement lazy initialization. Now that we have `OnceCell` in the standard library, we can just use that instead.

In particular, this avoids a confusing doubly-nested option, because the value being lazily computed is itself an `Option<Symbol>`.
2023-07-28 19:51:16 +02:00
Matthias Krüger
76f0a8c30c
Rollup merge of #114147 - compiler-errors:missing-rpitits, r=spastorino
Insert RPITITs that were shadowed by missing ADTs that resolve to [type error]

Comment inline explains how this can happen.

Fixes #113903
2023-07-28 19:51:16 +02:00
Matthias Krüger
06eebbe6e7
Rollup merge of #114146 - compiler-errors:dont-report-rpitit-name, r=spastorino
Skip reporting item name when checking RPITIT GAT's associated type bounds hold

Doesn't really make sense to label an item that has a name that users can't really mention. Fixes #114145. Also fixes #113794.

r? `@spastorino`
2023-07-28 19:51:15 +02:00
Matthias Krüger
3aa8da1474
Rollup merge of #114138 - compiler-errors:bad-rcvr-span-on-method-sugg, r=estebank
Adjust spans correctly for fn -> method suggestion

Fixes #114131
2023-07-28 19:51:15 +02:00
Matthias Krüger
02f1e2ada7
Rollup merge of #114128 - estebank:delayed-span-bug-dump, r=davidtwco
When flushing delayed span bugs, write to the ICE dump file even if it doesn't exist

Fix #113881.
2023-07-28 19:51:15 +02:00
Matthias Krüger
a1fb86144d
Rollup merge of #114099 - davidtwco:issue-113860-staged-api-effective-vis-gt-nominal-vis-when-trait-method-vis, r=petrochenkov
privacy: no nominal visibility for assoc fns

Fixes #113860.

When `staged_api` is enabled, effective visibilities are computed earlier and this can trigger an ICE in some cases.

In particular, if a impl of a trait method has a visibility then an error will be reported for that, but when privacy invariants are being checked, the effective visibility will still be greater than the nominal visbility and that will trigger a `span_bug!`.

However, this invariant - that effective visibilites are limited to nominal visibility - doesn't make sense for associated functions.
2023-07-28 19:51:14 +02:00
bohan
cac0bd0bef fix(resolve): update the ambiguity glob binding as warning recursively 2023-07-29 00:19:50 +08:00
bors
317ec04d18 Auto merge of #111780 - weiznich:diagnostic_namespace, r=petrochenkov
Diagnostic namespace

This PR implements the basic infrastructure for accepting the `#[diagnostic]` attribute tool namespace as specified in https://github.com/rust-lang/rfcs/pull/3368. Note: This RFC is not merged yet, but it seems like it will be accepted soon. I open this PR early on to get feedback on the actual implementation as soon as possible. This hopefully enables getting at least the diagnostic namespace to stable rust "soon", so that crates do not need to bump their MSRV if we stabilize actual attributes in this namespace.

 This PR only adds infrastructure accept attributes from this namespace, it does not add any specific attribute. Therefore the compiler will emit a lint warning for each attribute that's actually used. This namespace is added behind a feature flag, so it will be only available on a nightly compiler for now.

cc `@estebank` as they've supported me in planing, specifying and implementing this feature.
2023-07-28 14:18:29 +00:00
Caleb Zulawski
ce4a48f41f Use i1 instead of bool 2023-07-28 09:46:16 -04:00
David Wood
e051a32311
privacy: no nominal visibility for assoc fns
When `staged_api` is enabled, effective visibilities are computed earlier
and this can trigger an ICE in some cases.

In particular, if a impl of a trait method has a visibility then an error
will be reported for that, but when privacy invariants are being checked,
the effective visibility will still be greater than the nominal visbility
and that will trigger a `span_bug!`.

However, this invariant - that effective visibilites are limited to
nominal visibility - doesn't make sense for associated functions.

Signed-off-by: David Wood <david@davidtw.co>
2023-07-28 14:28:02 +01:00
bors
b95fd857fe Auto merge of #114119 - nnethercote:opt-TokenKind-clone, r=petrochenkov
Optimize `TokenKind::clone`.

`TokenKind` would impl `Copy` if it weren't for
`TokenKind::Interpolated`. This commit makes `clone` reflect that.

r? `@ghost`
2023-07-28 12:30:27 +00:00
Georg Semmler
5b576665e5
Introduce the #[diagnostic] attribute namespace
Co-authored-by: est31 <est31@users.noreply.github.com>

Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>

Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2023-07-28 13:28:02 +02:00
bors
e4c98caffe Auto merge of #113312 - Ddystopia:auto-trait-fun, r=lcnr
discard default auto trait impls if explicit ones exist (rebase of #85048)

Rebase of #85048
2023-07-28 10:41:00 +00:00
Oleksandr Babak
37159345a7
Change the description of SUSPICIOUS_AUTO_TRAIT_IMPLS 2023-07-28 11:50:10 +02:00
bors
aafd75a9c5 Auto merge of #114134 - fee1-dead-contrib:rm-constness-from-param-env, r=oli-obk
Remove `constness` from `ParamEnv`

This should be replaced by keyword generics/effects. cc #110395

r? `@oli-obk`
2023-07-28 08:53:12 +00:00
Caleb Zulawski
4c02b4cf4c Add SIMD bitreverse, ctlz, cttz intrinsics 2023-07-27 23:53:45 -04:00
Caleb Zulawski
3ea0e6e3fb Add simd_bswap intrinsic 2023-07-27 23:04:14 -04:00
Zalathar
8745fdc448 Replace a lazy RefCell<Option<T>> with OnceCell<T> 2023-07-28 12:55:13 +10:00
bors
0699d99516 Auto merge of #114115 - nnethercote:less-token-tree-cloning, r=petrochenkov
Less `TokenTree` cloning

`TokenTreeCursor` has this comment on it:
```
// FIXME: Many uses of this can be replaced with by-reference iterator to avoid clones.
```
This PR completes that FIXME. It doesn't have much perf effect, but at least we now know that.

r? `@petrochenkov`
2023-07-28 01:21:27 +00:00
clubby789
fafc3d2d0e Handle exclusive refs in suggestion to copy/clone 2023-07-27 23:13:26 +00:00
clubby789
683b2656bf Refactor suggest_copied_cloned_or_as_ref 2023-07-27 23:13:25 +00:00
Michael Goulet
a4ac773f62 Insert RPITITs that were shadowed by missing ADTs that resolve to type error 2023-07-27 22:32:58 +00:00
Michael Goulet
bf38111ac1 tighten span slightly for synthetic item 2023-07-27 22:20:32 +00:00
Michael Goulet
0ae0643a53 Skip reporting item name when checking RPITIT GAT's associated type bounds hold 2023-07-27 22:09:44 +00:00
Josh Stone
190ded8443 Update the minimum external LLVM to 15 2023-07-27 14:07:08 -07:00
Jubilee
b457992130
Rollup merge of #114139 - Urgau:make-print-with-path-unstable, r=jackh726
Make `--print` with path unstable

https://github.com/rust-lang/rust/pull/113780 should have gone through an MCP+FCP but wasn't, but instead of reverting the original PR, this PR just make that new option unstable.

[Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202023-07-27/near/379199738)
cc `@dtolnay`
2023-07-27 13:22:07 -07:00
Michael Goulet
d45eb41c50 Dont report CTFE errors that are due to references-error layouts 2023-07-27 18:51:44 +00:00