-
Notifications
You must be signed in to change notification settings - Fork 13k
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 #107650 - compiler-errors:rollup-4pntchf, r=compiler-er…
…rors Rollup of 8 pull requests Successful merges: - #106887 (Make const/fn return params more suggestable) - #107519 (Add type alias for raw OS errors) - #107551 ( Replace `ConstFnMutClosure` with const closures ) - #107595 (Retry opening proc-macro DLLs a few times on Windows.) - #107615 (Replace nbsp in all rustdoc code blocks) - #107621 (Intern external constraints in new solver) - #107631 (loudly tell people when they change `Cargo.lock`) - #107632 (Clarifying that .map() returns None if None.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
44 changed files
with
391 additions
and
249 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use std::ops::ControlFlow; | ||
|
||
use rustc_data_structures::intern::Interned; | ||
|
||
use crate::ty::{FallibleTypeFolder, Ty, TypeFoldable, TypeFolder, TypeVisitable, TypeVisitor}; | ||
|
||
#[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)] | ||
pub struct ExternalConstraints<'tcx>(pub(crate) Interned<'tcx, ExternalConstraintsData<'tcx>>); | ||
|
||
impl<'tcx> std::ops::Deref for ExternalConstraints<'tcx> { | ||
type Target = ExternalConstraintsData<'tcx>; | ||
|
||
fn deref(&self) -> &Self::Target { | ||
&*self.0 | ||
} | ||
} | ||
|
||
/// Additional constraints returned on success. | ||
#[derive(Debug, PartialEq, Eq, Clone, Hash, Default)] | ||
pub struct ExternalConstraintsData<'tcx> { | ||
// FIXME: implement this. | ||
pub regions: (), | ||
pub opaque_types: Vec<(Ty<'tcx>, Ty<'tcx>)>, | ||
} | ||
|
||
impl<'tcx> TypeFoldable<'tcx> for ExternalConstraints<'tcx> { | ||
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> { | ||
Ok(FallibleTypeFolder::tcx(folder).intern_external_constraints(ExternalConstraintsData { | ||
regions: (), | ||
opaque_types: self | ||
.opaque_types | ||
.iter() | ||
.map(|opaque| opaque.try_fold_with(folder)) | ||
.collect::<Result<_, F::Error>>()?, | ||
})) | ||
} | ||
|
||
fn fold_with<F: TypeFolder<'tcx>>(self, folder: &mut F) -> Self { | ||
TypeFolder::tcx(folder).intern_external_constraints(ExternalConstraintsData { | ||
regions: (), | ||
opaque_types: self.opaque_types.iter().map(|opaque| opaque.fold_with(folder)).collect(), | ||
}) | ||
} | ||
} | ||
|
||
impl<'tcx> TypeVisitable<'tcx> for ExternalConstraints<'tcx> { | ||
fn visit_with<V: TypeVisitor<'tcx>>( | ||
&self, | ||
visitor: &mut V, | ||
) -> std::ops::ControlFlow<V::BreakTy> { | ||
self.regions.visit_with(visitor)?; | ||
self.opaque_types.visit_with(visitor)?; | ||
ControlFlow::Continue(()) | ||
} | ||
} |
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.