Commit graph

355 commits

Author SHA1 Message Date
Michael Goulet
70f6c478f6 get_parent and find_parent 2023-01-04 00:43:13 +00:00
Michael Goulet
73d293fb6d rename get_parent_node to parent_id 2023-01-04 00:43:13 +00:00
bors
cd579d69ec Auto merge of #106266 - matthiaskrgr:rollup-cxrdbzy, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #104531 (Provide a better error and a suggestion for `Fn` traits with lifetime params)
 - #105899 (`./x doc library --open` opens `std`)
 - #106190 (Account for multiple multiline spans with empty padding)
 - #106202 (Trim more paths in obligation types)
 - #106234 (rustdoc: simplify settings, help, and copy button CSS by not reusing)
 - #106236 (docs/test: add docs and a UI test for `E0514` and `E0519`)
 - #106259 (Update Clippy)
 - #106260 (Fix index out of bounds issues in rustdoc)
 - #106263 (Formatter should not try to format non-Rust files)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-29 19:40:06 +00:00
Philipp Krones
4ccafea92d Merge commit '4f3ab69ea0a0908260944443c739426cc384ae1a' into clippyup 2022-12-29 14:28:34 +01:00
Nilstrieb
c617a8e01c Rename Rptr to Ref in AST and HIR
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already
as well.
2022-12-28 18:52:36 +01:00
Philipp Krones
1c422524c7 Merge commit '4bdfb0741dbcecd5279a2635c3280726db0604b5' into clippyup 2022-12-17 14:12:54 +01:00
Matthias Krüger
cfe1e040e7 Rollup merge of #105743 - nnethercote:SimplifiedType-cleanups, r=lcnr
`SimplifiedType` cleanups

r? `@lcnr`
2022-12-15 22:03:01 +01:00
Nicholas Nethercote
e723fc4f56 Merge SimplifiedTypeGen<D> into SimplifiedType.
`SimplifiedTypeGen<DefId>` is the only instantiation used, so we don't
need the generic parameter.
2022-12-15 15:13:19 +11:00
Oli Scherer
65069d5c5b Ensure no one constructs AliasTys themselves 2022-12-14 15:36:39 +00:00
Michael Goulet
957ab6ae52 Combine projection and opaque into alias 2022-12-13 17:48:55 +00:00
Michael Goulet
89b8840543 squash OpaqueTy and ProjectionTy into AliasTy 2022-12-13 17:40:27 +00:00
Michael Goulet
a274e7e9a2 ProjectionTy.item_def_id -> ProjectionTy.def_id 2022-12-13 17:34:44 +00:00
Michael Goulet
ad55e4c972 Use ty::OpaqueTy everywhere 2022-12-13 17:29:26 +00:00
bors
17a092f467 Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov
Remove `token::Lit` from `ast::MetaItemLit`.

Currently `ast::MetaItemLit` represents the literal kind twice. This PR removes that redundancy. Best reviewed one commit at a time.

r? `@petrochenkov`
2022-12-12 05:16:50 +00:00
Jakob Degen
dc50bb0961 Remove unneeded field from SwitchTargets 2022-12-09 04:53:10 -08:00
bors
a1d22808af Auto merge of #104963 - petrochenkov:noaddids2, r=cjgillot
rustc_ast_lowering: Stop lowering imports into multiple items

Lower them into a single item with multiple resolutions instead.
This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-12-02 04:24:57 +00:00
Nicholas Nethercote
6481d37bb9 Add StrStyle to ast::LitKind::ByteStr.
This is required to distinguish between cooked and raw byte string
literals in an `ast::LitKind`, without referring to an adjacent
`token::Lit`. It's a prerequisite for the next commit.
2022-12-02 10:38:58 +11:00
Philipp Krones
d05e2865a0 Merge commit 'd822110d3b5625b9dc80ccc442e06fc3cc851d76' into clippyup 2022-12-01 18:29:38 +01:00
Vadim Petrochenkov
b0d490e308 rustc_ast_lowering: Stop lowering imports into multiple items
Lower them into a single item with multiple resolutions instead.
This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-12-01 18:51:20 +03:00
Vadim Petrochenkov
4f8c49e950 rustc_hir: Relax lifetime requirements on Visitor::visit_path 2022-12-01 17:04:02 +03:00
Michael Goulet
a61e2a91f5 FnCtxt normalization stuff 2022-11-28 17:35:39 +00:00
Michael Goulet
82c07f09e5 partially_normalize_... -> At::normalize 2022-11-28 17:35:39 +00:00
bors
696ea0627d 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
bors
8b2f7e3b52 Auto merge of #104846 - spastorino:santa-clauses-make-goals-early-christmas-🎄, r=oli-obk
Branch Clause from Predicate

r? `@oli-obk`

This is part of what's proposed in https://github.com/rust-lang/compiler-team/issues/531
2022-11-25 15:59:31 +00:00
Matthias Krüger
268d230231 Rollup merge of #104873 - RalfJung:therefore, r=Dylan-DPC
RefCell::get_mut: fix typo

and fix the same typo in a bunch of other places
2022-11-25 10:44:40 +01:00
Ralf Jung
424ae23958 RefCell::get_mut: fix typo
and fix the same typo in a bunch of other places
2022-11-25 08:52:06 +01:00
Santiago Pastorino
3f059a49a4 Introduce PredicateKind::Clause 2022-11-25 00:04:54 -03:00
Matthias Krüger
ac6a77ed95 Rollup merge of #104742 - WaffleLapkin:forbidden-SUPER-deref, r=compiler-errors
Make `deref_into_dyn_supertrait` lint the impl and not the usage

Proposed by ``@compiler-errors`` in https://github.com/rust-lang/rust/issues/89460#issuecomment-1320806785
r? ``@crlf0710``
2022-11-24 08:42:34 +01:00
Esteban Küber
2a530dce53 Fix clippy code 2022-11-23 12:17:47 -08:00
Camille GILLOT
93cfcedfd5 Separate lifetime ident from resolution in HIR. 2022-11-23 19:33:06 +00:00
Maybe Waffle
284ce9ed0d Move get_associated_type from clippy to rustc_lint 2022-11-23 15:40:27 +00:00
Manish Goregaokar
91d2ce3020 Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnr
Allow opaque types in trait impl headers and rely on coherence to reject unsound cases

r? ````@lcnr````

fixes #99840
2022-11-22 22:54:38 -05:00
bors
b33afd61ed Auto merge of #104688 - flip1995:clippyup, r=Manishearth,flip1995
Update Clippy

r? `@Manishearth`

Sorry for taking so long. There were so many blockers and so little time. This situation should be mitigated with #104007 in the future.
2022-11-22 17:09:06 +00:00
bors
e6c33e0054 Auto merge of #104696 - matthiaskrgr:rollup-gi1pdb0, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #103396 (Pin::new_unchecked: discuss pinning closure captures)
 - #104416 (Fix using `include_bytes` in pattern position)
 - #104557 (Add a test case for async dyn* traits)
 - #104559 (Split `MacArgs` in two.)
 - #104597 (Probe + better error messsage for `need_migrate_deref_output_trait_object`)
 - #104656 (Move tests)
 - #104657 (Do not check transmute if has non region infer)
 - #104663 (rustdoc: factor out common button CSS)
 - #104666 (Migrate alias search result to CSS variables)
 - #104674 (Make negative_impl and negative_impl_exists take the right types)
 - #104692 (Update test's cfg-if dependency to 1.0)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-22 01:35:57 +00:00
Nicholas Nethercote
48b10feedb Split MacArgs in two.
`MacArgs` is an enum with three variants: `Empty`, `Delimited`, and `Eq`. It's
used in two ways:
- For representing attribute macro arguments (e.g. in `AttrItem`), where all
  three variants are used.
- For representing function-like macros (e.g. in `MacCall` and `MacroDef`),
  where only the `Delimited` variant is used.

In other words, `MacArgs` is used in two quite different places due to them
having partial overlap. I find this makes the code hard to read. It also leads
to various unreachable code paths, and allows invalid values (such as
accidentally using `MacArgs::Empty` in a `MacCall`).

This commit splits `MacArgs` in two:
- `DelimArgs` is a new struct just for the "delimited arguments" case. It is
  now used in `MacCall` and `MacroDef`.
- `AttrArgs` is a renaming of the old `MacArgs` enum for the attribute macro
  case. Its `Delimited` variant now contains a `DelimArgs`.

Various other related things are renamed as well.

These changes make the code clearer, avoids several unreachable paths, and
disallows the invalid values.
2022-11-22 09:04:15 +11:00
Oli Scherer
595ae83855 Stop passing the self-type as a separate argument. 2022-11-21 20:39:46 +00:00
Oli Scherer
f60e43ee05 Fix clippy's missing substs 2022-11-21 20:39:29 +00:00
Oli Scherer
c7828221e3 Allow iterators instead of requiring slices that will get turned into iterators 2022-11-21 20:33:55 +00:00
Philipp Krones
6fce4691d5 Clippy: Don't import GenericParamDefKind 2022-11-21 21:05:06 +01:00
Philipp Krones
46c5a5d234 Merge commit 'f4850f7292efa33759b4f7f9b7621268979e9914' into clippyup 2022-11-21 20:51:52 +01:00
Oli Scherer
386d0a5c67 Add an always-ambiguous predicate to make sure that we don't accidentlally allow trait resolution to prove false things during coherence 2022-11-21 16:35:04 +00:00
bors
80a4699aae Auto merge of #98914 - fee1-dead-contrib:min-deref-patterns, r=compiler-errors
Minimal implementation of implicit deref patterns for Strings

cc `@compiler-errors` `@BoxyUwU` https://github.com/rust-lang/lang-team/issues/88 #87121

~~I forgot to add a feature gate, will do so in a minute~~ Done
2022-11-20 07:16:42 +00:00
Matthias Krüger
27c4c17684 Rollup merge of #104593 - compiler-errors:rpitit-object-safety-spans, r=fee1-dead
Improve spans for RPITIT object-safety errors

No reason why we can't point at the `impl Trait` that causes the object-safety violation.

Also [drive-by: Add is_async fn to hir::IsAsync](c4165f3a96), which touches clippy too.
2022-11-19 15:35:23 +01:00
Michael Goulet
3a2eaa73f4 drive-by: Add is_async fn to hir::IsAsync 2022-11-19 02:22:24 +00:00
Deadbeef
a09423f8c8 Rm diagnostic item, use lang item 2022-11-18 06:16:20 +00:00
Nicholas Nethercote
333b92c5ed Box ExprKind::{Closure,MethodCall}, and QSelf in expressions, types, and patterns. 2022-11-17 13:45:59 +11:00
Nicholas Nethercote
f2d83ed1ac Use token::Lit in ast::ExprKind::Lit.
Instead of `ast::Lit`.

Literal lowering now happens at two different times. Expression literals
are lowered when HIR is crated. Attribute literals are lowered during
parsing.

This commit changes the language very slightly. Some programs that used
to not compile now will compile. This is because some invalid literals
that are removed by `cfg` or attribute macros will no longer trigger
errors. See this comment for more details:
https://github.com/rust-lang/rust/pull/102944#issuecomment-1277476773
2022-11-16 09:41:28 +11:00
Maybe Waffle
8a2d0f255d Fix clippy and rustdoc
please, please, don't match on `Symbol::as_str`s, every time you do,
somewhere in the world another waffle becomes sad...
2022-11-13 22:58:20 +00:00
clubby789
7ddd321ecd Introduce ExprKind::IncludedBytes 2022-11-11 16:31:32 +00:00
Cameron Steffen
16566e97fd Use LanguageItems::require less 2022-10-29 16:04:10 -05:00