8000 Rollup of 14 pull requests by Noratrieb · Pull Request #109439 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 14 pull requests #109439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 55 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
920435f
Windows: make Command prefer non-verbatim paths
ChrisDenton Dec 2, 2022
01d6c04
Link to Option/Result for `Iterator::sum/product`
clubby789 Jan 4, 2023
d7049ca
add the --json flag to compiletest
pietroalbini Mar 1, 2023
d2f3806
render compiletest output with render_tests
pietroalbini Mar 2, 2023
f96774b
add support for terse output
pietroalbini Mar 2, 2023
f816d3a
add a splash of color
pietroalbini Mar 2, 2023
9388c8e
record tests in build metrics
pietroalbini Mar 2, 2023
b14b355
add support for benchmarks
pietroalbini Mar 2, 2023
50b3583
switch all tests to use render_tests
pietroalbini Mar 2, 2023
ad9a444
avoid overlapping stderr
pietroalbini Mar 2, 2023
f23e205
do not use render_tests for clippy
pietroalbini Mar 2, 2023
9a1ff1b
handle non-json output in stdout
pietroalbini Mar 3, 2023
4958272
change approach to prevent interleaving compiletest message
pietroalbini Mar 3, 2023
3248ab7
fix name of the field containing the ignore reason
pietroalbini Mar 6, 2023
c015d0d
switch to termcolor
pietroalbini Mar 7, 2023
0a1b983
add dist.compression-profile option to control compression speed
pietroalbini Mar 14, 2023
4556037
use the best compression profile in CI
pietroalbini Mar 14, 2023
ed63201
replace usage of `evaluate_goal` with a new `add_goal`
BoxyUwU Mar 16, 2023
ee31e5f
review nits
BoxyUwU Mar 17, 2023
ea08d3a
add assert
BoxyUwU Mar 17, 2023
ce14a1e
add comments
BoxyUwU Mar 17, 2023
e06c62c
UNACEPTABLE
BoxyUwU Mar 17, 2023
aa8de17
fix let else unformatting
BoxyUwU Mar 17, 2023
e624ef4
replace chain with two `add_goal`
BoxyUwU Mar 17, 2023
9df35a5
fix bad assertion
BoxyUwU Mar 17, 2023
b85bc19
move `compute_goal` and `evaluate_x` methods to inner module
BoxyUwU Mar 17, 2023
f7a9702
rustdoc: Cleanup parent module tracking for doc links
petrochenkov Mar 18, 2023
ae47810
rustdoc: Factor out some doc link resolution code into a separate fun…
petrochenkov Mar 19, 2023
69a82f7
add myself to mailmap
aDotInTheVoid Mar 19, 2023
9f80c75
Walk un-shifted nested `impl Trait` in trait when setting up default …
compiler-errors Mar 16, 2023
239ec6c
drive-by: Fix a comment in TyCtxt::fold_regions and remove an unused …
compiler-errors Mar 17, 2023
5b4fa5b
fix typo
lcnr Mar 20, 2023
8e4e55e
Support aggregate expressions
cbeuw Mar 20, 2023
e24f5ac
Fix off-by-one in mir syntax doc
cbeuw Mar 20, 2023
f404f33
Use builtin_index instead of match
cbeuw Mar 20, 2023
e4a4064
adapt tests/codegen/vec-shrink-panik for LLVM 17
krasimirgg Mar 20, 2023
f321144
Add example for `Option::product` and `Result::product`
clubby789 Jan 4, 2023
5058cc8
not *all* retags might be explicit in Runtime MIR
RalfJung Mar 20, 2023
93eeb12
Refactor `handle_missing_lit`.
nnethercote Feb 1, 2023
720cc40
Enforce non-lifetime-binders in supertrait preds are not object safe
compiler-errors Mar 7, 2023
0177176
change default to fast for everyone but the user profile
pietroalbini Mar 21, 2023
4f0c7ba
Rollup merge of #96391 - ChrisDenton:command-non-verbatim, r=joshtrip…
Noratrieb Mar 21, 2023
07af691
Rollup merge of #106434 - clubby789:document-sum-result, r=the8472
Noratrieb Mar 21, 2023
748959d
Rollup merge of #108659 - ferrocene:pa-test-metrics, r=Mark-Simulacrum
Noratrieb Mar 21, 2023
d6318b7
Rollup merge of #108842 - compiler-errors:non_lifetime_binders-object…
Noratrieb Mar 21, 2023
ffe8203
Rollup merge of #108896 - BoxyUwU:new_solver_add_goal_fn, r=lcnr
Noratrieb Mar 21, 2023
ee2bb70
Rollup merge of #109124 - ferrocene:pa-compression-mode, r=Mark-Simul…
Noratrieb Mar 21, 2023
dd395eb
Rollup merge of #109240 - compiler-errors:dont-binder-twice, r=oli-obk
Noratrieb Mar 21, 2023
c0648d6
Rollup merge of #109312 - petrochenkov:docice5, r=GuillaumeGomez
Noratrieb Mar 21, 2023
9408e1c
Rollup merge of #109385 - lcnr:typo, r=Dylan-DPC
Noratrieb Mar 21, 2023
5e93647
Rollup merge of #109386 - aDotInTheVoid:mailmap, r=WaffleLapkin
Noratrieb Mar 21, 2023
d891385
Rollup merge of #109390 - cbeuw:aggregate-lit, r=oli-obk
Noratrieb Mar 21, 2023
4b21fe2
Rollup merge of #109394 - krasimirgg:llvm-17-vec-panic, r=nikic
Noratrieb Mar 21, 2023
fa98cb2
Rollup merge of #109408 - RalfJung:retags, r=compiler-errors
Noratrieb Mar 21, 2023
a0cb748
Rollup merge of #109415 - nnethercote:refactor-handle_missing_lit, r=…
Noratrieb Mar 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Walk un-shifted nested impl Trait in trait when setting up default …
…trait method assumptions
  • Loading branch information
compiler-errors committed Mar 20, 2023
commit 9f80c75703a7497241d9d1d072969f44f136597c
42 changes: 26 additions & 16 deletions compiler/rustc_ty_utils/src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use rustc_middle::ty::{
TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor,
};
use rustc_session::config::TraitSolver;
use rustc_span::def_id::{DefId, CRATE_DEF_ID};
use rustc_span::{
def_id::{DefId, CRATE_DEF_ID},
DUMMY_SP,
};
use rustc_trait_selection::traits;

fn sized_constraint_for_ty<'tcx>(
Expand Down Expand Up @@ -275,16 +278,22 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx> {
}

fn visit_ty(&mut self, ty: Ty<'tcx>) -> std::ops::ControlFlow<Self::BreakTy> {
if let ty::Alias(ty::Projection, alias_ty) = *ty.kind()
&& self.tcx.is_impl_trait_in_trait(alias_ty.def_id)
&& self.tcx.impl_trait_in_trait_parent_fn(alias_ty.def_id) == self.fn_def_id
&& self.seen.insert(alias_ty.def_id)
if let ty::Alias(ty::Projection, unshifted_alias_ty) = *ty.kind()
&& self.tcx.is_impl_trait_in_trait(unshifted_alias_ty.def_id)
&& self.tcx.impl_trait_in_trait_parent_fn(unshifted_alias_ty.def_id) == self.fn_def_id
&& self.seen.insert(unshifted_alias_ty.def_id)
{
// We have entered some binders as we've walked into the
// bounds of the RPITIT. Shift these binders back out when
// constructing the top-level projection predicate.
let alias_ty = self.tcx.fold_regions(alias_ty, |re, _| {
let shifted_alias_ty = self.tcx.fold_regions(unshifted_alias_ty, |re, depth| {
if let ty::ReLateBound(index, bv) = re.kind() {
if depth != ty::INNERMOST {
return self.tcx.mk_re_error_with_message(
DUMMY_SP,
"we shouldn't walk non-predicate binders with `impl Trait`...",
);
}
self.tcx.mk_re_late_bound(index.shifted_out_to_binder(self.depth), bv)
} else {
re
Expand All @@ -295,26 +304,27 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx> {
// the `type_of` of the trait's associated item. If we're using the old lowering
// strategy, then just reinterpret the associated type like an opaque :^)
let default_ty = if self.tcx.lower_impl_trait_in_trait_to_assoc_ty() {
self
.tcx
.type_of(alias_ty.def_id)
.subst(self.tcx, alias_ty.substs)
self.tcx.type_of(shifted_alias_ty.def_id).subst(self.tcx, shifted_alias_ty.substs)
} else {
self.tcx.mk_alias(ty::Opaque, alias_ty)
self.tcx.mk_alias(ty::Opaque, shifted_alias_ty)
};

self.predicates.push(
ty::Binder::bind_with_vars(
ty::ProjectionPredicate {
projection_ty: alias_ty,
term: default_ty.into(),
},
ty::ProjectionPredicate { projection_ty: shifted_alias_ty, term: default_ty.into() },
self.bound_vars,
)
.to_predicate(self.tcx),
);

for bound in self.tcx.item_bounds(alias_ty.def_id).subst_iter(self.tcx, alias_ty.substs)
// We walk the *un-shifted* alias ty, because we're tracking the de bruijn
// binder depth, and if we were to walk `shifted_alias_ty` instead, we'd
// have to reset `self.depth` back to `ty::INNERMOST` or something. It's
// easier to just do this.
for bound in self
.tcx
.item_bounds(unshifted_alias_ty.def_id)
.subst_iter(self.tcx, unshifted_alias_ty.substs)
{
bound.visit_with(self);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ trait Trait {
fn method(&self) -> impl Trait<Type = impl Sized + '_>;
}

trait Trait2 {
type Type;

fn method(&self) -> impl Trait2<Type = impl Trait2<Type = impl Sized + '_> + '_>;
}

fn main() {}
0