Commit Graph

243532 Commits

Author SHA1 Message Date
bors
65b323b168 Auto merge of #119837 - matthiaskrgr:rollup-l2olpad, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #115046 (Use version-sorting for all sorting)
 - #118915 (Add some comments, add `can_define_opaque_ty` check to `try_normalize_ty_recur`)
 - #119006 (Fix is_global special address handling)
 - #119637 (Pass LLVM error message back to pass wrapper.)
 - #119715 (Exhaustiveness: abort on type error)
 - #119763 (Cleanup things in and around `Diagnostic`)
 - #119788 (change function name in comments)
 - #119790 (Fix all_trait* methods to return all traits available in StableMIR)
 - #119803 (Silence some follow-up errors [1/x])
 - #119804 (Stabilize mutex_unpoison feature)
 - #119832 (Meta: Add project const traits to triagebot config)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-11 02:10:34 +00:00
Matthias Krüger
1189d230bd
Rollup merge of #119832 - fmease:project-const-traits-triagebot, r=compiler-errors
Meta: Add project const traits to triagebot config

r? compiler-errors or project-const-traits
2024-01-11 03:02:44 +01:00
Matthias Krüger
f92cde4f9a
Rollup merge of #119804 - tmccombs:stabilize-unpoison, r=cuviper
Stabilize mutex_unpoison feature

Closes #96469

`@rustbot` +T-libs-api
2024-01-11 03:02:44 +01:00
Matthias Krüger
d37de53425
Rollup merge of #119803 - oli-obk:even_more_follow_up_errors, r=compiler-errors
Silence some follow-up errors [1/x]

this is one piece of the requested cleanups from https://github.com/rust-lang/rust/pull/117449

When we use `-> impl SomeTrait<_>` as a return type, we are both using the "infer return type suggestion" code path, and the infer opaque type code path within the same function. That can lead to confusing diagnostics, so silence all opaque type diagnostics in that case.
2024-01-11 03:02:43 +01:00
Matthias Krüger
d93df41c1d
Rollup merge of #119790 - celinval:smir-all-traits, r=oli-obk
Fix all_trait* methods to return all traits available in StableMIR

Also provide a mechanism to retrieve traits and implementations for a given crate.

This fixes https://github.com/rust-lang/project-stable-mir/issues/37
2024-01-11 03:02:42 +01:00
Matthias Krüger
6238698ab5
Rollup merge of #119788 - mj10021:issue-119787-fix, r=oli-obk
change function name in comments

fixes #119787 where I believe an incorrect function name is used in the comments
2024-01-11 03:02:42 +01:00
Matthias Krüger
88493fca13
Rollup merge of #119763 - nnethercote:cleanup-Diagnostic, r=oli-obk
Cleanup things in and around `Diagnostic`

These changes all arose when I was looking closely at how to simplify `DiagCtxtInner::emit_diagnostic`.

r? `@compiler-errors`
2024-01-11 03:02:41 +01:00
Matthias Krüger
4dcc5a05ea
Rollup merge of #119715 - Nadrieril:graceful-type-error, r=compiler-errors
Exhaustiveness: abort on type error

This adds an error path to exhaustiveness checking so that we abort instead of ICEing when encountering a stray `ty::Error`.

Fixes https://github.com/rust-lang/rust/issues/119493
Fixes https://github.com/rust-lang/rust/issues/119778

r? `@compiler-errors`
2024-01-11 03:02:41 +01:00
Matthias Krüger
b6ef8b6d94
Rollup merge of #119637 - aoli-al:master, r=cuviper
Pass LLVM error message back to pass wrapper.

When rustc fails to load a plugin, it should provide more detailed error message. Before this PR, rustc prints:

```
error: failed to run LLVM passes: Failed to load pass pluginPLUGIN_NAME.so
```

This PR passes LLVM errors back to rustc. After this PR, rustc prints:

```
error: failed to run LLVM passes: Could not load library 'PLUGIN_NAME.so': PLUGIN_NAME.so: undefined symbol: _ZN4llvm9DebugFlagE
```

This PR only contains usability improvements and does not change any functionality. Thus, no new unit test is implemented.
2024-01-11 03:02:40 +01:00
Matthias Krüger
0f2d12ebc1
Rollup merge of #119006 - jstasiak:fix-special-ip-ranges, r=cuviper
Fix is_global special address handling

IANA explicitly documents 192.0.0.9/32, 192.0.0.9/32 and 2001:30::/28 as globally reachable[1][2] and the is_global implementations declare following IANA so let's make this happen.

In case of 2002::/16 IANA says N/A so I think it's safe to say we shouldn't return true from is_global for addresses in that block.

[1] https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
[2] https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
2024-01-11 03:02:40 +01:00
Matthias Krüger
859874f3eb
Rollup merge of #118915 - compiler-errors:alias-nits, r=lcnr
Add some comments, add `can_define_opaque_ty` check to `try_normalize_ty_recur`

Follow-up from #117278, since I was recently re-reviewing this code.
2024-01-11 03:02:39 +01:00
Matthias Krüger
3cc4e02519
Rollup merge of #115046 - joshtriplett:master, r=compiler-errors
Use version-sorting for all sorting

Add a description of a version-sorting algorithm. (This algorithm does
not precisely match `strverscmp`; it's intentionally simpler in its
handling of leading zeroes, and produces a result easier for humans to
easily understand and do by hand.)

Change all references to sorting to use version-sorting.

Change all references to "ASCIIbetically" to instead say "sort
non-lowercase before lowercase".
2024-01-11 03:02:39 +01:00
hi-rustin
784b50cece chore: remove unnecessary blank line
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2024-01-11 09:45:21 +08:00
bors
0a8923361e Auto merge of #119688 - Nadrieril:dont-alloc-custom-wildcards, r=compiler-errors
Exhaustiveness: use an `Option` instead of allocating fictitious patterns

In the process of exhaustiveness checking, `Matrix` stores a 2D array of patterns. Those are subpatterns of the patterns we were provided as input, _except_ sometimes we allocate some extra wildcard patterns to fill a hole during specialization.

Morally though, we could store `Option<&'p DeconstructedPat>` in the matrix, where `None` signifies a wildcard. That way we'd only have "real" patterns in the matrix and we wouldn't need the arena to allocate these wildcards. This is what this PR does.

This is part of me splitting up https://github.com/rust-lang/rust/pull/119581 for ease of review.

r? `@compiler-errors`
2024-01-11 00:04:10 +00:00
Jakub Stasiak
4621357d14 Make is_global/is_unicast_global special address handling complete
IANA explicitly documents 192.0.0.9/32, 192.0.0.9/32 and 2001:30::/28 as
globally reachable[1][2] and the is_global implementations declare
following IANA so let's make this happen.

In case of 2002::/16 IANA says N/A so I think it's safe to say we
shouldn't return true there either.

[1] https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
[2] https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
2024-01-11 01:03:34 +01:00
Nadrieril
5ccd29d6f0 Add more tests 2024-01-10 23:25:27 +01:00
Nadrieril
68a13bf7fd Explain never patterns in resolve 2024-01-10 22:10:08 +01:00
Nicholas Nethercote
dd61eba3c3 Simplify lint error counting.
Of the error levels satisfying `is_error`, `Level::Error` is the only
one that can be a lint, so there's no need to check for it.

(And even if it wasn't, it would make more sense to include
non-`Error`-but-`is_error` lints under `lint_err_count` than under
`err_count`.)
2024-01-11 07:56:20 +11:00
Nicholas Nethercote
56c3265c7b Replace warn_count.
There are four functions that adjust error and warning counts:
- `stash_diagnostic` (increment)
- `steal_diagnostic` (decrement)
- `emit_stashed_diagnostics) (decrement)
- `emit_diagnostic` (increment)

The first three all behave similarly, and only update `warn_count` for
forced warnings. But the last one updates `warn_count` for both forced
and non-forced warnings.

Seems like a bug. How should it be fixed? Well, `warn_count` is only
used in one place: `DiagCtxtInner::drop`, where it's part of the
condition relating to the printing of `good_path_delayed_bugs`. The
intention of that condition seems to be "have any errors been printed?"
so this commit replaces `warn_count` with `has_printed`, which is set
when printing occurs. This is simpler than all the ahead-of-time
incrementing and decrementing.
2024-01-11 07:56:20 +11:00
Nicholas Nethercote
8866780d02 Move DiagCtxtInner::deduplicated_warn_count.
To put it next to a similar field.
2024-01-11 07:56:20 +11:00
Nicholas Nethercote
12ba450d14 Reset lint_err_count in DiagCtxt::reset_err_count.
It's missing but should obviously be included.
2024-01-11 07:56:20 +11:00
Nicholas Nethercote
0e388f2192 Change how force-warn lint diagnostics are recorded.
`is_force_warn` is only possible for diagnostics with `Level::Warning`,
but it is currently stored in `Diagnostic::code`, which every diagnostic
has.

This commit:
- removes the boolean `DiagnosticId::Lint::is_force_warn` field;
- adds a `ForceWarning` variant to `Level`.

Benefits:
- The common `Level::Warning` case now has no arguments, replacing
  lots of `Warning(None)` occurrences.
- `rustc_session::lint::Level` and `rustc_errors::Level` are more
  similar, both having `ForceWarning` and `Warning`.
2024-01-11 07:56:17 +11:00
Nicholas Nethercote
06cf881969 Rename TRACK_DIAGNOSTICS as TRACK_DIAGNOSTIC.
Because the values put into it are functions named `track_diagnostic`
and `default_track_diagnostic`.
2024-01-11 07:55:03 +11:00
Nilstrieb
da26317a8a Stop mentioning internal lang items in no_std binary errors
When writing a no_std binary, you'll be greeted with nonsensical errors
mentioning lang items like eh_personality and start. That's pretty bad
because it makes you think that you need to define them somewhere! But
oh no, now you're getting the `internal_features` lint telling you that
you shouldn't use them! But you need a no_std binary! What now?

No problem! Writing a no_std binary is super easy. Just use panic=abort
and supply your own platform specific entrypoint symbol (like `main`)
and you're good to go. Would be nice if the compiler told you that,
right?

This makes it so that it does do that.
2024-01-10 21:18:54 +01:00
León Orell Valerian Liehr
7d61535ef0
Add project const traits to triagebot config 2024-01-10 20:09:27 +01:00
Eric Huss
f7e8739eac Add debug info for macOS CI actions 2024-01-10 10:54:46 -08:00
bors
a2d9d73e60 Auto merge of #119751 - nnethercote:error-api-fixes, r=oli-obk
Diagnostic API fixes

Some improvements to diagnostic APIs: improve some naming, use shortcuts in more places, and add a couple of missing methods.

r? `@compiler-errors`
2024-01-10 18:03:53 +00:00
Patryk Wychowaniec
76aaf17794
Suggest pub(crate) imports
rust-analyzer has logic that discounts suggesting `use`s for private
imports, but that logic is unnecessarily strict - for instance given
this code:

```rust
mod foo {
    pub struct Foo;
}

pub(crate) use self::foo::*;

mod bar {
    fn main() {
        Foo$0;
    }
}
```

... RA will suggest to add `use crate::foo::Foo;`, which not only makes
the code overly verbose (especially in larger code bases), but also is
disjoint with what rustc itself suggests.

This commit adjusts the logic, so that `pub(crate)` imports are taken
into account when generating the suggestions; considering rustc's
behavior, I think this change doesn't warrant any extra configuration
flag.

Note that this is my first commit to RA, so I guess the approach taken
here might be suboptimal - certainly feels somewhat hacky, maybe there's
some better way of finding out the optimal import path 😅
2024-01-10 18:21:16 +01:00
Michael Goulet
427c55c65c Simplify some redundant names 2024-01-10 16:29:23 +00:00
Michael Goulet
3799568895 More comments 2024-01-10 16:29:23 +00:00
Michael Goulet
f49b0dcce2 Check reveal and can_define_opaque_ty in try_normalize_ty_recur 2024-01-10 16:21:58 +00:00
Simonas Kazlauskas
837be0de5f bootstrap: exclude link_jobs from check_ci_llvm! checks
This option is largely there to help people to manage the memory usage
on their systems during the LLVM build. The linking phase is as usual
are the heaviest part of the build and if in an unlucky conincidence the
circumstances align to kick off N_CORES links at the same time, not even
hundreds of GiB of memory may suffice. It makes a lot of sense for
developers to set&forget this option unconditionally.

Not to mention, this option does not, in any way, affect the generated
code (at least as far as I know.) It really doesn’t matter what
option the CI build LLVM used here and/or if it matches with the user’s
configuration.

Finally, 0 actual link jobs implied by `download-ci-llvm` is guaranteed
to stay within the limits that are reasonable to set with this option.
2024-01-10 17:06:36 +02:00
bors
e4344f5fce Auto merge of #16339 - Veykril:hashmaps, r=Veykril
Replace SourceRootCrates hashset output with slice for deterministic order

We only iterate over the result, and its pretty small in general so no point for the `HashSet` (additionally this way we get a more defined iteration order).
2024-01-10 14:10:10 +00:00
Lukas Wirth
4d3a0dc329 Replace SourceRootCrates hashset output with slice for deterministic order 2024-01-10 14:51:51 +01:00
Nadrieril
dee657f9f9 Add test case for #119778 2024-01-10 14:50:48 +01:00
bors
e5a1118265 Auto merge of #16330 - zheylmun:master, r=Veykril
minor: Mark unresolved associated item diagnostic as experimental

Per #16327 unresolved associated item has false positives.  Mark the diagnostic as experimental until this is more dependable.
2024-01-10 12:10:30 +00:00
Zach
1aff8157bc Set experimental field at diagnostic new instead of lib 2024-01-10 05:58:25 -06:00
bors
b201684982 Auto merge of #16274 - dfireBird:completion_score, r=Veykril
Add notable_trait predicate to `CompletionRelevance`

Given a score of 1 for now, will change as per reviews needed.
2024-01-10 11:16:52 +00:00
dfireBird
257870e09f
add tests to verify relevance of notable traits and some refactors 2024-01-10 16:30:22 +05:30
Thayne McCombs
1ed855dedf Stabilize mutex_unpoison feature
Closes #96469

@rustbot +T-libs-api
2024-01-10 02:34:34 -07:00
bors
1c9bb31970 Auto merge of #16209 - l1nxy:add-merge-nested-if, r=Veykril
feat: assist to merge nested if

resolve: #16095
2024-01-10 09:18:05 +00:00
bors
00eb8ce41e Auto merge of #16271 - Veykril:gate-proc-macro-test, r=Veykril
Remove sysroot-abi feature flag from proc-macro-test

Closes https://github.com/rust-lang/rust-analyzer/issues/16194
2024-01-10 09:05:00 +00:00
Lukas Wirth
4b7b602da9 Remove sysroot-abi feature flag from proc-macro-test 2024-01-10 09:53:12 +01:00
Oli Scherer
0e82aaeb67 Avoid follow up errors 2024-01-10 08:52:44 +00:00
Oli Scherer
972c95a6e2 Turn some free functions into methods 2024-01-10 08:52:44 +00:00
Oli Scherer
ba27e22f67 Use a ty::Error instead of patching up a type after erroring 2024-01-10 08:52:44 +00:00
Nikita Popov
9ff3083b27 Update LLVM submodule 2024-01-10 09:35:29 +01:00
bors
5871b61c0d Auto merge of #16333 - roife:fix/issue-14371, r=Veykril
Preserve comments for extracted block expression in 'extract_function'

Fix #14371

Preserve comments for extracted block expression in 'extract_function'.

In the original implementation, `block.statements()` was used to construct a new function, removing the comments within the block. In the updated implementation, we use manual traversal of nodes and `hacky_block_expr` to generate a new block, thereby preserving the comments.
2024-01-10 08:09:38 +00:00
bors
f31b1fc617 Auto merge of #16334 - Veykril:salsa, r=Veykril
Bump salsa
2024-01-10 07:49:27 +00:00
Lukas Wirth
9c2d331e16 Bump salsa 2024-01-10 08:47:26 +01:00