about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
AgeCommit message (Collapse)AuthorLines
2023-11-18Auto merge of #117742 - ↵bors-13/+101
weiznich:turn_overlapping_diagnostic_options_into_warnings, r=compiler-errors Add some additional warnings for duplicated diagnostic items This commit adds warnings if a user supplies several diagnostic options where we can only apply one of them. We explicitly warn about ignored options here. In addition a small test for these warnings is added. r? `@compiler-errors` For now that's the last PR to improve the warnings generated by misused `#[diagnostic::on_unimplemented]` attributes. I'm not sure what needs to be done next to move this closer to stabilization.
2023-11-17Auto merge of #117944 - lcnr:region-refactor-uwu, r=BoxyUwUbors-9/+11
some additional region refactorings the commits are selfcontained ✨ r? `@BoxyUwU`
2023-11-17Auto merge of #112422 - aliemjay:implied-bounds-placeholders, r=lcnrbors-2/+6
ignore implied bounds with placeholders given the following code: ```rust trait Trait { type Ty<'a> where Self: 'a; } impl<T> Trait for T { type Ty<'a> = () where Self: 'a; } struct Foo<T: Trait>(T) where for<'x> T::Ty<'x>: Sized; ``` when computing the implied bounds from `Foo<X>` we incorrectly get the bound `X: !x` from the normalization of ` for<'x> <X as Trait>::Ty::<'x>: Sized`. This is a a known bug! we shouldn't use the constraints that arise from normalization as implied bounds. See #109628. Ignore these bounds for now. This should prevent later ICEs. Fixes #112250 Fixes #107409
2023-11-17Auto merge of #117278 - lcnr:try-normalize-ty, r=compiler-errorsbors-291/+287
new solver normalization improvements cool beans At the core of this PR is a `try_normalize_ty` which stops for rigid aliases by using `commit_if_ok`. Reworks alias-relate to fully normalize both the lhs and rhs and then equate the resulting rigid (or inference) types. This fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/68 by avoiding the exponential blowup. Also supersedes #116369 by only defining opaque types if the hidden type is rigid. I removed the stability check in `EvalCtxt::evaluate_goal` due to https://github.com/rust-lang/trait-system-refactor-initiative/issues/75. While I personally have opinions on how to fix it, that still requires further t-types/`@nikomatsakis` buy-in, so I removed that for now. Once we've decided on our approach there, we can revert this commit. r? `@compiler-errors`
2023-11-17rename bound region instantiationlcnr-9/+11
- `erase_late_bound_regions` -> `instantiate_bound_regions_with_erased` - `replace_late_bound_regions_X` -> `instantiate_bound_regions_X`
2023-11-17Add some additional warnings for duplicated diagnostic itemsGeorg Semmler-13/+101
This commit adds warnings if a user supplies several diagnostic options where we can only apply one of them. We explicitly warn about ignored options here. In addition a small test for these warnings is added.
2023-11-16ignore implied bounds with placeholdersAli MJ Al-Nasrawy-2/+6
2023-11-15Re-format code with new rustfmtMark Rousskov-33/+53
2023-11-15Bump cfg(bootstrap)sMark Rousskov-3/+3
2023-11-15Auto merge of #117878 - gavinleroy:proper-depth-check, r=lcnrbors-2/+8
Fix depth check in ProofTreeVisitor. The hack to cutoff overflows and cycles in the new trait solver was incorrect. We want to inspect everything with depth [0..10]. This fix exposed a previously unseen bug, which caused the compiler to ICE when invoking `trait_ref` on a non-assoc type projection. I simply added the guard in the `AmbiguityCausesVisitor`, and updated the expected output for the `auto-trait-coherence` test which now includes the extra note: ```text | = note: upstream crates may add a new impl of trait `std::marker::Send` for type `OpaqueType` in future versions ``` r? `@lcnr`
2023-11-14finish `RegionKind` renamelcnr-2/+2
- `ReFree` -> `ReLateParam` - `ReEarlyBound` -> `ReEarlyParam`
2023-11-14Add guard checking for associated types before computing intercrate ↵Gavin Gray-1/+7
ambiguity of projections. Bless test with more specific notes on the ambiguity cause.
2023-11-13Auto merge of #117887 - matthiaskrgr:rollup-rgur03f, r=matthiaskrgrbors-6/+4
Rollup of 4 pull requests Successful merges: - #114224 (rustc_llvm: Link to libkstat on Solaris/SPARC) - #117695 (Reorder checks to make sure potential missing expect on Option/Result…) - #117870 (`fn args_ref_X` to `fn args_X`) - #117879 (tests: update check for inferred nneg on zext) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-13Rollup merge of #117870 - lcnr:rename-args_ref, r=compiler-errorsMatthias Krüger-6/+4
`fn args_ref_X` to `fn args_X`
2023-11-13Auto merge of #116866 - slanterns:inspect-stabilize, r=BurntSushibors-1/+0
Stabilize `result_option_inspect` This PR stabilizes `result_option_inspect`: ```rust // core::option impl Option<T> { pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self; } // core::result impl Result<T, E> { pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self; pub fn inspect_err<F: FnOnce(&E)>(self, f: F) -> Self; } ``` <br> Tracking issue: https://github.com/rust-lang/rust/issues/91345. Implementation PR: https://github.com/rust-lang/rust/pull/91346. Closes https://github.com/rust-lang/rust/issues/91345.
2023-11-13Auto merge of #117881 - TaKO8Ki:rollup-n7jtmgj, r=TaKO8Kibors-7/+2
Rollup of 5 pull requests Successful merges: - #117737 (Remove `-Zkeep-hygiene-data`.) - #117830 (Small improvements in object lifetime default code) - #117858 (Compute layout with spans for better cycle errors in coroutines) - #117863 (Remove some unused stuff from `rustc_index`) - #117872 (Cranelift isn't available on non-nightly channels) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-13Fix overflow and cycle bound for ProofTreeVisitor.Gavin Gray-1/+1
2023-11-13update type flagslcnr-5/+5
- `HAS_RE_LATE_BOUND` -> `HAS_RE_BOUND` - `HAS_TY_LATE_BOUND` -> `HAS_TY_BOUND` - `HAS_CT_LATE_BOUND` -> `HAS_CT_BOUND` - `HAS_LATE_BOUND` -> `HAS_BOUND_VARS` - `fn has_late_bound_regions` -> `fn has_bound_regions` - `fnhas_non_region_late_bound` -> `fn has_non_region_bound_vars` - `fn has_late_bound_vars` -> `fn has_bound_vars`
2023-11-13continue renaminglcnr-15/+15
- `RegionVariableOrigin::~~Late~~BoundRegion` - `~~Late~~BoundRegionConversionTime`
2023-11-13rename `ReLateBound` to `ReBound`lcnr-17/+17
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
2023-11-13args~~_ref~~_may_unifylcnr-6/+4
2023-11-12Small improvements in object lifetime default codeNilstrieb-7/+2
I found those while trying to understand how the code works.
2023-11-09Auto merge of #117712 - lcnr:expand-coroutine, r=jackh726bors-0/+3
generator layout: ignore fake borrows fixes #117059 We emit fake shallow borrows in case the scrutinee place uses a `Deref` and there is a match guard. This is necessary to prevent the match guard from mutating the scrutinee: https://github.com/rust-lang/rust/blob/fab1054e1742790c22ccc92a625736d658363677/compiler/rustc_mir_build/src/build/matches/mod.rs#L1250-L1265 These fake borrows end up impacting the generator witness computation in `mir_generator_witnesses`, which causes the issue in #117059. This PR now completely ignores fake borrows during this computation. This is sound as thse are always removed after analysis and the actual computation of the generator layout happens afterwards. Only the second commit impacts behavior, and could be backported by itself. r? types
2023-11-09remove stability assert in `evaluate_goal`lcnr-98/+8
2023-11-09update overflow handling for norm, add testlcnr-2/+2
2023-11-09rework alias-relate to `norm(lhs) == norm(rhs)`lcnr-165/+140
2023-11-09only instantiate opaques with rigid typeslcnr-17/+22
2023-11-09`try_normalize_ty` end with rigid alias on failurelcnr-30/+136
2023-11-09Rollup merge of #117645 - compiler-errors:auto-trait-subst, r=petrochenkovTakayuki Maeda-6/+15
Extend builtin/auto trait args with error when they have >1 argument Reuse `extend_with_error` to add error args to any auto trait (or built-in trait like `Copy` that is defined incorrectly) that has additional non-`Self` args. Fixes #117628
2023-11-08instrument constituent types computationlcnr-0/+3
2023-11-08Rollup merge of #113925 - clubby789:const-ctor-repeat, r=estebankMatthias Krüger-9/+20
Improve diagnostic for const ctors in array repeat expressions Fixes #113912
2023-11-06Don't instantiate the binder twice when assembling object candidateMichael Goulet-17/+7
2023-11-06Only check predicates for late-bound non-lifetime vars in object candidate ↵Michael Goulet-1/+4
assembly
2023-11-06Extend builtin/auto trait args with error when they have >1 argumentMichael Goulet-6/+15
2023-11-06Auto merge of #117585 - dnbln:feat/move-kw-span, r=cjgillotbors-1/+1
Add the `Span` of the `move` keyword to the HIR. This is required to implement a lint like the one described here: https://github.com/rust-lang/rust-clippy/issues/11721
2023-11-04Rollup merge of #117583 - compiler-errors:placeholderconst-lifetime, r=cjgillotMatthias Krüger-5/+5
Remove `'tcx` lifetime on `PlaceholderConst` The `'tcx` lifetime is not needed for anything, so this is a continuation of #117139.
2023-11-04Fix remaining uses of `CaptureBy::Value`Dinu Blanovschi-1/+1
2023-11-04No lifetime on PlaceholderConstMichael Goulet-5/+5
2023-11-03Auto merge of #117507 - nnethercote:rustc_span, r=Nilstriebbors-4/+3
`rustc_span` cleanups Just some things I found while looking over this crate. r? `@oli-obk`
2023-11-03Auto merge of #116439 - compiler-errors:on-unimplemented, r=davidtwcobors-0/+14
Pretty print `Fn` traits in `rustc_on_unimplemented` I don't think that users really ever should need to think about `Fn*` traits' tupled args for a simple trait error. r? diagnostics
2023-11-02Auto merge of #117134 - lcnr:dropck_outlives-coroutine, r=compiler-errorsbors-13/+22
dropck_outlives check whether generator witness needs_drop see https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/.23116242.3A.20Code.20no.20longer.20compiles.20after.20-Zdrop-tracking-mir.20.E2.80.A6/near/398311627 for an explanation. Fixes #116242 (or well, the repro by `@jamuraa` in https://github.com/rust-lang/rust/issues/116242#issuecomment-1739802047). I did not add a regression test as it depends on other crates. We do have 1 test going from fail to pass, showing the intended behavior. r? types
2023-11-02Pretty print Fn traits in rustc_on_unimplementedMichael Goulet-0/+14
2023-11-02only erase param env regions where neededlcnr-1/+1
2023-11-02dropck_outlives check generator witness needs_droplcnr-13/+22
2023-11-02Rollup merge of #117394 - lcnr:proof-tree-cache4, r=compiler-errorsMatthias Krüger-99/+96
use global cache when computing proof trees we're writing the solver while relying on the existence of the global cache to avoid exponential blowup. By disabling the global cache when building proof trees, it is easy to get hangs, e.g. when computing intercrate ambiguity causes. Removes the unstable `-Zdump_solver_proof_tree_use_cache` option, as we now always return a full proof tree. r? `@compiler-errors`
2023-11-02use global cache when computing proof treeslcnr-99/+96
2023-11-02Minimize `pub` usage in `source_map.rs`.Nicholas Nethercote-4/+3
Most notably, this commit changes the `pub use crate::*;` in that file to `use crate::*;`. This requires a lot of `use` items in other crates to be adjusted, because everything defined within `rustc_span::*` was also available via `rustc_span::source_map::*`, which is bizarre. The commit also removes `SourceMap::span_to_relative_line_string`, which is unused.
2023-10-31Auto merge of #117419 - compiler-errors:gen, r=oli-obkbors-23/+24
Some more coroutine renamings a few places where `gen_` names leaked through but should be coroutine. r? oli-obk
2023-10-30Some more coroutine renamingsMichael Goulet-23/+24
2023-10-30Auto merge of #116405 - estebank:issue-103155, r=davidtwcobors-2/+2
Detect object safety errors when assoc type is missing When an associated type with GATs isn't specified in a `dyn Trait`, emit an object safety error instead of only complaining about the missing associated type, as it will lead the user down a path of three different errors before letting them know that what they were trying to do is impossible to begin with. Fix #103155.