Skip to content

[beta] Rollup backports #56077

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 10 commits into from
3 changes: 3 additions & 0 deletions src/doc/rustdoc/src/the-doc-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ mod bar {

Now we'll have a `Re-exports` line, and `Bar` will not link to anywhere.

One special case: In Rust 2018 and later, if you `pub use` one of your dependencies, `rustdoc` will
not eagerly inline it as a module unless you add `#[doc(inline)}`.

## `#[doc(hidden)]`

Any item annotated with `#[doc(hidden)]` will not appear in the documentation, unless
Expand Down
30 changes: 23 additions & 7 deletions src/librustc/infer/outlives/obligations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,22 +388,38 @@ where
// rule might not apply (but another rule might). For now, we err
// on the side of adding too few edges into the graph.

// Compute the bounds we can derive from the trait definition.
// These are guaranteed to apply, no matter the inference
// results.
let trait_bounds: Vec<_> = self.verify_bound
.projection_declared_bounds_from_trait(projection_ty)
.collect();

// Compute the bounds we can derive from the environment. This
// is an "approximate" match -- in some cases, these bounds
// may not apply.
let approx_env_bounds = self.verify_bound
let mut approx_env_bounds = self.verify_bound
.projection_approx_declared_bounds_from_env(projection_ty);
debug!(
"projection_must_outlive: approx_env_bounds={:?}",
approx_env_bounds
);

// Compute the bounds we can derive from the trait definition.
// These are guaranteed to apply, no matter the inference
// results.
let trait_bounds: Vec<_> = self.verify_bound
.projection_declared_bounds_from_trait(projection_ty)
.collect();
// Remove outlives bounds that we get from the environment but
// which are also deducable from the trait. This arises (cc
// #55756) in cases where you have e.g. `<T as Foo<'a>>::Item:
// 'a` in the environment but `trait Foo<'b> { type Item: 'b
// }` in the trait definition.
approx_env_bounds.retain(|bound| {
match bound.0.sty {
ty::Projection(projection_ty) => {
self.verify_bound.projection_declared_bounds_from_trait(projection_ty)
.all(|r| r != bound.1)
}

_ => panic!("expected only projection types from env, not {:?}", bound.0),
}
});

// If declared bounds list is empty, the only applicable rule is
// OutlivesProjectionComponent. If there are inference variables,
Expand Down
7 changes: 5 additions & 2 deletions src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,9 +1020,12 @@ impl<'a> ast_visit::Visitor<'a> for EarlyContext<'a> {
}

fn visit_pat(&mut self, p: &'a ast::Pat) {
run_lints!(self, check_pat, p);
let mut visit_subpats = true;
run_lints!(self, check_pat, p, &mut visit_subpats);
self.check_id(p.id);
ast_visit::walk_pat(self, p);
if visit_subpats {
ast_visit::walk_pat(self, p);
}
}

fn visit_expr(&mut self, e: &'a ast::Expr) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ pub trait EarlyLintPass: LintPass {
fn check_block_post(&mut self, _: &EarlyContext<'_>, _: &ast::Block) { }
fn check_stmt(&mut self, _: &EarlyContext<'_>, _: &ast::Stmt) { }
fn check_arm(&mut self, _: &EarlyContext<'_>, _: &ast::Arm) { }
fn check_pat(&mut self, _: &EarlyContext<'_>, _: &ast::Pat) { }
fn check_pat(&mut self, _: &EarlyContext<'_>, _: &ast::Pat, _: &mut bool) { }
fn check_expr(&mut self, _: &EarlyContext<'_>, _: &ast::Expr) { }
fn check_expr_post(&mut self, _: &EarlyContext<'_>, _: &ast::Expr) { }
fn check_ty(&mut self, _: &EarlyContext<'_>, _: &ast::Ty) { }
Expand Down
Loading