Commit Graph

19498 Commits

Author SHA1 Message Date
Camille GILLOT
7c45772bc9 Make verbose query description more useful. 2022-11-29 18:36:53 +00:00
bors
e0098a5cc3 Auto merge of #105012 - WaffleLapkin:into, r=oli-obk
Make `tcx.mk_const` more permissive wrt `kind` argument (`impl Into`)

r? `@oli-obk` you've asked for this >:)
2022-11-29 13:28:44 +00:00
bors
c372b14701 Auto merge of #104947 - cjgillot:verify-hir-nest, r=oli-obk
Verify that HIR parenting and Def parenting match.

This relationship is relied upon for `tcx.hir_owner_parent` query to return an accurate result.
2022-11-29 10:34:19 +00: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
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
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
Rageking8
c95dceb63a clean up pr 104954 2022-11-29 10:41:21 +08: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
Maybe Waffle
a44eb3c366 Remove Const::from_scalar_int 2022-11-28 18:04:29 +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
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
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
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
069f219d40
Rollup merge of #104891 - fee1-dead-contrib:escaping_bound_vars_docs, r=wesleywiser
Add documentation for `has_escaping_bound_vars`

Thanks to `@BoxyUwU` for explaining this to me. Adding docs with a helpful link if people get confused.
2022-11-28 17:25:46 +01:00
Matthias Krüger
63ec33e929
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
Ralf Jung
891a4da4f3 stricter alignment enforcement for ScalarPair and Vector 2022-11-28 15:09:56 +01:00
Neutron3529
11525e506e
fix document
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-28 18:31:55 +08:00
Dylan DPC
d5de2a8e64
Rollup merge of #104927 - compiler-errors:binder-shifting-logic, r=oli-obk
Simplify some binder shifting logic

Not sure if worth, but we'll see
2022-11-28 15:42:12 +05:30
Dylan DPC
9178bc059f
Rollup merge of #104907 - compiler-errors:selcx-infcx, r=oli-obk
Remove `SelectionContext::infcx()` in favor of field access

Encapsulation doesn't seem particularly important here, and having two choices is always more confusing than having one.

r? types
2022-11-28 15:42:11 +05:30
Dylan DPC
8a84dd8fcc
Rollup merge of #104890 - lcnr:small-cleanup, r=fee1-dead
small method code cleanup
2022-11-28 15:42:11 +05:30
Dylan DPC
79fe15c8b0
Rollup merge of #104795 - estebank:multiline-spans, r=TaKO8Ki
Change multiline span ASCII art visual order

Tweak the ASCII art for nested multiline spans so that we minimize line overlaps.

Partially addresses https://github.com/rust-lang/rust/issues/61017.
2022-11-28 15:42:10 +05:30
Dylan DPC
f90484df8a
Rollup merge of #104732 - WaffleLapkin:from_def_idn't, r=compiler-errors
Refactor `ty::ClosureKind` related stuff

I've tried to fix all duplication and weirdness, but if I missed something do tell :p

r? `@compiler-errors`
2022-11-28 15:42:10 +05:30
Dylan DPC
f33d4094f0
Rollup merge of #104360 - petrochenkov:stabverb, r=TaKO8Ki
Stabilize native library modifier `verbatim`

Stabilization report - https://github.com/rust-lang/rust/pull/104360#issuecomment-1312724787.

cc https://github.com/rust-lang/rust/issues/81490
Closes https://github.com/rust-lang/rust/issues/99425
2022-11-28 15:42:09 +05:30
Ralf Jung
58dd62a756 sanity_check_layout: less rightwards drift 2022-11-28 10:45:12 +01:00
Esteban Küber
6f64432a39 Tweak output 2022-11-28 00:11:12 -08:00
Esteban Küber
ab04080b56 Change multiline span ASCII art visual order 2022-11-28 00:11:12 -08:00
Nicholas Nethercote
a60e337c88 Rename NestedMetaItem::[Ll]iteral as NestedMetaItem::[Ll]it.
We already use a mix of `Literal` and `Lit`. The latter is better
because it is shorter without causing any ambiguity.
2022-11-28 15:18:53 +11:00
Nicholas Nethercote
1c65264f3c Adjust comments on StrLit. 2022-11-28 15:18:52 +11:00
Nicholas Nethercote
e4a9150872 Rename ast::Lit as ast::MetaItemLit. 2022-11-28 15:18:49 +11:00
Nicholas Nethercote
aa10aad1ac Factor out a repeated expression in lower_attr_args. 2022-11-28 15:17:45 +11:00
Nicholas Nethercote
8cfc8153da Remove Lit::from_included_bytes.
`Lit::from_included_bytes` calls `Lit::from_lit_kind`, but the two call
sites only need the resulting `token::Lit`, not the full `ast::Lit`.

This commit changes those call sites to use `LitKind::to_token_lit`,
which means `from_included_bytes` can be removed.
2022-11-28 15:17:45 +11:00
Bruno A. Muciño
7a378dd0fb Avoid ICE if the Clone trait is not found while building error suggestions 2022-11-27 20:50:13 -06:00
Matthias Krüger
86304f5149
Rollup merge of #104976 - WaffleLapkin:move_comments, r=cjgillot
Prefer doc comments over `//`-comments in compiler

Doc comments are generally nicer: they show up in the documentation, they are shown in IDEs when you hover other mentions of items, etc. Thus it makes sense to use them instead of `//`-comments.
2022-11-27 22:14:08 +01:00
lcnr
99c3dda066
fix type
Co-authored-by: fee1-dead <ent3rm4n@gmail.com>
2022-11-27 20:48:31 +01:00
Vadim Petrochenkov
5b0e80ecf3 Stabilize native library modifier verbatim 2022-11-27 22:36:32 +03:00
bors
1eb62b1235 Auto merge of #104983 - matthiaskrgr:rollup-018sk73, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #95836 (Use `rust_out{exe_suffix}` for doctests)
 - #104882 (notify lcnr on changes to `ObligationCtxt`)
 - #104892 (Explain how to get the discriminant out of a `#[repr(T)] enum` with payload)
 - #104917 (Allow non-org members to label `requires-debug-assertions`)
 - #104931 (Pretty-print generators with their `generator_kind`)
 - #104934 (Remove redundant `all` in cfg)
 - #104944 (Support unit tests for jsondoclint)
 - #104946 (rustdoc: improve popover focus handling JS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-27 17:10:58 +00:00
Matthias Krüger
8d90647641
Rollup merge of #104934 - ChrisDenton:all-anybody-wants, r=thomcc
Remove redundant `all` in cfg

This appears to have been accidentally left in after removing the other branches 45bf1ed1a1

(hat tip to kangalioo for the git archaeology)
2022-11-27 16:03:08 +01:00
Matthias Krüger
6e6c42c61c
Rollup merge of #104931 - Swatinem:async-pretty, r=eholk
Pretty-print generators with their `generator_kind`

After removing `GenFuture`, I special-cased async generators to pretty-print as `impl Future<Output = X>` mainly to avoid too much diagnostics changes originally.

This now reverses that change so that async fn/blocks are pretty-printed as `[$async-type@$source-position]` in various diagnostics, and updates the tests that this touches.
2022-11-27 16:03:08 +01:00
bors
454784afba Auto merge of #104048 - cjgillot:split-lifetime, r=compiler-errors
Separate lifetime ident from lifetime resolution in HIR

Drive-by: change how suggested generic args are computed.
Fixes https://github.com/rust-lang/rust/issues/103815

I recommend reviewing commit-by-commit.
2022-11-27 14:30:19 +00:00
Ralf Jung
60d5d65a4d interpret: get rid of run() function 2022-11-27 15:20:26 +01:00
Maybe Waffle
1d42936b18 Prefer doc comments over //-comments in compiler 2022-11-27 11:19:04 +00:00
Vincenzo Palazzo
ee6f18ef59
make simple check of prinf function.
With this commit we start to make some simple
check when the name resolution fails, and
we generate some helper message in case the
name is a C name like in the case of the `printf`
and suggest the correct rust method.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-11-27 11:50:02 +01:00
bors
df04d28163 Auto merge of #103917 - oli-obk:layout_math, r=RalfJung,lcnr
Various cleanups around scalar layout restrictions

Pulled out of https://github.com/rust-lang/rust/pull/103724
2022-11-27 10:35:00 +00:00