forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#105644 - matthiaskrgr:rollup-qc6hlzq, r=matth…
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#104864 (Account for item-local in inner scope for E0425) - rust-lang#105332 (Point out the type of associated types in every method call of iterator chains) - rust-lang#105620 (Remove unnecessary uses of `clone`) - rust-lang#105625 (minor code cleanups) - rust-lang#105629 (rustdoc: stop treating everything in a trait item as a method) - rust-lang#105636 (Add check for local-storage value when changing "display line numbers" settings) - rust-lang#105639 (rustdoc: remove `type="text/css" from stylesheet links) - rust-lang#105640 (Adjust miri to still be optional) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
60 changed files
with
865 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
compiler/rustc_trait_selection/src/traits/error_reporting/method_chain.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
use crate::infer::InferCtxt; | ||
|
||
use rustc_middle::ty::error::TypeError; | ||
use rustc_middle::ty::relate::{self, Relate, RelateResult, TypeRelation}; | ||
use rustc_middle::ty::{self, Ty, TyCtxt}; | ||
|
||
pub struct CollectAllMismatches<'a, 'tcx> { | ||
pub infcx: &'a InferCtxt<'tcx>, | ||
pub param_env: ty::ParamEnv<'tcx>, | ||
pub errors: Vec<TypeError<'tcx>>, | ||
} | ||
|
||
impl<'a, 'tcx> TypeRelation<'tcx> for CollectAllMismatches<'a, 'tcx> { | ||
fn tag(&self) -> &'static str { | ||
"CollectAllMismatches" | ||
} | ||
fn tcx(&self) -> TyCtxt<'tcx> { | ||
self.infcx.tcx | ||
} | ||
fn intercrate(&self) -> bool { | ||
false | ||
} | ||
fn param_env(&self) -> ty::ParamEnv<'tcx> { | ||
self.param_env | ||
} | ||
fn a_is_expected(&self) -> bool { | ||
true | ||
} // irrelevant | ||
fn mark_ambiguous(&mut self) { | ||
bug!() | ||
} | ||
fn relate_with_variance<T: Relate<'tcx>>( | ||
&mut self, | ||
_: ty::Variance, | ||
_: ty::VarianceDiagInfo<'tcx>, | ||
a: T, | ||
b: T, | ||
) -> RelateResult<'tcx, T> { | ||
self.relate(a, b) | ||
} | ||
fn regions( | ||
&mut self, | ||
a: ty::Region<'tcx>, | ||
_b: ty::Region<'tcx>, | ||
) -> RelateResult<'tcx, ty::Region<'tcx>> { | ||
Ok(a) | ||
} | ||
fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { | ||
if a == b || matches!(a.kind(), ty::Infer(_)) || matches!(b.kind(), ty::Infer(_)) { | ||
return Ok(a); | ||
} | ||
relate::super_relate_tys(self, a, b).or_else(|e| { | ||
self.errors.push(e); | ||
Ok(a) | ||
}) | ||
} | ||
fn consts( | ||
&mut self, | ||
a: ty::Const<'tcx>, | ||
b: ty::Const<'tcx>, | ||
) -> RelateResult<'tcx, ty::Const<'tcx>> { | ||
if a == b { | ||
return Ok(a); | ||
} | ||
relate::super_relate_consts(self, a, b) // could do something similar here for constants! | ||
} | ||
fn binders<T: Relate<'tcx>>( | ||
&mut self, | ||
a: ty::Binder<'tcx, T>, | ||
b: ty::Binder<'tcx, T>, | ||
) -> RelateResult<'tcx, ty::Binder<'tcx, T>> { | ||
Ok(a.rebind(self.relate(a.skip_binder(), b.skip_binder())?)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.