about summary refs log tree commit diff
path: root/compiler/rustc_infer/src/traits
AgeCommit message (Collapse)AuthorLines
2024-05-10Rename some ObligationCauseCode variantsMichael Goulet-8/+6
2024-05-10Remove glob imports for ObligationCauseCodeMichael Goulet-7/+9
2024-05-10rename some variants in FulfillmentErrorCodeMichael Goulet-12/+12
2024-05-02Use ObligationCtxt in favor of TraitEngine in many placesMichael Goulet-0/+12
2024-04-29Remove `extern crate rustc_data_structures` from numerous crates.Nicholas Nethercote-1/+1
2024-04-29Remove `extern crate rustc_macros` from numerous crates.Nicholas Nethercote-0/+1
2024-04-20include ParamEnv in projection cache keyLukas Markeffsky-2/+3
2024-04-18Simplify `static_assert_size`s.Nicholas Nethercote-1/+1
We want to run them on all 64-bit platforms.
2024-04-03Check `x86_64` size assertions on `aarch64`, tooZalathar-1/+1
This makes it easier for contributors on aarch64 workstations (e.g. Macs) to notice when these assertions have been violated.
2024-03-22Use != Positive rather than == NegativeMichael Goulet-1/+1
Feels more complete, and for ImplPolarity has the side-effect of making sure we also handle reservation impls correctly
2024-03-22Split out ImplPolarity and PredicatePolarityMichael Goulet-2/+2
2024-03-07move snapshot handling into modlcnr-1/+1
2024-03-05Convert `TypeVisitor` and `DefIdVisitor` to use `VisitorResult`Jason Newcomb-3/+3
2024-02-29distinguish recursion limit based overflow for diagnosticslcnr-6/+10
also change the number of allowed fixpoint steps to be fixed instead of using the `log` of the total recursion depth.
2024-02-28Rename `DiagnosticBuilder` as `Diag`.Nicholas Nethercote-3/+3
Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy.
2024-02-16NitsMichael Goulet-0/+1
2024-02-16Move trait into attr so it's greppableMichael Goulet-2/+2
2024-02-16Use extension trait deriveMichael Goulet-12/+2
2024-02-12Dejargnonize substShoyu Vanilla-1/+2
2024-02-11Rollup merge of #120872 - petrochenkov:opthirpar, r=cjgillotMatthias Krüger-2/+2
hir: Refactor getters for HIR parents See individual commits. I ended up removing on of the FIXMEs from https://github.com/rust-lang/rust/pull/120206 instead of addressing it.
2024-02-10hir: Remove `hir::Map::{opt_parent_id,parent_id,get_parent,find_parent}`Vadim Petrochenkov-2/+2
2024-02-10Auto merge of #120712 - compiler-errors:async-closures-harmonize, r=oli-obkbors-1/+2
Harmonize `AsyncFn` implementations, make async closures conditionally impl `Fn*` traits This PR implements several changes to the built-in and libcore-provided implementations of `Fn*` and `AsyncFn*` to address two problems: 1. async closures do not implement the `Fn*` family traits, leading to breakage: https://crater-reports.s3.amazonaws.com/pr-120361/index.html 2. *references* to async closures do not implement `AsyncFn*`, as a consequence of the existing blanket impls of the shape `AsyncFn for F where F: Fn, F::Output: Future`. In order to fix (1.), we implement `Fn` traits appropriately for async closures. It turns out that async closures can: * always implement `FnOnce`, meaning that they're drop-in compatible with `FnOnce`-bound combinators like `Option::map`. * conditionally implement `Fn`/`FnMut` if they have no captures, which means that existing usages of async closures should *probably* work without breakage (crater checking this: https://github.com/rust-lang/rust/pull/120712#issuecomment-1930587805). In order to fix (2.), we make all of the built-in callables implement `AsyncFn*` via built-in impls, and instead adjust the blanket impls for `AsyncFn*` provided by libcore to match the blanket impls for `Fn*`.
2024-02-08sort suggestions for object diagnosticMichael Goulet-1/+2
2024-02-07hir: Remove `fn opt_hir_id` and `fn opt_span`Vadim Petrochenkov-2/+1
2024-01-29Stop using `String` for error codes.Nicholas Nethercote-1/+1
Error codes are integers, but `String` is used everywhere to represent them. Gross! This commit introduces `ErrCode`, an integral newtype for error codes, replacing `String`. It also introduces a constant for every error code, e.g. `E0123`, and removes the `error_code!` macro. The constants are imported wherever used with `use rustc_errors::codes::*`. With the old code, we have three different ways to specify an error code at a use point: ``` error_code!(E0123) // macro call struct_span_code_err!(dcx, span, E0123, "msg"); // bare ident arg to macro call \#[diag(name, code = "E0123")] // string struct Diag; ``` With the new code, they all use the `E0123` constant. ``` E0123 // constant struct_span_code_err!(dcx, span, E0123, "msg"); // constant \#[diag(name, code = E0123)] // constant struct Diag; ``` The commit also changes the structure of the error code definitions: - `rustc_error_codes` now just defines a higher-order macro listing the used error codes and nothing else. - Because that's now the only thing in the `rustc_error_codes` crate, I moved it into the `lib.rs` file and removed the `error_codes.rs` file. - `rustc_errors` uses that macro to define everything, e.g. the error code constants and the `DIAGNOSTIC_TABLES`. This is in its new `codes.rs` file.
2024-01-19Add trait obligation tracking to FulfillCtxt and expose FnCtxt in ↵Gavin Gray-0/+8
rustc_infer using callback. Pass each obligation to an fn callback with its respective inference context. This avoids needing to keep around copies of obligations or inference contexts. Specify usability of inspect_typeck in comment.
2024-01-12Remove redundant Code from FulfillmentErrorCode variantsMichael Goulet-14/+14
2024-01-10Rename `struct_span_err!` as `struct_span_code_err!`.Nicholas Nethercote-3/+3
Because it takes an error code after the span. This avoids the confusing overlap with the `DiagCtxt::struct_span_err` method, which doesn't take an error code.
2024-01-05Rollup merge of #119506 - ↵Matthias Krüger-1/+4
compiler-errors:visibilities-for-object-safety-error, r=Nilstrieb Use `resolutions(()).effective_visiblities` to avoid cycle errors in `report_object_error` Inside of `report_object_error`, using the `effective_visibilities` query causes cycles since it calls `type_of`, which itself may call `typeck`, which may end up reporting its own object-safety errors. Fixes #119346 Fixes #119502
2024-01-05Use `resolutions(()).effective_visiblities` to avoid cycle errorsMichael Goulet-1/+4
2024-01-04Silence redundant warning when E0038 will be emittedEsteban Küber-1/+21
2023-12-26Auto merge of #119129 - jyn514:verbose, r=compiler-errors,estebankbors-1/+1
rework `-Zverbose` implements the changes described in https://github.com/rust-lang/compiler-team/issues/706 the first commit is only a name change from `-Zverbose` to `-Zverbose-internals` and does not change behavior. the second commit changes diagnostics. possible follow up work: - `ty::pretty` could print more info with `--verbose` than it does currently. `-Z verbose-internals` shows too much info in a way that's not helpful to users. michael had ideas about this i didn't fully understand: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/uplift.20some.20-Zverbose.20calls.20and.20rename.20to.E2.80.A6.20compiler-team.23706/near/408984200 - `--verbose` should imply `-Z write-long-types-to-disk=no`. the code in `ty_string_with_limit` should take `--verbose` into account (apparently this affects `Ty::sort_string`, i'm not familiar with this code). writing a file to disk should suggest passing `--verbose`. r? `@compiler-errors` cc `@estebank`
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-2/+2
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-23Give `DiagnosticBuilder` a default type.Nicholas Nethercote-3/+3
`IntoDiagnostic` defaults to `ErrorGuaranteed`, because errors are the most common diagnostic level. It makes sense to do likewise for the closely-related (and much more widely used) `DiagnosticBuilder` type, letting us write `DiagnosticBuilder<'a, ErrorGuaranteed>` as just `DiagnosticBuilder<'a>`. This cuts over 200 lines of code due to many multi-line things becoming single line things.
2023-12-19rename to verbose-internalsjyn-1/+1
2023-12-14update use of feature flagslcnr-1/+1
2023-12-07add unused `NormalizesTo` predicatelcnr-44/+26
2023-11-26move comment about local traitRyan Mehri-1/+2
2023-11-26don't add redundant help for object safety violationsRyan Mehri-3/+9
2023-11-21Remove ClosureKind predicate kindMichael Goulet-3/+0
2023-11-19Make regionck care about placeholders in outlives componentsMichael Goulet-0/+5
2023-11-13rename `ReLateBound` to `ReBound`lcnr-2/+2
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
2023-10-29On object safety error, mention new enum as alternativeEsteban Küber-1/+63
When we encounter a `dyn Trait` that isn't object safe, look for its implementors. If there's one, mention using it directly If there are less than 9, mention the possibility of creating a new enum and using that instead. Account for object unsafe `impl Trait on dyn Trait {}`. Make a distinction between public and sealed traits. Fix #80194.
2023-10-22use visibility to check unused imports and delete some stmtsbohan-1/+0
2023-10-18Make sure that non-pretty-printing usages are using the correct elaboratorMichael Goulet-2/+2
2023-10-18Simplify transitive_bounds_that_define_assoc_itemMichael Goulet-33/+28
2023-10-13Format all the let chains in compilerMichael Goulet-1/+3
2023-08-09Ignore `cause` and `recursion_depth` in `Obligation::{eq,hash}`.Nicholas Nethercote-1/+23
This gives massive (~7x) compile time and memory usage reductions for the trait system stress test in https://github.com/rust-lang/rustc-perf/pull/1680.
2023-08-02Remove constness from `TraitPredicate`Deadbeef-13/+2
2023-07-30inline format!() args up to and including rustc_codegen_llvmMatthias Krüger-12/+12