Commit Graph

19480 Commits

Author SHA1 Message Date
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
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
Maybe Waffle
5ba0056346 Use TyCtxt::is_fn_trait is a couple more places 2022-11-27 07:20:28 +00:00
Maybe Waffle
ea447924ce micro doc fixes 2022-11-27 07:19:30 +00:00
Maybe Waffle
fa89f53352 Simplify ty::ClosureKind::extends
This is valid per the comment of the `ClosureKind` defition
2022-11-27 07:19:30 +00:00
Maybe Waffle
4b6e1d1c5f Add TyCtxt::is_fn_trait 2022-11-27 07:19:29 +00:00
Maybe Waffle
d0c7ed3bea Remove ty::ClosureKind::from_def_id
…in favour of `TyCtxt::fn_trait_kind_from_def_id`
2022-11-27 07:18:36 +00:00
Maybe Waffle
881862ecb7 Rename fn_trait_kind_from_{from_lang=>def_id} to better convey meaning 2022-11-27 07:14:49 +00:00
Jakob Degen
245c60749a Rewrite dest prop.
This fixes a number of correctness issues from the previous version. Additionally, we use a new
strategy which has much better performance charactersitics and also finds more opportunities to
apply the optimization.
2022-11-26 18:04:54 -08:00
Arpad Borsos
c96d888bdf
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 `[$movability `async` $something@$source-position]` in various diagnostics, and updates the tests that this touches.
2022-11-26 20:42:50 +01:00
bors
80a96467ec Auto merge of #104945 - GuillaumeGomez:rollup-ygzbpbe, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #104786 (Use the power of adding helper function to simplify code w/ `Mutability`)
 - #104788 (Do not record unresolved const vars in generator interior)
 - #104909 (Rename `normalize_opaque_types` to `reveal_opaque_types_in_bounds`)
 - #104921 (Remove unnecessary binder from `get_impl_future_output_ty`)
 - #104924 (jsondoclint: Accept trait alias is places where trait expected.)
 - #104928 (rustdoc: use flexbox CSS to align sidebar button instead of position)
 - #104943 (jsondoclint: Handle using enum variants and glob using enums.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-26 17:58:12 +00:00
Guillaume Gomez
4019c8aaf7
Rollup merge of #104921 - compiler-errors:no-binder-on-fut-ty, r=cjgillot
Remove unnecessary binder from `get_impl_future_output_ty`

We never construct an `async fn` with a higher-ranked `impl Future` bound anyways, and basically all the call-sites already skip the binder.
2022-11-26 17:47:24 +01:00
Guillaume Gomez
75352dddf3
Rollup merge of #104909 - compiler-errors:normalize_opaque_types-is-misleading, r=fee1-dead
Rename `normalize_opaque_types` to `reveal_opaque_types_in_bounds`

1. The query name is a bit misleading, since it doesn't do any associated type normalization, and
2. since it only takes a predicate list, it sounds a bit more powerful than it actually is.
2022-11-26 17:47:24 +01:00
Guillaume Gomez
e6c83d9e42
Rollup merge of #104788 - compiler-errors:unresolved-ct-in-gen, r=fee1-dead
Do not record unresolved const vars in generator interior

Don't record types in the generator interior when we see unresolved const variables.

We already do this for associated types -- this is important to avoid unresolved inference variables in the generator results during writeback, since the writeback results get stable hashed in incremental mode.

Fixes #104787
2022-11-26 17:47:23 +01:00
Guillaume Gomez
a2e485c25c
Rollup merge of #104786 - WaffleLapkin:amp-mut-help, r=compiler-errors
Use the power of adding helper function to simplify code w/ `Mutability`

r? `@compiler-errors`
2022-11-26 17:47:23 +01:00
bors
c3a1c023c0 Auto merge of #104731 - compiler-errors:early-binder-iter-size-hint, r=cjgillot
Add size hints to early binder iterator adapters

probably doesn't do anything, but definitely doesn't hurt
2022-11-26 14:59:30 +00:00
bors
579c993b35 Auto merge of #104935 - matthiaskrgr:rollup-nuca86l, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #104121 (Refine `instruction_set` MIR inline rules)
 - #104675 (Unsupported query error now specifies if its unsupported for local or external crate)
 - #104839 (improve array_from_fn documenation)
 - #104880 ([llvm-wrapper] adapt for LLVM API change)
 - #104899 (rustdoc: remove no-op CSS `#help dt { display: block }`)
 - #104906 (Remove AscribeUserTypeCx)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-26 12:11:32 +00:00