Auto merge of #119945 - matthiaskrgr:rollup-oy3e1j2, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #119189 (Move section "Installing from Source" to seperate file) - #119925 (store the segment name when resolution fails) - #119935 (Move personality implementation out of PAL) - #119937 (Improve UEFI target docs) - #119938 (Allow unauthorized users to user the has-merge-commits label) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
3deb9bbf84
24 changed files with 346 additions and 310 deletions
|
@ -786,7 +786,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
ResolutionError::SelfImportOnlyInImportListWithNonEmptyPrefix => {
|
||||
self.dcx().create_err(errs::SelfImportOnlyInImportListWithNonEmptyPrefix { span })
|
||||
}
|
||||
ResolutionError::FailedToResolve { last_segment, label, suggestion, module } => {
|
||||
ResolutionError::FailedToResolve { segment, label, suggestion, module } => {
|
||||
let mut err =
|
||||
struct_span_code_err!(self.dcx(), span, E0433, "failed to resolve: {}", &label);
|
||||
err.span_label(span, label);
|
||||
|
@ -801,9 +801,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
|
||||
if let Some(ModuleOrUniformRoot::Module(module)) = module
|
||||
&& let Some(module) = module.opt_def_id()
|
||||
&& let Some(last_segment) = last_segment
|
||||
&& let Some(segment) = segment
|
||||
{
|
||||
self.find_cfg_stripped(&mut err, &last_segment, module);
|
||||
self.find_cfg_stripped(&mut err, &segment, module);
|
||||
}
|
||||
|
||||
err
|
||||
|
@ -981,12 +981,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
}
|
||||
VisResolutionError::FailedToResolve(span, label, suggestion) => self.into_struct_error(
|
||||
span,
|
||||
ResolutionError::FailedToResolve {
|
||||
last_segment: None,
|
||||
label,
|
||||
suggestion,
|
||||
module: None,
|
||||
},
|
||||
ResolutionError::FailedToResolve { segment: None, label, suggestion, module: None },
|
||||
),
|
||||
VisResolutionError::ExpectedFound(span, path_str, res) => {
|
||||
self.dcx().create_err(errs::ExpectedFound { span, res, path_str })
|
||||
|
@ -2450,7 +2445,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
pub(crate) fn find_cfg_stripped(
|
||||
&mut self,
|
||||
err: &mut Diagnostic,
|
||||
last_segment: &Symbol,
|
||||
segment: &Symbol,
|
||||
module: DefId,
|
||||
) {
|
||||
let local_items;
|
||||
|
@ -2469,7 +2464,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
};
|
||||
|
||||
for &StrippedCfgItem { parent_module, name, ref cfg } in symbols {
|
||||
if parent_module != module || name.name != *last_segment {
|
||||
if parent_module != module || name.name != *segment {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1381,13 +1381,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
return PathResult::failed(
|
||||
ident.span,
|
||||
false,
|
||||
finalize.is_some(),
|
||||
module,
|
||||
|| ("there are too many leading `super` keywords".to_string(), None),
|
||||
);
|
||||
return PathResult::failed(ident, false, finalize.is_some(), module, || {
|
||||
("there are too many leading `super` keywords".to_string(), None)
|
||||
});
|
||||
}
|
||||
if segment_idx == 0 {
|
||||
if name == kw::SelfLower {
|
||||
|
@ -1419,7 +1415,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
|
||||
// Report special messages for path segment keywords in wrong positions.
|
||||
if ident.is_path_segment_keyword() && segment_idx != 0 {
|
||||
return PathResult::failed(ident.span, false, finalize.is_some(), module, || {
|
||||
return PathResult::failed(ident, false, finalize.is_some(), module, || {
|
||||
let name_str = if name == kw::PathRoot {
|
||||
"crate root".to_string()
|
||||
} else {
|
||||
|
@ -1515,7 +1511,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
));
|
||||
} else {
|
||||
return PathResult::failed(
|
||||
ident.span,
|
||||
ident,
|
||||
is_last,
|
||||
finalize.is_some(),
|
||||
module,
|
||||
|
@ -1541,24 +1537,18 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
return PathResult::failed(
|
||||
ident.span,
|
||||
is_last,
|
||||
finalize.is_some(),
|
||||
module,
|
||||
|| {
|
||||
self.report_path_resolution_error(
|
||||
path,
|
||||
opt_ns,
|
||||
parent_scope,
|
||||
ribs,
|
||||
ignore_binding,
|
||||
module,
|
||||
segment_idx,
|
||||
ident,
|
||||
)
|
||||
},
|
||||
);
|
||||
return PathResult::failed(ident, is_last, finalize.is_some(), module, || {
|
||||
self.report_path_resolution_error(
|
||||
path,
|
||||
opt_ns,
|
||||
parent_scope,
|
||||
ribs,
|
||||
ignore_binding,
|
||||
module,
|
||||
segment_idx,
|
||||
ident,
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -886,6 +886,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
PathResult::Failed {
|
||||
is_error_from_last_segment: false,
|
||||
span,
|
||||
segment_name,
|
||||
label,
|
||||
suggestion,
|
||||
module,
|
||||
|
@ -895,7 +896,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
self.report_error(
|
||||
span,
|
||||
ResolutionError::FailedToResolve {
|
||||
last_segment: None,
|
||||
segment: Some(segment_name),
|
||||
label,
|
||||
suggestion,
|
||||
module,
|
||||
|
|
|
@ -4054,11 +4054,12 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
|||
label,
|
||||
suggestion,
|
||||
module,
|
||||
segment_name,
|
||||
} => {
|
||||
return Err(respan(
|
||||
span,
|
||||
ResolutionError::FailedToResolve {
|
||||
last_segment: None,
|
||||
segment: Some(segment_name),
|
||||
label,
|
||||
suggestion,
|
||||
module,
|
||||
|
|
|
@ -213,7 +213,7 @@ enum ResolutionError<'a> {
|
|||
SelfImportOnlyInImportListWithNonEmptyPrefix,
|
||||
/// Error E0433: failed to resolve.
|
||||
FailedToResolve {
|
||||
last_segment: Option<Symbol>,
|
||||
segment: Option<Symbol>,
|
||||
label: String,
|
||||
suggestion: Option<Suggestion>,
|
||||
module: Option<ModuleOrUniformRoot<'a>>,
|
||||
|
@ -396,12 +396,14 @@ enum PathResult<'a> {
|
|||
suggestion: Option<Suggestion>,
|
||||
is_error_from_last_segment: bool,
|
||||
module: Option<ModuleOrUniformRoot<'a>>,
|
||||
/// The segment name of target
|
||||
segment_name: Symbol,
|
||||
},
|
||||
}
|
||||
|
||||
impl<'a> PathResult<'a> {
|
||||
fn failed(
|
||||
span: Span,
|
||||
ident: Ident,
|
||||
is_error_from_last_segment: bool,
|
||||
finalize: bool,
|
||||
module: Option<ModuleOrUniformRoot<'a>>,
|
||||
|
@ -409,7 +411,14 @@ impl<'a> PathResult<'a> {
|
|||
) -> PathResult<'a> {
|
||||
let (label, suggestion) =
|
||||
if finalize { label_and_suggestion() } else { (String::new(), None) };
|
||||
PathResult::Failed { span, label, suggestion, is_error_from_last_segment, module }
|
||||
PathResult::Failed {
|
||||
span: ident.span,
|
||||
segment_name: ident.name,
|
||||
label,
|
||||
suggestion,
|
||||
is_error_from_last_segment,
|
||||
module,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -773,7 +773,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
self.report_error(
|
||||
span,
|
||||
ResolutionError::FailedToResolve {
|
||||
last_segment: path.last().map(|segment| segment.ident.name),
|
||||
segment: path.last().map(|segment| segment.ident.name),
|
||||
label,
|
||||
suggestion,
|
||||
module,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue