Auto merge of #131723 - matthiaskrgr:rollup-krcslig, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #122670 (Fix bug where `option_env!` would return `None` when env var is present but not valid Unicode) - #131095 (Use environment variables instead of command line arguments for merged doctests) - #131339 (Expand set_ptr_value / with_metadata_of docs) - #131652 (Move polarity into `PolyTraitRef` rather than storing it on the side) - #131675 (Update lint message for ABI not supported) - #131681 (Fix up-to-date checking for run-make tests) - #131702 (Suppress import errors for traits that couldve applied for method lookup error) - #131703 (Resolved python deprecation warning in publish_toolstate.py) - #131710 (Remove `'apostrophes'` from `rustc_parse_format`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
f79fae3069
93 changed files with 558 additions and 420 deletions
|
@ -519,11 +519,12 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|
|||
continue;
|
||||
};
|
||||
for bound in bounds {
|
||||
let ast::GenericBound::Trait(trait_ref, ast::TraitBoundModifiers::NONE) = bound
|
||||
else {
|
||||
let ast::GenericBound::Trait(trait_ref) = bound else {
|
||||
continue;
|
||||
};
|
||||
if base_error.span == trait_ref.span {
|
||||
if trait_ref.modifiers == ast::TraitBoundModifiers::NONE
|
||||
&& base_error.span == trait_ref.span
|
||||
{
|
||||
err.span_suggestion_verbose(
|
||||
constraint.ident.span.between(trait_ref.span),
|
||||
"you might have meant to write a path instead of an associated type bound",
|
||||
|
@ -837,7 +838,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|
|||
);
|
||||
if bounds.iter().all(|bound| match bound {
|
||||
ast::GenericBound::Outlives(_) | ast::GenericBound::Use(..) => true,
|
||||
ast::GenericBound::Trait(tr, _) => tr.span == base_error.span,
|
||||
ast::GenericBound::Trait(tr) => tr.span == base_error.span,
|
||||
}) {
|
||||
let mut sugg = vec![];
|
||||
if base_error.span != start_span {
|
||||
|
@ -1210,7 +1211,8 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|
|||
let param = generics.params.iter().find_map(|param| {
|
||||
// Only consider type params with exactly one trait bound.
|
||||
if let [bound] = &*param.bounds
|
||||
&& let ast::GenericBound::Trait(tref, ast::TraitBoundModifiers::NONE) = bound
|
||||
&& let ast::GenericBound::Trait(tref) = bound
|
||||
&& tref.modifiers == ast::TraitBoundModifiers::NONE
|
||||
&& tref.span == span
|
||||
&& param.ident.span.eq_ctxt(span)
|
||||
{
|
||||
|
@ -1333,8 +1335,9 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|
|||
}
|
||||
if let (
|
||||
[ast::PathSegment { args: None, .. }],
|
||||
[ast::GenericBound::Trait(poly_trait_ref, ast::TraitBoundModifiers::NONE)],
|
||||
[ast::GenericBound::Trait(poly_trait_ref)],
|
||||
) = (&type_param_path.segments[..], &bounds[..])
|
||||
&& poly_trait_ref.modifiers == ast::TraitBoundModifiers::NONE
|
||||
{
|
||||
if let [ast::PathSegment { ident, args: None, .. }] =
|
||||
&poly_trait_ref.trait_ref.path.segments[..]
|
||||
|
@ -2814,7 +2817,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|
|||
&& bounded_ty.id == binder
|
||||
{
|
||||
for bound in bounds {
|
||||
if let ast::GenericBound::Trait(poly_trait_ref, _) = bound
|
||||
if let ast::GenericBound::Trait(poly_trait_ref) = bound
|
||||
&& let span = poly_trait_ref
|
||||
.span
|
||||
.with_hi(poly_trait_ref.trait_ref.path.span.lo())
|
||||
|
@ -3233,7 +3236,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|
|||
let mut lt_finder =
|
||||
LifetimeFinder { lifetime: lt.span, found: None, seen: vec![] };
|
||||
for bound in arg_refs {
|
||||
if let ast::GenericBound::Trait(trait_ref, _) = bound {
|
||||
if let ast::GenericBound::Trait(trait_ref) = bound {
|
||||
lt_finder.visit_trait_ref(&trait_ref.trait_ref);
|
||||
}
|
||||
}
|
||||
|
@ -3444,17 +3447,15 @@ fn mk_where_bound_predicate(
|
|||
span: DUMMY_SP,
|
||||
bound_generic_params: ThinVec::new(),
|
||||
bounded_ty: ast::ptr::P(ty.clone()),
|
||||
bounds: vec![ast::GenericBound::Trait(
|
||||
ast::PolyTraitRef {
|
||||
bound_generic_params: ThinVec::new(),
|
||||
trait_ref: ast::TraitRef {
|
||||
path: ast::Path { segments: modified_segments, span: DUMMY_SP, tokens: None },
|
||||
ref_id: DUMMY_NODE_ID,
|
||||
},
|
||||
span: DUMMY_SP,
|
||||
bounds: vec![ast::GenericBound::Trait(ast::PolyTraitRef {
|
||||
bound_generic_params: ThinVec::new(),
|
||||
modifiers: ast::TraitBoundModifiers::NONE,
|
||||
trait_ref: ast::TraitRef {
|
||||
path: ast::Path { segments: modified_segments, span: DUMMY_SP, tokens: None },
|
||||
ref_id: DUMMY_NODE_ID,
|
||||
},
|
||||
ast::TraitBoundModifiers::NONE,
|
||||
)],
|
||||
span: DUMMY_SP,
|
||||
})],
|
||||
};
|
||||
|
||||
Some(new_where_bound_predicate)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue