Commit Graph

211830 Commits

Author SHA1 Message Date
yukang
3980945ab1 fix #104884, Avoid Invalid code suggested when encountering unsatisfied trait bounds in derive macro code 2022-11-29 12:38:39 +08:00
Matthias Krüger
789b70dc2a
Rollup merge of #105038 - Rageking8:clean-up-pr-104954, r=compiler-errors
Clean up pr 104954

UI test filename typo fix and a simple comment rewording. Thanks.

CC `@vincenzopalazzo` (you spelled your name wrongly in the FIXME)

r? `@estebank`
2022-11-29 05:24:25 +01:00
Matthias Krüger
f6e5448361
Rollup merge of #105027 - aDotInTheVoid:rdj-foreign-variant-test, r=GuillaumeGomez
Rustdoc-Json: Add tests for linking to foreign variants.

I initially taught these would be bugs, but it turn out they work perfectly, and the variant is added to paths.

Most of the work is done by jsondoclint checking all the ID's resolve (although this wont happen for links until #105015, which in turn is blocked on removing foreign traits), but we do check that neither the enum nor the variant is inlined, so it must be resolved correctly through paths.

r? ``@GuillaumeGomez``
2022-11-29 05:24:25 +01:00
Matthias Krüger
0e7f15947e
Rollup merge of #105024 - notriddle:notriddle/fnname, r=jyn514
rustdoc: remove `fnname` CSS class that's styled exactly like `fn`

It's not obvious why this was ever a separate class name, since even in c4219a4783 when it was first added, it was styled identically to regular `fn` links.
2022-11-29 05:24:24 +01:00
Matthias Krüger
219ea9a23f
Rollup merge of #105020 - notriddle:notriddle/rustdoc-toggle, r=GuillaumeGomez
rustdoc: merge background-image rules in rustdoc-toggle CSS
2022-11-29 05:24:24 +01:00
Matthias Krüger
1ad234c3fc
Rollup merge of #105016 - GuillaumeGomez:load-sentence-rustdoc, r=notriddle
Add sentence when rustdoc search is running

This is a small improvement, mostly relevant on big search indexes. As soon as the search starts, it'll display:

![image](https://user-images.githubusercontent.com/3050060/204336014-4660634a-09a0-4d5e-a772-d7e1e810dddf.png)

cc ``@jsha``
r? ``@notriddle``
2022-11-29 05:24:23 +01:00
Matthias Krüger
d5d79ac67b
Rollup merge of #105010 - Neutron3529:patch-2, r=jyn514
Fix documentation of asymptotic complexity for rustc_data_structures::SortedMap

https://users.rust-lang.org/t/is-the-document-in-sortedmap-in-rustc-data-structures-sorted-map-correct/84939

SortedMap have `O(n)` insertions and removal rather than `O(log(n))`
2022-11-29 05:24:23 +01:00
Matthias Krüger
cea2e14ba2
Rollup merge of #104978 - Veykril:patch-2, r=jyn514
notify the rust-analyzer team on changes to the rust-analyzer subtree

As proposed in https://github.com/rust-lang/rust-analyzer/pull/13676#issuecomment-1327621946
2022-11-29 05:24:22 +01:00
Matthias Krüger
e674b34d56
Rollup merge of #104959 - compiler-errors:revert-104269, r=lcnr
Revert #104269 (to avoid spurious hang/test failure in CI)

Causes hangs/memory overflows in the test suite apparently 😢

Reopens #104225
Fixes #104957
r? ``@lcnr``
2022-11-29 05:24:21 +01:00
Matthias Krüger
c81605ca91
Rollup merge of #104951 - Swatinem:async-kind, r=compiler-errors
Simplify checking for `GeneratorKind::Async`

Adds a helper method around `generator_kind` that makes matching async constructs simpler.
2022-11-29 05:24:21 +01:00
Matthias Krüger
8bcb473f0f
Rollup merge of #104465 - djkoloski:improve_fuchsia_testing_docs, r=tmandry
Document more settings for building rustc for Fuchsia

This documents that you need to link for Fuchsia with `lld` and provides configuration settings for both `clang` and `lld`. It also adjusts the documentation for running the test suite to recommend installing to a prefix.

r? ``@tmandry``
2022-11-29 05:24:20 +01:00
bors
1ef685ea39 Auto merge of #105001 - nicholasbishop:bishop-more-uefi-test, r=jyn514
test-various: Add tests for {i686,aarch64}-unknown-uefi

This extends the existing test for x86_64-unknown-uefi to test the other two UEFI targets as well.
2022-11-29 04:20:23 +00:00
Rageking8
c95dceb63a clean up pr 104954 2022-11-29 10:41:21 +08:00
Nicholas Nethercote
a709f87be7 Avoid more unnecessary MetaItem/Attribute conversions.
In `Expander::expand` the code currently uses `mk_attr_outer` to convert
a `MetaItem` to an `Attribute`, and then follows that with
`meta_item_list` which converts back. This commit avoids the unnecessary
conversions.

There was one wrinkle: the existing conversions caused the bogus `<>` on
`Default<>` to be removed. With the conversion gone, we get a second
error message about the `<>`. This is a rare case, so I think it
probably doesn't matter much.
2022-11-29 12:54:45 +11:00
Nicholas Nethercote
fc2a8a0c67 Reorder some types.
So that `Attribute` and `MetaItem` are listed first, and then the
component types are below them in a logical order.
2022-11-29 12:10:34 +11:00
Nicholas Nethercote
5a2fd1a47f Improve comments about attributes and meta items.
I have found the distinction confusing.
2022-11-29 12:09:35 +11:00
Nicholas Nethercote
c9ae38c71e Avoid unnecessary MetaItem/Attribute conversions.
`check_builtin_attribute` calls `parse_meta` to convert an `Attribute`
to a `MetaItem`, which it then checks. However, many callers of
`check_builtin_attribute` start with a `MetaItem`, and then convert it
to an `Attribute` by calling `cx.attribute(meta_item)`. This `MetaItem`
to `Attribute` to `MetaItem` conversion is silly.

This commit adds a new function `check_builtin_meta_item`, which can be
called instead from these call sites. `check_builtin_attribute` also now
calls it. The commit also renames `check_meta` as `check_attr` to better
match its arguments.
2022-11-29 12:08:57 +11:00
bors
60b8fc4cce Auto merge of #104992 - ehuss:docs-triagebot-assign, r=Mark-Simulacrum
Assign myself for docs updates

This sets myself as the reviewer for docs submodule updates. Now with https://github.com/rust-lang/triagebot/pull/1673 automating the process, this piece of the puzzle handles the assignment step.
2022-11-29 00:17:18 +00:00
Arpad Borsos
2db0dc3297
Simplify checking for GeneratorKind::Async
Adds a helper method around `generator_kind` that makes matching async constructs simpler.
2022-11-28 23:12:01 +01:00
bors
2585bcea0b Auto merge of #105017 - matthiaskrgr:rollup-j0x550l, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #104804 (Rename `ast::Lit` as `ast::MetaItemLit`.)
 - #104891 (Add documentation for `has_escaping_bound_vars`)
 - #104933 (interpret: remove PartialOrd from a bunch of types that do not have or need a sensible order)
 - #104936 (Ignore bivariant parameters in test_type_match.)
 - #104954 (make simple check of prinf function)
 - #104956 (Avoid ICE if the Clone trait is not found while building error suggestions)
 - #104982 (interpret: get rid of run() function)
 - #104998 (Update my mailmap)
 - #105006 (stricter alignment enforcement for ScalarPair)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-28 20:53:42 +00:00
Nixon Enraght-Moony
d958f3773a Rustdoc-Json: Add tests for linking to foreign variants. 2022-11-28 19:34:13 +00:00
xFrednet
6bbf16660b
Move index_refutable_slice to pedantic 2022-11-28 20:23:09 +01:00
Maybe Waffle
a44eb3c366 Remove Const::from_scalar_int 2022-11-28 18:04:29 +00:00
Michael Howell
19e0200296 rustdoc: remove fnname CSS class that's styled exactly like fn
It's not obvious why this was ever a separate class name, since even
in c4219a4783 when it was first added,
it was styled identically to regular `fn` links.
2022-11-28 10:51:46 -07:00
Michael Goulet
1e236acd05 Make ObligationCtxt::normalize take cause by borrow 2022-11-28 17:35:40 +00:00
Michael Goulet
a61e2a91f5 FnCtxt normalization stuff 2022-11-28 17:35:39 +00:00
Michael Goulet
ce409b5200 Make normalize and normalize_to pub(crate) 2022-11-28 17:35:39 +00:00
Michael Goulet
82c07f09e5 partially_normalize_... -> At::normalize 2022-11-28 17:35:39 +00:00
Michael Goulet
06786227fd Simplify more FnCtxt normalization 2022-11-28 17:35:39 +00:00
Michael Goulet
52cd342696 FnCtxt normalization stuff 2022-11-28 17:35:39 +00:00
Michael Goulet
fc710832ea partially_normalize_... -> At::normalize 2022-11-28 17:35:39 +00:00
Michael Goulet
f12e772b83 Rename At::normalize to At::query_normalize 2022-11-28 17:32:35 +00:00
Maybe Waffle
b44817f95e Permit deps (scarry) 2022-11-28 17:28:35 +00:00
Maybe Waffle
f4d00fe785 Remove Const::from_value
...it's just `mk_const` but without the sparcles
2022-11-28 17:28:30 +00:00
Tomasz Miąsko
63915be212 Statics used in reachable function's inline asm are reachable 2022-11-28 18:28:05 +01:00
Maybe Waffle
26b87bf8ff Simplify calls to tcx.mk_const
`mk_const(ty::ConstKind::X(...), ty)` can now be simplified to
`mk_cosnt(...,                   ty)`.

I searched with the following regex: \mk_const\([\n\s]*(ty::)?ConstKind\
I've left `ty::ConstKind::{Bound, Error}` as-is, they seem clearer this
way.
2022-11-28 17:27:20 +00:00
Maybe Waffle
7087d9b2a0 Remove tcx.mk_const_var
... `tcx.mk_const` can now be used instead
2022-11-28 17:27:20 +00:00
Maybe Waffle
e20e506f7d Make tcx.mk_const more permissive wrt kind argument
- Accept `impl Into`
- Implement `From<>` for `ConstKind`

Note: this adds a dependency on `derive_more` (MIT license). It allows
to derive a lot of traits (like `From` here) that would be otherwise
tedious to implement.
2022-11-28 17:27:20 +00:00
bors
12074808c7 Auto merge of #9865 - nyurik:allow-mixed, r=xFrednet
Add allow-mixed-uninlined-format-args config

Implement `allow-mixed-uninlined-format-args` config param to change the behavior of the `uninlined_format_args` lint. Now it is a part of `style` per [Zulip chat](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/.60uninlined_format_args.60.20category), and won't propose inlining in case of a mixed usage, e.g. `print!("{} {}", var, 1+2)`. If the user sets `allow-mixed-uninlined-format-args` config param to `false`, the lint would behave like it did before -- proposing to inline args even in the mixed case.

---

changelog: [`uninlined_format_args`]: Added a new config `allow-mixed-uninlined-format-args` to allow the lint, if only some arguments can be inlined
[#9865](https://github.com/rust-lang/rust-clippy/pull/9865)
changelog: Moved [`uninlined_format_args`] to `style` (Now warn-by-default)
[#9865](https://github.com/rust-lang/rust-clippy/pull/9865)
2022-11-28 17:22:36 +00:00
Andres Suarez
9d66ab0f9d Add as_mut_os_string to &mut PathBuf and as_mut_os_str to &mut Path
Implements rust-lang/libs-team#140
2022-11-28 12:06:59 -05:00
Michael Howell
7181b8f3bc rustdoc: merge background-image rules in rustdoc-toggle CSS 2022-11-28 09:55:36 -07:00
Guillaume Gomez
20f389db89 Add sentence when rustdoc search is running 2022-11-28 17:54:21 +01:00
Matthias Krüger
3dfb6ca8e2
Rollup merge of #105006 - RalfJung:scalar-pair-alignment, r=eddyb
stricter alignment enforcement for ScalarPair

`@eddyb` [indicated](https://github.com/rust-lang/rust/pull/103926#discussion_r1033315005) that alignment violating this check might be a bug. So let's see what the test suite says.

(Only the 2nd commit actually changes behavior... but I couldn't not do that other cleanup.^^)

Does the PR CI runner even enable debug assertions though...?
2022-11-28 17:25:50 +01:00
Matthias Krüger
95de06bb5a
Rollup merge of #104998 - JakobDegen:mailmap, r=jyn514
Update my mailmap
2022-11-28 17:25:50 +01:00
Matthias Krüger
3aace9a641
Rollup merge of #104982 - RalfJung:norun, r=oli-obk
interpret: get rid of run() function

Miri needs its own loop anyway, so there's not much of a point in trying to share this code.
2022-11-28 17:25:49 +01:00
Matthias Krüger
db2850c1fb
Rollup merge of #104956 - mucinoab:issue-104870, r=compiler-errors
Avoid ICE if the Clone trait is not found while building error suggestions

Fixes #104870

r? `@compiler-errors`
2022-11-28 17:25:49 +01:00
Matthias Krüger
412f05c9e8
Rollup merge of #104954 - vincenzopalazzo:macros/prinf, r=estebank
make simple check of prinf function

Fixes https://github.com/rust-lang/rust/issues/92898

With this commit we start to make some simple
check when the name resolution fails, and
we generate some helper messages in case the
name is a C name like in the case of the `printf`
and suggest the correct rust method.

`@rustbot` r? `@pnkfelix`

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-11-28 17:25:48 +01:00
Matthias Krüger
60d136000e
Rollup merge of #104936 - cjgillot:self-rpit-orig-too, r=oli-obk
Ignore bivariant parameters in test_type_match.

https://github.com/rust-lang/rust/pull/103491 made opaque types bivariant with respect of some of their lifetime parameters.  Because of this bivariance, some lifetime variables were not unified to anything during borrowck, and were considered as unequal by borrowck type test.

This PR makes type test ignore the bivariant parameters in test_type_match.

Fixes https://github.com/rust-lang/rust/issues/104815

r? `@oli-obk`
2022-11-28 17:25:47 +01:00
Matthias Krüger
9a96a6dd82
Rollup merge of #104933 - RalfJung:interpret-partial-ord, r=oli-obk
interpret: remove PartialOrd from a bunch of types that do not have or need a sensible order

r? `@oli-obk`
2022-11-28 17:25:47 +01:00
Matthias Krüger
0eaa0d3326 Rollup merge of #104804 - nnethercote:MetaItemLit, r=petrochenkov
Rename `ast::Lit` as `ast::MetaItemLit`.

And some other literal cleanups.

r? `@petrochenkov`
2022-11-28 17:25:46 +01:00