about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/adjustment.rs
AgeCommit message (Collapse)AuthorLines
2025-07-01Remove support for dyn*Michael Goulet-3/+0
2025-06-05Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of NoneOli Scherer-2/+2
2025-04-18Rollup merge of #138528 - dianne:implicit-deref-patterns, r=NadrierilMatthias Krüger-0/+22
deref patterns: implement implicit deref patterns This implements implicit deref patterns (per https://hackmd.io/4qDDMcvyQ-GDB089IPcHGg#Implicit-deref-patterns) and adds tests and an unstable book chapter. Best reviewed commit-by-commit. Overall there's a lot of additions, but a lot of that is tests, documentation, and simple(?) refactoring. Tracking issue: #87121 r? ``@Nadrieril``
2025-04-14Move `has_self` field to `hir::AssocKind::Fn`.Nicholas Nethercote-2/+2
`hir::AssocItem` currently has a boolean `fn_has_self_parameter` field, which is misplaced, because it's only relevant for associated fns, not for associated consts or types. This commit moves it (and renames it) to the `AssocKind::Fn` variant, where it belongs. This requires introducing a new C-style enum, `AssocTag`, which is like `AssocKind` but without the fields. This is because `AssocKind` values are passed to various functions like `find_by_ident_and_kind` to indicate what kind of associated item should be searched for, and having to specify `has_self` isn't relevant there. New methods: - Predicates `AssocItem::is_fn` and `AssocItem::is_method`. - `AssocItem::as_tag` which converts `AssocItem::kind` to `AssocTag`. Removed `find_by_name_and_kinds`, which is unused. `AssocItem::descr` can now distinguish between methods and associated functions, which slightly improves some error messages.
2025-04-12store the kind of pattern adjustments in `pat_adjustments`dianne-0/+22
This allows us to better distinguish builtin and overloaded implicit dereferences.
2024-11-04Register const preds for Deref adjustments in HIR typeckMichael Goulet-6/+6
2024-11-03compiler: Directly use rustc_abi in metadata and middleJubilee Young-1/+1
Stop reexporting ReprOptions from middle::ty
2024-10-29Remove region from adjustmentsMichael Goulet-11/+10
2024-10-04Use wide pointers consistenly across the compilerUrgau-3/+3
2024-09-24unify dyn* coercions with other pointer coercionsLukas Markeffsky-3/+3
2024-09-19Allow shortening reborrowsEric Holk-3/+2
Generating a call to `as_mut()` let to more restrictive borrows than what reborrowing usually gives us. Instead, we change the desugaring to reborrow the pin internals directly which makes things more expressive.
2024-09-18Apply code review suggestionsEric Holk-1/+2
2024-09-18Begin experimental support for pin reborrowingEric Holk-0/+3
This commit adds basic support for reborrowing `Pin` types in argument position. At the moment it only supports reborrowing `Pin<&mut T>` as `Pin<&mut T>` by inserting a call to `Pin::as_mut()`, and only in argument position (not as the receiver in a method call).
2024-07-29Reformat `use` declarations.Nicholas Nethercote-1/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-05-17Rename Unsafe to SafetySantiago Pastorino-1/+1
2024-04-29Remove `extern crate rustc_macros` from `rustc_middle`.Nicholas Nethercote-1/+1
2023-09-18Remove unused `Lift` derives.Nicholas Nethercote-4/+4
I found these by commenting out all `Lift` derives and then adding back the ones that were necessary to successfully compile.
2023-07-07Rename `adjustment::PointerCast` and variants using it to `PointerCoercion`Nilstrieb-2/+2
It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a some enum variants. Make it clear there these are only coercion to make it clear why only some pointer related "casts" are in the enum.
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-1/+1
2023-03-30Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>`Scott McMurray-1/+2
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2022-12-14Let `mk_fn_def` take an iterator instead to simplify some call sitesOli Scherer-1/+1
2022-11-23Simplify creation of `AutoBorrowMutability`Maybe Waffle-0/+12
2022-11-21Allow iterators instead of requiring slices that will get turned into iteratorsOli Scherer-1/+1
2022-11-21Reduce the amount of passed-around arguments that will get merged into one ↵Oli Scherer-4/+3
later anyway
2022-10-14Make dyn* cast into a coercionMichael Goulet-0/+3
2022-09-15derive various Lift impl instead of hand rolling themOli Scherer-4/+4
2022-07-05Add #[derive(TypeVisitable)]Alan Egerton-4/+6
2022-05-02fix most compiler/ doctestsElliot Roberts-1/+1
2021-12-15Remove `in_band_lifetimes` from `rustc_middle`Aaron Hill-1/+1
See #91867 This was mostly straightforward. In several places, I take advantage of the fact that lifetimes are non-hygenic: a macro declares the 'tcx' lifetime, which is then used in types passed in as macro arguments.
2021-05-24Add some backticks to the `rustc_middle::ty::adjustment::Adjustment` docsScott McMurray-5/+5
A few `[i32]`s are getting picked up as intra-doc links, rather than showing as slices, making the sentence quite confusing.
2021-02-21New pass to deduplicate blocksSimon Vandel Sillesen-1/+1
2020-09-21Reduce boilerplate with the matches! macroLingMan-4/+1
Replaces simple bool `match`es of the form match $expr { $pattern => true _ => false } and their inverse with invocations of the matches! macro.
2020-09-10Note when a a move/borrow error is caused by a deref coercionAaron Hill-0/+4
Fixes #73268 When a deref coercion occurs, we may end up with a move error if the base value has been partially moved out of. However, we do not indicate anywhere that a deref coercion is occuring, resulting in an error message with a confusing span. This PR adds an explicit note to move errors when a deref coercion is involved. We mention the name of the type that the deref-coercion resolved to, as well as the `Deref::Target` associated type being used.
2020-08-30mv compiler to compiler/mark-0/+195