mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Auto merge of #117103 - matthiaskrgr:rollup-96zuuom, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #107159 (rand use getrandom for freebsd (available since 12.x)) - #116859 (Make `ty::print::Printer` take `&mut self` instead of `self`) - #117046 (return unfixed len if pat has reported error) - #117070 (rustdoc: wrap Type with Box instead of Generics) - #117074 (Remove smir from triage and add me to stablemir) - #117086 (Update .mailmap to promote my livename) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
f654229c27
2
.mailmap
2
.mailmap
@ -31,6 +31,8 @@ Alexis Beingessner <a.beingessner@gmail.com>
|
||||
Alfie John <alfie@alfie.wtf> Alfie John <alfiej@fastmail.fm>
|
||||
Alona Enraght-Moony <code@alona.page> <nixon.emoony@gmail.com>
|
||||
Alona Enraght-Moony <code@alona.page> <nixon@caminus.local>
|
||||
Amanda Stjerna <mail@amandastjerna.se> <albin.stjerna@gmail.com>
|
||||
Amanda Stjerna <mail@amandastjerna.se> <amanda.stjerna@it.uu.se>
|
||||
Amos Onn <amosonn@gmail.com>
|
||||
Ana-Maria Mihalache <mihalacheana.maria@yahoo.com>
|
||||
Anatoly Ikorsky <aikorsky@gmail.com>
|
||||
|
@ -470,7 +470,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
ty.print(printer).unwrap().into_buffer()
|
||||
ty.print(&mut printer).unwrap();
|
||||
printer.into_buffer()
|
||||
}
|
||||
|
||||
/// Returns the name of the provided `Ty` (that must be a reference)'s region with a
|
||||
@ -492,7 +493,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
bug!("ty for annotation of borrow region is not a reference");
|
||||
};
|
||||
|
||||
region.print(printer).unwrap().into_buffer()
|
||||
region.print(&mut printer).unwrap();
|
||||
printer.into_buffer()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,10 +107,10 @@ impl<Prov: Provenance> std::fmt::Display for ImmTy<'_, Prov> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
/// Helper function for printing a scalar to a FmtPrinter
|
||||
fn p<'a, 'tcx, Prov: Provenance>(
|
||||
cx: FmtPrinter<'a, 'tcx>,
|
||||
cx: &mut FmtPrinter<'a, 'tcx>,
|
||||
s: Scalar<Prov>,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Result<FmtPrinter<'a, 'tcx>, std::fmt::Error> {
|
||||
) -> Result<(), std::fmt::Error> {
|
||||
match s {
|
||||
Scalar::Int(int) => cx.pretty_print_const_scalar_int(int, ty, true),
|
||||
Scalar::Ptr(ptr, _sz) => {
|
||||
@ -125,8 +125,9 @@ impl<Prov: Provenance> std::fmt::Display for ImmTy<'_, Prov> {
|
||||
match self.imm {
|
||||
Immediate::Scalar(s) => {
|
||||
if let Some(ty) = tcx.lift(self.layout.ty) {
|
||||
let cx = FmtPrinter::new(tcx, Namespace::ValueNS);
|
||||
f.write_str(&p(cx, s, ty)?.into_buffer())?;
|
||||
let s =
|
||||
FmtPrinter::print_string(tcx, Namespace::ValueNS, |cx| p(cx, s, ty))?;
|
||||
f.write_str(&s)?;
|
||||
return Ok(());
|
||||
}
|
||||
write!(f, "{:x}: {}", s, self.layout.ty)
|
||||
|
@ -18,11 +18,11 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
fn print_region(self, _region: ty::Region<'_>) -> Result<Self, PrintError> {
|
||||
Ok(self)
|
||||
fn print_region(&mut self, _region: ty::Region<'_>) -> Result<(), PrintError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_type(mut self, ty: Ty<'tcx>) -> Result<Self, PrintError> {
|
||||
fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError> {
|
||||
match *ty.kind() {
|
||||
// Types without identity.
|
||||
ty::Bool
|
||||
@ -43,7 +43,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
|
||||
// Placeholders (all printed as `_` to uniformize them).
|
||||
ty::Param(_) | ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) | ty::Error(_) => {
|
||||
write!(self, "_")?;
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Types with identity (print the module path).
|
||||
@ -60,44 +60,44 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn print_const(self, ct: ty::Const<'tcx>) -> Result<Self, PrintError> {
|
||||
fn print_const(&mut self, ct: ty::Const<'tcx>) -> Result<(), PrintError> {
|
||||
self.pretty_print_const(ct, false)
|
||||
}
|
||||
|
||||
fn print_dyn_existential(
|
||||
self,
|
||||
&mut self,
|
||||
predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
self.pretty_print_dyn_existential(predicates)
|
||||
}
|
||||
|
||||
fn path_crate(mut self, cnum: CrateNum) -> Result<Self, PrintError> {
|
||||
fn path_crate(&mut self, cnum: CrateNum) -> Result<(), PrintError> {
|
||||
self.path.push_str(self.tcx.crate_name(cnum).as_str());
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn path_qualified(
|
||||
self,
|
||||
&mut self,
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
self.pretty_path_qualified(self_ty, trait_ref)
|
||||
}
|
||||
|
||||
fn path_append_impl(
|
||||
self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
_disambiguated_data: &DisambiguatedDefPathData,
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
self.pretty_path_append_impl(
|
||||
|mut cx| {
|
||||
cx = print_prefix(cx)?;
|
||||
|cx| {
|
||||
print_prefix(cx)?;
|
||||
|
||||
cx.path.push_str("::");
|
||||
|
||||
Ok(cx)
|
||||
Ok(())
|
||||
},
|
||||
self_ty,
|
||||
trait_ref,
|
||||
@ -105,29 +105,29 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
|
||||
}
|
||||
|
||||
fn path_append(
|
||||
mut self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
disambiguated_data: &DisambiguatedDefPathData,
|
||||
) -> Result<Self, PrintError> {
|
||||
self = print_prefix(self)?;
|
||||
) -> Result<(), PrintError> {
|
||||
print_prefix(self)?;
|
||||
|
||||
write!(self.path, "::{}", disambiguated_data.data).unwrap();
|
||||
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn path_generic_args(
|
||||
mut self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
args: &[GenericArg<'tcx>],
|
||||
) -> Result<Self, PrintError> {
|
||||
self = print_prefix(self)?;
|
||||
) -> Result<(), PrintError> {
|
||||
print_prefix(self)?;
|
||||
let args =
|
||||
args.iter().cloned().filter(|arg| !matches!(arg.unpack(), GenericArgKind::Lifetime(_)));
|
||||
if args.clone().next().is_some() {
|
||||
self.generic_delimiters(|cx| cx.comma_sep(args))
|
||||
} else {
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -136,31 +136,31 @@ impl<'tcx> PrettyPrinter<'tcx> for AbsolutePathPrinter<'tcx> {
|
||||
fn should_print_region(&self, _region: ty::Region<'_>) -> bool {
|
||||
false
|
||||
}
|
||||
fn comma_sep<T>(mut self, mut elems: impl Iterator<Item = T>) -> Result<Self, PrintError>
|
||||
fn comma_sep<T>(&mut self, mut elems: impl Iterator<Item = T>) -> Result<(), PrintError>
|
||||
where
|
||||
T: Print<'tcx, Self>,
|
||||
{
|
||||
if let Some(first) = elems.next() {
|
||||
self = first.print(self)?;
|
||||
first.print(self)?;
|
||||
for elem in elems {
|
||||
self.path.push_str(", ");
|
||||
self = elem.print(self)?;
|
||||
elem.print(self)?;
|
||||
}
|
||||
}
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn generic_delimiters(
|
||||
mut self,
|
||||
f: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
) -> Result<Self, PrintError> {
|
||||
&mut self,
|
||||
f: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
) -> Result<(), PrintError> {
|
||||
write!(self, "<")?;
|
||||
|
||||
self = f(self)?;
|
||||
f(self)?;
|
||||
|
||||
write!(self, ">")?;
|
||||
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn should_print_verbose(&self) -> bool {
|
||||
@ -177,5 +177,7 @@ impl Write for AbsolutePathPrinter<'_> {
|
||||
}
|
||||
|
||||
pub fn type_name<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> String {
|
||||
AbsolutePathPrinter { tcx, path: String::new() }.print_type(ty).unwrap().path
|
||||
let mut printer = AbsolutePathPrinter { tcx, path: String::new() };
|
||||
printer.print_type(ty).unwrap();
|
||||
printer.path
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ use rustc_hir::pat_util::EnumerateAndAdjustIterator;
|
||||
use rustc_hir::{HirId, Pat, PatKind};
|
||||
use rustc_infer::infer;
|
||||
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use rustc_middle::mir::interpret::ErrorHandled;
|
||||
use rustc_middle::ty::{self, Adt, BindingMode, Ty, TypeVisitableExt};
|
||||
use rustc_session::lint::builtin::NON_EXHAUSTIVE_OMITTED_PATTERNS;
|
||||
use rustc_span::edit_distance::find_best_match_for_name;
|
||||
@ -2164,7 +2165,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
len: ty::Const<'tcx>,
|
||||
min_len: u64,
|
||||
) -> (Option<Ty<'tcx>>, Ty<'tcx>) {
|
||||
let guar = if let Some(len) = len.try_eval_target_usize(self.tcx, self.param_env) {
|
||||
let len = match len.eval(self.tcx, self.param_env, None) {
|
||||
Ok(val) => val
|
||||
.try_to_scalar()
|
||||
.and_then(|scalar| scalar.try_to_int().ok())
|
||||
.and_then(|int| int.try_to_target_usize(self.tcx).ok()),
|
||||
Err(ErrorHandled::Reported(..)) => {
|
||||
let guar = self.error_scrutinee_unfixed_length(span);
|
||||
return (Some(Ty::new_error(self.tcx, guar)), arr_ty);
|
||||
}
|
||||
Err(ErrorHandled::TooGeneric(..)) => None,
|
||||
};
|
||||
|
||||
let guar = if let Some(len) = len {
|
||||
// Now we know the length...
|
||||
if slice.is_none() {
|
||||
// ...and since there is no variable-length pattern,
|
||||
|
@ -588,60 +588,60 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
fn print_region(self, _region: ty::Region<'_>) -> Result<Self, PrintError> {
|
||||
fn print_region(&mut self, _region: ty::Region<'_>) -> Result<(), PrintError> {
|
||||
Err(fmt::Error)
|
||||
}
|
||||
|
||||
fn print_type(self, _ty: Ty<'tcx>) -> Result<Self, PrintError> {
|
||||
fn print_type(&mut self, _ty: Ty<'tcx>) -> Result<(), PrintError> {
|
||||
Err(fmt::Error)
|
||||
}
|
||||
|
||||
fn print_dyn_existential(
|
||||
self,
|
||||
&mut self,
|
||||
_predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
Err(fmt::Error)
|
||||
}
|
||||
|
||||
fn print_const(self, _ct: ty::Const<'tcx>) -> Result<Self, PrintError> {
|
||||
fn print_const(&mut self, _ct: ty::Const<'tcx>) -> Result<(), PrintError> {
|
||||
Err(fmt::Error)
|
||||
}
|
||||
|
||||
fn path_crate(mut self, cnum: CrateNum) -> Result<Self, PrintError> {
|
||||
fn path_crate(&mut self, cnum: CrateNum) -> Result<(), PrintError> {
|
||||
self.segments = vec![self.tcx.crate_name(cnum).to_string()];
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
fn path_qualified(
|
||||
self,
|
||||
&mut self,
|
||||
_self_ty: Ty<'tcx>,
|
||||
_trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
Err(fmt::Error)
|
||||
}
|
||||
|
||||
fn path_append_impl(
|
||||
self,
|
||||
_print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
_print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
_disambiguated_data: &DisambiguatedDefPathData,
|
||||
_self_ty: Ty<'tcx>,
|
||||
_trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
Err(fmt::Error)
|
||||
}
|
||||
fn path_append(
|
||||
mut self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
disambiguated_data: &DisambiguatedDefPathData,
|
||||
) -> Result<Self, PrintError> {
|
||||
self = print_prefix(self)?;
|
||||
) -> Result<(), PrintError> {
|
||||
print_prefix(self)?;
|
||||
self.segments.push(disambiguated_data.to_string());
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
fn path_generic_args(
|
||||
self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
_args: &[GenericArg<'tcx>],
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
print_prefix(self)
|
||||
}
|
||||
}
|
||||
@ -652,9 +652,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
// let _ = [{struct Foo; Foo}, {struct Foo; Foo}];
|
||||
if did1.krate != did2.krate {
|
||||
let abs_path = |def_id| {
|
||||
AbsolutePathPrinter { tcx: self.tcx, segments: vec![] }
|
||||
.print_def_path(def_id, &[])
|
||||
.map(|p| p.segments)
|
||||
let mut printer = AbsolutePathPrinter { tcx: self.tcx, segments: vec![] };
|
||||
printer.print_def_path(def_id, &[]).map(|_| printer.segments)
|
||||
};
|
||||
|
||||
// We compare strings because DefPath can be different
|
||||
@ -1071,7 +1070,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
|
||||
let get_lifetimes = |sig| {
|
||||
use rustc_hir::def::Namespace;
|
||||
let (_, sig, reg) = ty::print::FmtPrinter::new(self.tcx, Namespace::TypeNS)
|
||||
let (sig, reg) = ty::print::FmtPrinter::new(self.tcx, Namespace::TypeNS)
|
||||
.name_all_regions(sig)
|
||||
.unwrap();
|
||||
let lts: Vec<String> = reg.into_values().map(|kind| kind.to_string()).collect();
|
||||
|
@ -200,12 +200,15 @@ fn ty_to_string<'tcx>(
|
||||
ty: Ty<'tcx>,
|
||||
called_method_def_id: Option<DefId>,
|
||||
) -> String {
|
||||
let printer = fmt_printer(infcx, Namespace::TypeNS);
|
||||
let mut printer = fmt_printer(infcx, Namespace::TypeNS);
|
||||
let ty = infcx.resolve_vars_if_possible(ty);
|
||||
match (ty.kind(), called_method_def_id) {
|
||||
// We don't want the regular output for `fn`s because it includes its path in
|
||||
// invalid pseudo-syntax, we want the `fn`-pointer output instead.
|
||||
(ty::FnDef(..), _) => ty.fn_sig(infcx.tcx).print(printer).unwrap().into_buffer(),
|
||||
(ty::FnDef(..), _) => {
|
||||
ty.fn_sig(infcx.tcx).print(&mut printer).unwrap();
|
||||
printer.into_buffer()
|
||||
}
|
||||
(_, Some(def_id))
|
||||
if ty.is_ty_or_numeric_infer()
|
||||
&& infcx.tcx.get_diagnostic_item(sym::iterator_collect_fn) == Some(def_id) =>
|
||||
@ -218,7 +221,10 @@ fn ty_to_string<'tcx>(
|
||||
//
|
||||
// We do have to hide the `extern "rust-call"` ABI in that case though,
|
||||
// which is too much of a bother for now.
|
||||
_ => ty.print(printer).unwrap().into_buffer(),
|
||||
_ => {
|
||||
ty.print(&mut printer).unwrap();
|
||||
printer.into_buffer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,8 +291,9 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
if let Some(highlight) = highlight {
|
||||
printer.region_highlight_mode = highlight;
|
||||
}
|
||||
ty.print(&mut printer).unwrap();
|
||||
InferenceDiagnosticsData {
|
||||
name: ty.print(printer).unwrap().into_buffer(),
|
||||
name: printer.into_buffer(),
|
||||
span: None,
|
||||
kind: UnderspecifiedArgKind::Type { prefix: ty.prefix_string(self.tcx) },
|
||||
parent: None,
|
||||
@ -312,8 +319,9 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
if let Some(highlight) = highlight {
|
||||
printer.region_highlight_mode = highlight;
|
||||
}
|
||||
ct.print(&mut printer).unwrap();
|
||||
InferenceDiagnosticsData {
|
||||
name: ct.print(printer).unwrap().into_buffer(),
|
||||
name: printer.into_buffer(),
|
||||
span: Some(origin.span),
|
||||
kind: UnderspecifiedArgKind::Const { is_parameter: false },
|
||||
parent: None,
|
||||
@ -329,8 +337,9 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
if let Some(highlight) = highlight {
|
||||
printer.region_highlight_mode = highlight;
|
||||
}
|
||||
ct.print(&mut printer).unwrap();
|
||||
InferenceDiagnosticsData {
|
||||
name: ct.print(printer).unwrap().into_buffer(),
|
||||
name: printer.into_buffer(),
|
||||
span: None,
|
||||
kind: UnderspecifiedArgKind::Const { is_parameter: false },
|
||||
parent: None,
|
||||
@ -487,7 +496,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
{
|
||||
"Vec<_>".to_string()
|
||||
} else {
|
||||
fmt_printer(self, Namespace::TypeNS)
|
||||
let mut printer = fmt_printer(self, Namespace::TypeNS);
|
||||
printer
|
||||
.comma_sep(generic_args.iter().copied().map(|arg| {
|
||||
if arg.is_suggestable(self.tcx, true) {
|
||||
return arg;
|
||||
@ -512,8 +522,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
.into(),
|
||||
}
|
||||
}))
|
||||
.unwrap()
|
||||
.into_buffer()
|
||||
.unwrap();
|
||||
printer.into_buffer()
|
||||
};
|
||||
|
||||
if !have_turbofish {
|
||||
@ -525,8 +535,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
}
|
||||
InferSourceKind::FullyQualifiedMethodCall { receiver, successor, args, def_id } => {
|
||||
let printer = fmt_printer(self, Namespace::ValueNS);
|
||||
let def_path = printer.print_def_path(def_id, args).unwrap().into_buffer();
|
||||
let mut printer = fmt_printer(self, Namespace::ValueNS);
|
||||
printer.print_def_path(def_id, args).unwrap();
|
||||
let def_path = printer.into_buffer();
|
||||
|
||||
// We only care about whether we have to add `&` or `&mut ` for now.
|
||||
// This is the case if the last adjustment is a borrow and the
|
||||
|
@ -49,8 +49,8 @@ where
|
||||
let mut printer = ty::print::FmtPrinter::new(self.tcx, Namespace::TypeNS);
|
||||
printer.region_highlight_mode = self.highlight;
|
||||
|
||||
let s = self.value.print(printer)?.into_buffer();
|
||||
f.write_str(&s)
|
||||
self.value.print(&mut printer)?;
|
||||
f.write_str(&printer.into_buffer())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -763,9 +763,9 @@ fn foo(&self) -> Self::T { String::new() }
|
||||
}
|
||||
|
||||
pub fn format_generic_args(&self, args: &[ty::GenericArg<'tcx>]) -> String {
|
||||
FmtPrinter::new(self.tcx, hir::def::Namespace::TypeNS)
|
||||
.path_generic_args(Ok, args)
|
||||
.expect("could not write to `String`.")
|
||||
.into_buffer()
|
||||
FmtPrinter::print_string(self.tcx, hir::def::Namespace::TypeNS, |cx| {
|
||||
cx.path_generic_args(|_| Ok(()), args)
|
||||
})
|
||||
.expect("could not write to `String`.")
|
||||
}
|
||||
}
|
||||
|
@ -1210,35 +1210,35 @@ impl<'tcx> LateContext<'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
fn print_region(self, _region: ty::Region<'_>) -> Result<Self, PrintError> {
|
||||
Ok(self)
|
||||
fn print_region(&mut self, _region: ty::Region<'_>) -> Result<(), PrintError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_type(self, _ty: Ty<'tcx>) -> Result<Self, PrintError> {
|
||||
Ok(self)
|
||||
fn print_type(&mut self, _ty: Ty<'tcx>) -> Result<(), PrintError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_dyn_existential(
|
||||
self,
|
||||
&mut self,
|
||||
_predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
Ok(self)
|
||||
) -> Result<(), PrintError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_const(self, _ct: ty::Const<'tcx>) -> Result<Self, PrintError> {
|
||||
Ok(self)
|
||||
fn print_const(&mut self, _ct: ty::Const<'tcx>) -> Result<(), PrintError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn path_crate(mut self, cnum: CrateNum) -> Result<Self, PrintError> {
|
||||
fn path_crate(&mut self, cnum: CrateNum) -> Result<(), PrintError> {
|
||||
self.path = vec![self.tcx.crate_name(cnum)];
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn path_qualified(
|
||||
mut self,
|
||||
&mut self,
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
if trait_ref.is_none() {
|
||||
if let ty::Adt(def, args) = self_ty.kind() {
|
||||
return self.print_def_path(def.did(), args);
|
||||
@ -1251,21 +1251,21 @@ impl<'tcx> LateContext<'tcx> {
|
||||
Some(trait_ref) => Symbol::intern(&format!("{trait_ref:?}")),
|
||||
None => Symbol::intern(&format!("<{self_ty}>")),
|
||||
}];
|
||||
Ok(self)
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
fn path_append_impl(
|
||||
self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
_disambiguated_data: &DisambiguatedDefPathData,
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
let mut path = print_prefix(self)?;
|
||||
) -> Result<(), PrintError> {
|
||||
print_prefix(self)?;
|
||||
|
||||
// This shouldn't ever be needed, but just in case:
|
||||
path.path.push(match trait_ref {
|
||||
self.path.push(match trait_ref {
|
||||
Some(trait_ref) => {
|
||||
with_no_trimmed_paths!(Symbol::intern(&format!(
|
||||
"<impl {} for {}>",
|
||||
@ -1278,38 +1278,37 @@ impl<'tcx> LateContext<'tcx> {
|
||||
}
|
||||
});
|
||||
|
||||
Ok(path)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn path_append(
|
||||
self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
disambiguated_data: &DisambiguatedDefPathData,
|
||||
) -> Result<Self, PrintError> {
|
||||
let mut path = print_prefix(self)?;
|
||||
) -> Result<(), PrintError> {
|
||||
print_prefix(self)?;
|
||||
|
||||
// Skip `::{{extern}}` blocks and `::{{constructor}}` on tuple/unit structs.
|
||||
if let DefPathData::ForeignMod | DefPathData::Ctor = disambiguated_data.data {
|
||||
return Ok(path);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
path.path.push(Symbol::intern(&disambiguated_data.data.to_string()));
|
||||
Ok(path)
|
||||
self.path.push(Symbol::intern(&disambiguated_data.data.to_string()));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn path_generic_args(
|
||||
self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
_args: &[GenericArg<'tcx>],
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
print_prefix(self)
|
||||
}
|
||||
}
|
||||
|
||||
AbsolutePathPrinter { tcx: self.tcx, path: vec![] }
|
||||
.print_def_path(def_id, &[])
|
||||
.unwrap()
|
||||
.path
|
||||
let mut printer = AbsolutePathPrinter { tcx: self.tcx, path: vec![] };
|
||||
printer.print_def_path(def_id, &[]).unwrap();
|
||||
printer.path
|
||||
}
|
||||
|
||||
/// Returns the associated type `name` for `self_ty` as an implementation of `trait_id`.
|
||||
|
@ -998,9 +998,9 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
||||
ty::tls::with(|tcx| {
|
||||
let variant_def = &tcx.adt_def(adt_did).variant(variant);
|
||||
let args = tcx.lift(args).expect("could not lift for printing");
|
||||
let name = FmtPrinter::new(tcx, Namespace::ValueNS)
|
||||
.print_def_path(variant_def.def_id, args)?
|
||||
.into_buffer();
|
||||
let name = FmtPrinter::print_string(tcx, Namespace::ValueNS, |cx| {
|
||||
cx.print_def_path(variant_def.def_id, args)
|
||||
})?;
|
||||
|
||||
match variant_def.ctor_kind() {
|
||||
Some(CtorKind::Const) => fmt.write_str(&name),
|
||||
@ -1740,7 +1740,7 @@ fn pretty_print_const_value_tcx<'tcx>(
|
||||
let args = tcx.lift(args).unwrap();
|
||||
let mut cx = FmtPrinter::new(tcx, Namespace::ValueNS);
|
||||
cx.print_alloc_ids = true;
|
||||
let cx = cx.print_value_path(variant_def.def_id, args)?;
|
||||
cx.print_value_path(variant_def.def_id, args)?;
|
||||
fmt.write_str(&cx.into_buffer())?;
|
||||
|
||||
match variant_def.ctor_kind() {
|
||||
@ -1775,14 +1775,14 @@ fn pretty_print_const_value_tcx<'tcx>(
|
||||
let mut cx = FmtPrinter::new(tcx, Namespace::ValueNS);
|
||||
cx.print_alloc_ids = true;
|
||||
let ty = tcx.lift(ty).unwrap();
|
||||
cx = cx.pretty_print_const_scalar(scalar, ty)?;
|
||||
cx.pretty_print_const_scalar(scalar, ty)?;
|
||||
fmt.write_str(&cx.into_buffer())?;
|
||||
return Ok(());
|
||||
}
|
||||
(ConstValue::ZeroSized, ty::FnDef(d, s)) => {
|
||||
let mut cx = FmtPrinter::new(tcx, Namespace::ValueNS);
|
||||
cx.print_alloc_ids = true;
|
||||
let cx = cx.print_value_path(*d, s)?;
|
||||
cx.print_value_path(*d, s)?;
|
||||
fmt.write_str(&cx.into_buffer())?;
|
||||
return Ok(());
|
||||
}
|
||||
|
@ -315,26 +315,25 @@ impl<'tcx> Ty<'tcx> {
|
||||
impl<'tcx> TyCtxt<'tcx> {
|
||||
pub fn ty_string_with_limit(self, ty: Ty<'tcx>, length_limit: usize) -> String {
|
||||
let mut type_limit = 50;
|
||||
let regular = FmtPrinter::new(self, hir::def::Namespace::TypeNS)
|
||||
.pretty_print_type(ty)
|
||||
.expect("could not write to `String`")
|
||||
.into_buffer();
|
||||
let regular = FmtPrinter::print_string(self, hir::def::Namespace::TypeNS, |cx| {
|
||||
cx.pretty_print_type(ty)
|
||||
})
|
||||
.expect("could not write to `String`");
|
||||
if regular.len() <= length_limit {
|
||||
return regular;
|
||||
}
|
||||
let mut short;
|
||||
loop {
|
||||
// Look for the longest properly trimmed path that still fits in length_limit.
|
||||
short = with_forced_trimmed_paths!(
|
||||
FmtPrinter::new_with_limit(
|
||||
short = with_forced_trimmed_paths!({
|
||||
let mut cx = FmtPrinter::new_with_limit(
|
||||
self,
|
||||
hir::def::Namespace::TypeNS,
|
||||
rustc_session::Limit(type_limit),
|
||||
)
|
||||
.pretty_print_type(ty)
|
||||
.expect("could not write to `String`")
|
||||
.into_buffer()
|
||||
);
|
||||
);
|
||||
cx.pretty_print_type(ty).expect("could not write to `String`");
|
||||
cx.into_buffer()
|
||||
});
|
||||
if short.len() <= length_limit || type_limit == 0 {
|
||||
break;
|
||||
}
|
||||
@ -344,10 +343,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
}
|
||||
|
||||
pub fn short_ty_string(self, ty: Ty<'tcx>) -> (String, Option<PathBuf>) {
|
||||
let regular = FmtPrinter::new(self, hir::def::Namespace::TypeNS)
|
||||
.pretty_print_type(ty)
|
||||
.expect("could not write to `String`")
|
||||
.into_buffer();
|
||||
let regular = FmtPrinter::print_string(self, hir::def::Namespace::TypeNS, |cx| {
|
||||
cx.pretty_print_type(ty)
|
||||
})
|
||||
.expect("could not write to `String`");
|
||||
|
||||
if !self.sess.opts.unstable_opts.write_long_types_to_disk {
|
||||
return (regular, None);
|
||||
|
@ -298,9 +298,9 @@ fn fmt_instance(
|
||||
ty::tls::with(|tcx| {
|
||||
let args = tcx.lift(instance.args).expect("could not lift for printing");
|
||||
|
||||
let s = FmtPrinter::new_with_limit(tcx, Namespace::ValueNS, type_length)
|
||||
.print_def_path(instance.def_id(), args)?
|
||||
.into_buffer();
|
||||
let mut cx = FmtPrinter::new_with_limit(tcx, Namespace::ValueNS, type_length);
|
||||
cx.print_def_path(instance.def_id(), args)?;
|
||||
let s = cx.into_buffer();
|
||||
f.write_str(&s)
|
||||
})?;
|
||||
|
||||
|
@ -15,7 +15,7 @@ pub type PrintError = std::fmt::Error;
|
||||
// FIXME(eddyb) false positive, the lifetime parameters are used with `P: Printer<...>`.
|
||||
#[allow(unused_lifetimes)]
|
||||
pub trait Print<'tcx, P> {
|
||||
fn print(&self, cx: P) -> Result<P, PrintError>;
|
||||
fn print(&self, cx: &mut P) -> Result<(), PrintError>;
|
||||
}
|
||||
|
||||
/// Interface for outputting user-facing "type-system entities"
|
||||
@ -31,70 +31,70 @@ pub trait Printer<'tcx>: Sized {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx>;
|
||||
|
||||
fn print_def_path(
|
||||
self,
|
||||
&mut self,
|
||||
def_id: DefId,
|
||||
args: &'tcx [GenericArg<'tcx>],
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
self.default_print_def_path(def_id, args)
|
||||
}
|
||||
|
||||
fn print_impl_path(
|
||||
self,
|
||||
&mut self,
|
||||
impl_def_id: DefId,
|
||||
args: &'tcx [GenericArg<'tcx>],
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
self.default_print_impl_path(impl_def_id, args, self_ty, trait_ref)
|
||||
}
|
||||
|
||||
fn print_region(self, region: ty::Region<'tcx>) -> Result<Self, PrintError>;
|
||||
fn print_region(&mut self, region: ty::Region<'tcx>) -> Result<(), PrintError>;
|
||||
|
||||
fn print_type(self, ty: Ty<'tcx>) -> Result<Self, PrintError>;
|
||||
fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError>;
|
||||
|
||||
fn print_dyn_existential(
|
||||
self,
|
||||
&mut self,
|
||||
predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
|
||||
) -> Result<Self, PrintError>;
|
||||
) -> Result<(), PrintError>;
|
||||
|
||||
fn print_const(self, ct: ty::Const<'tcx>) -> Result<Self, PrintError>;
|
||||
fn print_const(&mut self, ct: ty::Const<'tcx>) -> Result<(), PrintError>;
|
||||
|
||||
fn path_crate(self, cnum: CrateNum) -> Result<Self, PrintError>;
|
||||
fn path_crate(&mut self, cnum: CrateNum) -> Result<(), PrintError>;
|
||||
|
||||
fn path_qualified(
|
||||
self,
|
||||
&mut self,
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError>;
|
||||
) -> Result<(), PrintError>;
|
||||
|
||||
fn path_append_impl(
|
||||
self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
disambiguated_data: &DisambiguatedDefPathData,
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError>;
|
||||
) -> Result<(), PrintError>;
|
||||
|
||||
fn path_append(
|
||||
self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
disambiguated_data: &DisambiguatedDefPathData,
|
||||
) -> Result<Self, PrintError>;
|
||||
) -> Result<(), PrintError>;
|
||||
|
||||
fn path_generic_args(
|
||||
self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
args: &[GenericArg<'tcx>],
|
||||
) -> Result<Self, PrintError>;
|
||||
) -> Result<(), PrintError>;
|
||||
|
||||
// Defaults (should not be overridden):
|
||||
|
||||
#[instrument(skip(self), level = "debug")]
|
||||
fn default_print_def_path(
|
||||
self,
|
||||
&mut self,
|
||||
def_id: DefId,
|
||||
args: &'tcx [GenericArg<'tcx>],
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
let key = self.tcx().def_key(def_id);
|
||||
debug!(?key);
|
||||
|
||||
@ -161,7 +161,7 @@ pub trait Printer<'tcx>: Sized {
|
||||
}
|
||||
|
||||
self.path_append(
|
||||
|cx: Self| {
|
||||
|cx: &mut Self| {
|
||||
if trait_qualify_parent {
|
||||
let trait_ref = ty::TraitRef::new(
|
||||
cx.tcx(),
|
||||
@ -180,12 +180,12 @@ pub trait Printer<'tcx>: Sized {
|
||||
}
|
||||
|
||||
fn default_print_impl_path(
|
||||
self,
|
||||
&mut self,
|
||||
impl_def_id: DefId,
|
||||
_args: &'tcx [GenericArg<'tcx>],
|
||||
self_ty: Ty<'tcx>,
|
||||
impl_trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
debug!(
|
||||
"default_print_impl_path: impl_def_id={:?}, self_ty={}, impl_trait_ref={:?}",
|
||||
impl_def_id, self_ty, impl_trait_ref
|
||||
@ -286,25 +286,25 @@ pub fn characteristic_def_id_of_type(ty: Ty<'_>) -> Option<DefId> {
|
||||
}
|
||||
|
||||
impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for ty::Region<'tcx> {
|
||||
fn print(&self, cx: P) -> Result<P, PrintError> {
|
||||
fn print(&self, cx: &mut P) -> Result<(), PrintError> {
|
||||
cx.print_region(*self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for Ty<'tcx> {
|
||||
fn print(&self, cx: P) -> Result<P, PrintError> {
|
||||
fn print(&self, cx: &mut P) -> Result<(), PrintError> {
|
||||
cx.print_type(*self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>> {
|
||||
fn print(&self, cx: P) -> Result<P, PrintError> {
|
||||
fn print(&self, cx: &mut P) -> Result<(), PrintError> {
|
||||
cx.print_dyn_existential(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for ty::Const<'tcx> {
|
||||
fn print(&self, cx: P) -> Result<P, PrintError> {
|
||||
fn print(&self, cx: &mut P) -> Result<(), PrintError> {
|
||||
cx.print_const(*self)
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,11 +22,10 @@ impl fmt::Debug for ty::TraitDef {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
ty::tls::with(|tcx| {
|
||||
with_no_trimmed_paths!({
|
||||
f.write_str(
|
||||
&FmtPrinter::new(tcx, Namespace::TypeNS)
|
||||
.print_def_path(self.def_id, &[])?
|
||||
.into_buffer(),
|
||||
)
|
||||
let s = FmtPrinter::print_string(tcx, Namespace::TypeNS, |cx| {
|
||||
cx.print_def_path(self.def_id, &[])
|
||||
})?;
|
||||
f.write_str(&s)
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -36,11 +35,10 @@ impl<'tcx> fmt::Debug for ty::AdtDef<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
ty::tls::with(|tcx| {
|
||||
with_no_trimmed_paths!({
|
||||
f.write_str(
|
||||
&FmtPrinter::new(tcx, Namespace::TypeNS)
|
||||
.print_def_path(self.did(), &[])?
|
||||
.into_buffer(),
|
||||
)
|
||||
let s = FmtPrinter::print_string(tcx, Namespace::TypeNS, |cx| {
|
||||
cx.print_def_path(self.did(), &[])
|
||||
})?;
|
||||
f.write_str(&s)
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -350,9 +348,8 @@ impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::Const<'tcx> {
|
||||
let ConstKind::Value(valtree) = lifted.kind() else {
|
||||
bug!("we checked that this is a valtree")
|
||||
};
|
||||
let cx = FmtPrinter::new(tcx, Namespace::ValueNS);
|
||||
let cx =
|
||||
cx.pretty_print_const_valtree(valtree, lifted.ty(), /*print_ty*/ true)?;
|
||||
let mut cx = FmtPrinter::new(tcx, Namespace::ValueNS);
|
||||
cx.pretty_print_const_valtree(valtree, lifted.ty(), /*print_ty*/ true)?;
|
||||
f.write_str(&cx.into_buffer())
|
||||
});
|
||||
}
|
||||
|
@ -199,16 +199,16 @@ struct SymbolPrinter<'tcx> {
|
||||
// `PrettyPrinter` aka pretty printing of e.g. types in paths,
|
||||
// symbol names should have their own printing machinery.
|
||||
|
||||
impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
|
||||
impl<'tcx> Printer<'tcx> for SymbolPrinter<'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
fn print_region(self, _region: ty::Region<'_>) -> Result<Self, PrintError> {
|
||||
Ok(self)
|
||||
fn print_region(&mut self, _region: ty::Region<'_>) -> Result<(), PrintError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_type(mut self, ty: Ty<'tcx>) -> Result<Self, PrintError> {
|
||||
fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError> {
|
||||
match *ty.kind() {
|
||||
// Print all nominal types as paths (unlike `pretty_print_type`).
|
||||
ty::FnDef(def_id, args)
|
||||
@ -220,17 +220,17 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
|
||||
// -Zverbose flag, so we cannot reuse it here.
|
||||
ty::Array(ty, size) => {
|
||||
self.write_str("[")?;
|
||||
self = self.print_type(ty)?;
|
||||
self.print_type(ty)?;
|
||||
self.write_str("; ")?;
|
||||
if let Some(size) = size.try_to_target_usize(self.tcx()) {
|
||||
write!(self, "{size}")?
|
||||
} else if let ty::ConstKind::Param(param) = size.kind() {
|
||||
self = param.print(self)?
|
||||
param.print(self)?
|
||||
} else {
|
||||
self.write_str("_")?
|
||||
}
|
||||
self.write_str("]")?;
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
ty::Alias(ty::Inherent, _) => panic!("unexpected inherent projection"),
|
||||
@ -240,21 +240,21 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
|
||||
}
|
||||
|
||||
fn print_dyn_existential(
|
||||
mut self,
|
||||
&mut self,
|
||||
predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
let mut first = true;
|
||||
for p in predicates {
|
||||
if !first {
|
||||
write!(self, "+")?;
|
||||
}
|
||||
first = false;
|
||||
self = p.print(self)?;
|
||||
p.print(self)?;
|
||||
}
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_const(self, ct: ty::Const<'tcx>) -> Result<Self, PrintError> {
|
||||
fn print_const(&mut self, ct: ty::Const<'tcx>) -> Result<(), PrintError> {
|
||||
// only print integers
|
||||
match (ct.kind(), ct.ty().kind()) {
|
||||
(ty::ConstKind::Value(ty::ValTree::Leaf(scalar)), ty::Int(_) | ty::Uint(_)) => {
|
||||
@ -269,18 +269,18 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
|
||||
}
|
||||
_ => self.write_str("_")?,
|
||||
}
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn path_crate(self, cnum: CrateNum) -> Result<Self, PrintError> {
|
||||
fn path_crate(&mut self, cnum: CrateNum) -> Result<(), PrintError> {
|
||||
self.write_str(self.tcx.crate_name(cnum).as_str())?;
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
fn path_qualified(
|
||||
self,
|
||||
&mut self,
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
// Similar to `pretty_path_qualified`, but for the other
|
||||
// types that are printed as paths (see `print_type` above).
|
||||
match self_ty.kind() {
|
||||
@ -295,15 +295,15 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
|
||||
}
|
||||
|
||||
fn path_append_impl(
|
||||
self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
_disambiguated_data: &DisambiguatedDefPathData,
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
self.pretty_path_append_impl(
|
||||
|mut cx| {
|
||||
cx = print_prefix(cx)?;
|
||||
|cx| {
|
||||
print_prefix(cx)?;
|
||||
|
||||
if cx.keep_within_component {
|
||||
// HACK(eddyb) print the path similarly to how `FmtPrinter` prints it.
|
||||
@ -312,22 +312,22 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
|
||||
cx.path.finalize_pending_component();
|
||||
}
|
||||
|
||||
Ok(cx)
|
||||
Ok(())
|
||||
},
|
||||
self_ty,
|
||||
trait_ref,
|
||||
)
|
||||
}
|
||||
fn path_append(
|
||||
mut self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
disambiguated_data: &DisambiguatedDefPathData,
|
||||
) -> Result<Self, PrintError> {
|
||||
self = print_prefix(self)?;
|
||||
) -> Result<(), PrintError> {
|
||||
print_prefix(self)?;
|
||||
|
||||
// Skip `::{{extern}}` blocks and `::{{constructor}}` on tuple/unit structs.
|
||||
if let DefPathData::ForeignMod | DefPathData::Ctor = disambiguated_data.data {
|
||||
return Ok(self);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if self.keep_within_component {
|
||||
@ -339,14 +339,14 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
|
||||
|
||||
write!(self, "{}", disambiguated_data.data)?;
|
||||
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
fn path_generic_args(
|
||||
mut self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
args: &[GenericArg<'tcx>],
|
||||
) -> Result<Self, PrintError> {
|
||||
self = print_prefix(self)?;
|
||||
) -> Result<(), PrintError> {
|
||||
print_prefix(self)?;
|
||||
|
||||
let args =
|
||||
args.iter().cloned().filter(|arg| !matches!(arg.unpack(), GenericArgKind::Lifetime(_)));
|
||||
@ -354,42 +354,42 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
|
||||
if args.clone().next().is_some() {
|
||||
self.generic_delimiters(|cx| cx.comma_sep(args))
|
||||
} else {
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> PrettyPrinter<'tcx> for &mut SymbolPrinter<'tcx> {
|
||||
impl<'tcx> PrettyPrinter<'tcx> for SymbolPrinter<'tcx> {
|
||||
fn should_print_region(&self, _region: ty::Region<'_>) -> bool {
|
||||
false
|
||||
}
|
||||
fn comma_sep<T>(mut self, mut elems: impl Iterator<Item = T>) -> Result<Self, PrintError>
|
||||
fn comma_sep<T>(&mut self, mut elems: impl Iterator<Item = T>) -> Result<(), PrintError>
|
||||
where
|
||||
T: Print<'tcx, Self>,
|
||||
{
|
||||
if let Some(first) = elems.next() {
|
||||
self = first.print(self)?;
|
||||
first.print(self)?;
|
||||
for elem in elems {
|
||||
self.write_str(",")?;
|
||||
self = elem.print(self)?;
|
||||
elem.print(self)?;
|
||||
}
|
||||
}
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn generic_delimiters(
|
||||
mut self,
|
||||
f: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
) -> Result<Self, PrintError> {
|
||||
&mut self,
|
||||
f: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
) -> Result<(), PrintError> {
|
||||
write!(self, "<")?;
|
||||
|
||||
let kept_within_component = mem::replace(&mut self.keep_within_component, true);
|
||||
self = f(self)?;
|
||||
f(self)?;
|
||||
self.keep_within_component = kept_within_component;
|
||||
|
||||
write!(self, ">")?;
|
||||
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ pub(super) fn mangle<'tcx>(
|
||||
let args = tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), instance.args);
|
||||
|
||||
let prefix = "_R";
|
||||
let mut cx = &mut SymbolMangler {
|
||||
let mut cx: SymbolMangler<'_> = SymbolMangler {
|
||||
tcx,
|
||||
start_offset: prefix.len(),
|
||||
paths: FxHashMap::default(),
|
||||
@ -49,13 +49,13 @@ pub(super) fn mangle<'tcx>(
|
||||
_ => None,
|
||||
};
|
||||
|
||||
cx = if let Some(shim_kind) = shim_kind {
|
||||
if let Some(shim_kind) = shim_kind {
|
||||
cx.path_append_ns(|cx| cx.print_def_path(def_id, args), 'S', 0, shim_kind).unwrap()
|
||||
} else {
|
||||
cx.print_def_path(def_id, args).unwrap()
|
||||
};
|
||||
if let Some(instantiating_crate) = instantiating_crate {
|
||||
cx = cx.print_def_path(instantiating_crate.as_def_id(), &[]).unwrap();
|
||||
cx.print_def_path(instantiating_crate.as_def_id(), &[]).unwrap();
|
||||
}
|
||||
std::mem::take(&mut cx.out)
|
||||
}
|
||||
@ -65,7 +65,7 @@ pub(super) fn mangle_typeid_for_trait_ref<'tcx>(
|
||||
trait_ref: ty::PolyExistentialTraitRef<'tcx>,
|
||||
) -> String {
|
||||
// FIXME(flip1995): See comment in `mangle_typeid_for_fnabi`.
|
||||
let mut cx = &mut SymbolMangler {
|
||||
let mut cx = SymbolMangler {
|
||||
tcx,
|
||||
start_offset: 0,
|
||||
paths: FxHashMap::default(),
|
||||
@ -74,7 +74,7 @@ pub(super) fn mangle_typeid_for_trait_ref<'tcx>(
|
||||
binders: vec![],
|
||||
out: String::new(),
|
||||
};
|
||||
cx = cx.print_def_path(trait_ref.def_id(), &[]).unwrap();
|
||||
cx.print_def_path(trait_ref.def_id(), &[]).unwrap();
|
||||
std::mem::take(&mut cx.out)
|
||||
}
|
||||
|
||||
@ -179,32 +179,32 @@ impl<'tcx> SymbolMangler<'tcx> {
|
||||
self.push(ident);
|
||||
}
|
||||
|
||||
fn path_append_ns<'a>(
|
||||
mut self: &'a mut Self,
|
||||
print_prefix: impl FnOnce(&'a mut Self) -> Result<&'a mut Self, PrintError>,
|
||||
fn path_append_ns(
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
ns: char,
|
||||
disambiguator: u64,
|
||||
name: &str,
|
||||
) -> Result<&'a mut Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
self.push("N");
|
||||
self.out.push(ns);
|
||||
self = print_prefix(self)?;
|
||||
print_prefix(self)?;
|
||||
self.push_disambiguator(disambiguator as u64);
|
||||
self.push_ident(name);
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_backref(&mut self, i: usize) -> Result<&mut Self, PrintError> {
|
||||
fn print_backref(&mut self, i: usize) -> Result<(), PrintError> {
|
||||
self.push("B");
|
||||
self.push_integer_62((i - self.start_offset) as u64);
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn in_binder<'a, T>(
|
||||
mut self: &'a mut Self,
|
||||
fn in_binder<T>(
|
||||
&mut self,
|
||||
value: &ty::Binder<'tcx, T>,
|
||||
print_value: impl FnOnce(&'a mut Self, &T) -> Result<&'a mut Self, PrintError>,
|
||||
) -> Result<&'a mut Self, PrintError>
|
||||
print_value: impl FnOnce(&mut Self, &T) -> Result<(), PrintError>,
|
||||
) -> Result<(), PrintError>
|
||||
where
|
||||
T: TypeVisitable<TyCtxt<'tcx>>,
|
||||
{
|
||||
@ -222,45 +222,45 @@ impl<'tcx> SymbolMangler<'tcx> {
|
||||
lifetime_depths.end += lifetimes;
|
||||
|
||||
self.binders.push(BinderLevel { lifetime_depths });
|
||||
self = print_value(self, value.as_ref().skip_binder())?;
|
||||
print_value(self, value.as_ref().skip_binder())?;
|
||||
self.binders.pop();
|
||||
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
fn print_def_path(
|
||||
mut self,
|
||||
&mut self,
|
||||
def_id: DefId,
|
||||
args: &'tcx [GenericArg<'tcx>],
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
if let Some(&i) = self.paths.get(&(def_id, args)) {
|
||||
return self.print_backref(i);
|
||||
}
|
||||
let start = self.out.len();
|
||||
|
||||
self = self.default_print_def_path(def_id, args)?;
|
||||
self.default_print_def_path(def_id, args)?;
|
||||
|
||||
// Only cache paths that do not refer to an enclosing
|
||||
// binder (which would change depending on context).
|
||||
if !args.iter().any(|k| k.has_escaping_bound_vars()) {
|
||||
self.paths.insert((def_id, args), start);
|
||||
}
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_impl_path(
|
||||
mut self,
|
||||
&mut self,
|
||||
impl_def_id: DefId,
|
||||
args: &'tcx [GenericArg<'tcx>],
|
||||
mut self_ty: Ty<'tcx>,
|
||||
mut impl_trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
let key = self.tcx.def_key(impl_def_id);
|
||||
let parent_def_id = DefId { index: key.parent.unwrap(), ..impl_def_id };
|
||||
|
||||
@ -288,7 +288,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
// Encode impl generic params if the substitutions contain parameters (implying
|
||||
// polymorphization is enabled) and this isn't an inherent impl.
|
||||
if impl_trait_ref.is_some() && args.iter().any(|a| a.has_non_region_param()) {
|
||||
self = self.path_generic_args(
|
||||
self.path_generic_args(
|
||||
|this| {
|
||||
this.path_append_ns(
|
||||
|cx| cx.print_def_path(parent_def_id, &[]),
|
||||
@ -301,19 +301,19 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
)?;
|
||||
} else {
|
||||
self.push_disambiguator(key.disambiguated_data.disambiguator as u64);
|
||||
self = self.print_def_path(parent_def_id, &[])?;
|
||||
self.print_def_path(parent_def_id, &[])?;
|
||||
}
|
||||
|
||||
self = self_ty.print(self)?;
|
||||
self_ty.print(self)?;
|
||||
|
||||
if let Some(trait_ref) = impl_trait_ref {
|
||||
self = self.print_def_path(trait_ref.def_id, trait_ref.args)?;
|
||||
self.print_def_path(trait_ref.def_id, trait_ref.args)?;
|
||||
}
|
||||
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_region(self, region: ty::Region<'_>) -> Result<Self, PrintError> {
|
||||
fn print_region(&mut self, region: ty::Region<'_>) -> Result<(), PrintError> {
|
||||
let i = match *region {
|
||||
// Erased lifetimes use the index 0, for a
|
||||
// shorter mangling of `L_`.
|
||||
@ -332,10 +332,10 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
};
|
||||
self.push("L");
|
||||
self.push_integer_62(i as u64);
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_type(mut self, ty: Ty<'tcx>) -> Result<Self, PrintError> {
|
||||
fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError> {
|
||||
// Basic types, never cached (single-character).
|
||||
let basic_type = match ty.kind() {
|
||||
ty::Bool => "b",
|
||||
@ -365,7 +365,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
};
|
||||
if !basic_type.is_empty() {
|
||||
self.push(basic_type);
|
||||
return Ok(self);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let Some(&i) = self.types.get(&ty) {
|
||||
@ -391,9 +391,9 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
hir::Mutability::Mut => "Q",
|
||||
});
|
||||
if !r.is_erased() {
|
||||
self = r.print(self)?;
|
||||
r.print(self)?;
|
||||
}
|
||||
self = ty.print(self)?;
|
||||
ty.print(self)?;
|
||||
}
|
||||
|
||||
ty::RawPtr(mt) => {
|
||||
@ -401,23 +401,23 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
hir::Mutability::Not => "P",
|
||||
hir::Mutability::Mut => "O",
|
||||
});
|
||||
self = mt.ty.print(self)?;
|
||||
mt.ty.print(self)?;
|
||||
}
|
||||
|
||||
ty::Array(ty, len) => {
|
||||
self.push("A");
|
||||
self = ty.print(self)?;
|
||||
self = self.print_const(len)?;
|
||||
ty.print(self)?;
|
||||
self.print_const(len)?;
|
||||
}
|
||||
ty::Slice(ty) => {
|
||||
self.push("S");
|
||||
self = ty.print(self)?;
|
||||
ty.print(self)?;
|
||||
}
|
||||
|
||||
ty::Tuple(tys) => {
|
||||
self.push("T");
|
||||
for ty in tys.iter() {
|
||||
self = ty.print(self)?;
|
||||
ty.print(self)?;
|
||||
}
|
||||
self.push("E");
|
||||
}
|
||||
@ -428,15 +428,15 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
| ty::Alias(ty::Projection | ty::Opaque, ty::AliasTy { def_id, args, .. })
|
||||
| ty::Closure(def_id, args)
|
||||
| ty::Coroutine(def_id, args, _) => {
|
||||
self = self.print_def_path(def_id, args)?;
|
||||
self.print_def_path(def_id, args)?;
|
||||
}
|
||||
ty::Foreign(def_id) => {
|
||||
self = self.print_def_path(def_id, &[])?;
|
||||
self.print_def_path(def_id, &[])?;
|
||||
}
|
||||
|
||||
ty::FnPtr(sig) => {
|
||||
self.push("F");
|
||||
self = self.in_binder(&sig, |mut cx, sig| {
|
||||
self.in_binder(&sig, |cx, sig| {
|
||||
if sig.unsafety == hir::Unsafety::Unsafe {
|
||||
cx.push("U");
|
||||
}
|
||||
@ -454,7 +454,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
}
|
||||
}
|
||||
for &ty in sig.inputs() {
|
||||
cx = ty.print(cx)?;
|
||||
ty.print(cx)?;
|
||||
}
|
||||
if sig.c_variadic {
|
||||
cx.push("v");
|
||||
@ -470,8 +470,8 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
// FIXME(dyn-star): need to update v0 mangling docs
|
||||
ty::DynStar => "D*",
|
||||
});
|
||||
self = self.print_dyn_existential(predicates)?;
|
||||
self = r.print(self)?;
|
||||
self.print_dyn_existential(predicates)?;
|
||||
r.print(self)?;
|
||||
}
|
||||
|
||||
ty::Alias(ty::Inherent, _) => bug!("symbol_names: unexpected inherent projection"),
|
||||
@ -484,13 +484,13 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
if !ty.has_escaping_bound_vars() {
|
||||
self.types.insert(ty, start);
|
||||
}
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_dyn_existential(
|
||||
mut self,
|
||||
&mut self,
|
||||
predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
// Okay, so this is a bit tricky. Imagine we have a trait object like
|
||||
// `dyn for<'a> Foo<'a, Bar = &'a ()>`. When we mangle this, the
|
||||
// output looks really close to the syntax, where the `Bar = &'a ()` bit
|
||||
@ -517,7 +517,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
// [<Trait> [{<Projection>}]] [{<Auto>}]
|
||||
// Since any predicates after the first one shouldn't change the binders,
|
||||
// just put them all in the binders of the first.
|
||||
self = self.in_binder(&predicates[0], |mut cx, _| {
|
||||
self.in_binder(&predicates[0], |cx, _| {
|
||||
for predicate in predicates.iter() {
|
||||
// It would be nice to be able to validate bound vars here, but
|
||||
// projections can actually include bound vars from super traits
|
||||
@ -528,30 +528,30 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
// Use a type that can't appear in defaults of type parameters.
|
||||
let dummy_self = Ty::new_fresh(cx.tcx, 0);
|
||||
let trait_ref = trait_ref.with_self_ty(cx.tcx, dummy_self);
|
||||
cx = cx.print_def_path(trait_ref.def_id, trait_ref.args)?;
|
||||
cx.print_def_path(trait_ref.def_id, trait_ref.args)?;
|
||||
}
|
||||
ty::ExistentialPredicate::Projection(projection) => {
|
||||
let name = cx.tcx.associated_item(projection.def_id).name;
|
||||
cx.push("p");
|
||||
cx.push_ident(name.as_str());
|
||||
cx = match projection.term.unpack() {
|
||||
match projection.term.unpack() {
|
||||
ty::TermKind::Ty(ty) => ty.print(cx),
|
||||
ty::TermKind::Const(c) => c.print(cx),
|
||||
}?;
|
||||
}
|
||||
ty::ExistentialPredicate::AutoTrait(def_id) => {
|
||||
cx = cx.print_def_path(*def_id, &[])?;
|
||||
cx.print_def_path(*def_id, &[])?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(cx)
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
self.push("E");
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_const(mut self, ct: ty::Const<'tcx>) -> Result<Self, PrintError> {
|
||||
fn print_const(&mut self, ct: ty::Const<'tcx>) -> Result<(), PrintError> {
|
||||
// We only mangle a typed value if the const can be evaluated.
|
||||
let ct = ct.normalize(self.tcx, ty::ParamEnv::reveal_all());
|
||||
match ct.kind() {
|
||||
@ -570,12 +570,13 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
| ty::ConstKind::Error(_) => {
|
||||
// Never cached (single-character).
|
||||
self.push("p");
|
||||
return Ok(self);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(&i) = self.consts.get(&ct) {
|
||||
return self.print_backref(i);
|
||||
self.print_backref(i)?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let start = self.out.len();
|
||||
@ -583,7 +584,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
|
||||
match ty.kind() {
|
||||
ty::Uint(_) | ty::Int(_) | ty::Bool | ty::Char => {
|
||||
self = ty.print(self)?;
|
||||
ty.print(self)?;
|
||||
|
||||
let mut bits = ct.eval_bits(self.tcx, ty::ParamEnv::reveal_all());
|
||||
|
||||
@ -645,7 +646,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
.ty;
|
||||
// FIXME(const_generics): add an assert that we only do this for valtrees.
|
||||
let dereferenced_const = self.tcx.mk_ct_from_kind(ct.kind(), pointee_ty);
|
||||
self = dereferenced_const.print(self)?;
|
||||
dereferenced_const.print(self)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -654,22 +655,22 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
let contents = self.tcx.destructure_const(ct);
|
||||
let fields = contents.fields.iter().copied();
|
||||
|
||||
let print_field_list = |mut this: Self| {
|
||||
let print_field_list = |this: &mut Self| {
|
||||
for field in fields.clone() {
|
||||
this = field.print(this)?;
|
||||
field.print(this)?;
|
||||
}
|
||||
this.push("E");
|
||||
Ok(this)
|
||||
Ok(())
|
||||
};
|
||||
|
||||
match *ct.ty().kind() {
|
||||
ty::Array(..) | ty::Slice(_) => {
|
||||
self.push("A");
|
||||
self = print_field_list(self)?;
|
||||
print_field_list(self)?;
|
||||
}
|
||||
ty::Tuple(..) => {
|
||||
self.push("T");
|
||||
self = print_field_list(self)?;
|
||||
print_field_list(self)?;
|
||||
}
|
||||
ty::Adt(def, args) => {
|
||||
let variant_idx =
|
||||
@ -677,7 +678,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
let variant_def = &def.variant(variant_idx);
|
||||
|
||||
self.push("V");
|
||||
self = self.print_def_path(variant_def.def_id, args)?;
|
||||
self.print_def_path(variant_def.def_id, args)?;
|
||||
|
||||
match variant_def.ctor_kind() {
|
||||
Some(CtorKind::Const) => {
|
||||
@ -685,7 +686,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
}
|
||||
Some(CtorKind::Fn) => {
|
||||
self.push("T");
|
||||
self = print_field_list(self)?;
|
||||
print_field_list(self)?;
|
||||
}
|
||||
None => {
|
||||
self.push("S");
|
||||
@ -701,7 +702,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
);
|
||||
self.push_ident(field_name.unwrap_or(kw::Empty).as_str());
|
||||
|
||||
self = field.print(self)?;
|
||||
field.print(self)?;
|
||||
}
|
||||
self.push("E");
|
||||
}
|
||||
@ -720,47 +721,47 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
if !ct.has_escaping_bound_vars() {
|
||||
self.consts.insert(ct, start);
|
||||
}
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn path_crate(self, cnum: CrateNum) -> Result<Self, PrintError> {
|
||||
fn path_crate(&mut self, cnum: CrateNum) -> Result<(), PrintError> {
|
||||
self.push("C");
|
||||
let stable_crate_id = self.tcx.def_path_hash(cnum.as_def_id()).stable_crate_id();
|
||||
self.push_disambiguator(stable_crate_id.as_u64());
|
||||
let name = self.tcx.crate_name(cnum);
|
||||
self.push_ident(name.as_str());
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn path_qualified(
|
||||
mut self,
|
||||
&mut self,
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
assert!(trait_ref.is_some());
|
||||
let trait_ref = trait_ref.unwrap();
|
||||
|
||||
self.push("Y");
|
||||
self = self_ty.print(self)?;
|
||||
self_ty.print(self)?;
|
||||
self.print_def_path(trait_ref.def_id, trait_ref.args)
|
||||
}
|
||||
|
||||
fn path_append_impl(
|
||||
self,
|
||||
_: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
_: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
_: &DisambiguatedDefPathData,
|
||||
_: Ty<'tcx>,
|
||||
_: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
// Inlined into `print_impl_path`
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn path_append(
|
||||
self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
disambiguated_data: &DisambiguatedDefPathData,
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
let ns = match disambiguated_data.data {
|
||||
// Extern block segments can be skipped, names from extern blocks
|
||||
// are effectively living in their parent modules.
|
||||
@ -797,10 +798,10 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
}
|
||||
|
||||
fn path_generic_args(
|
||||
mut self,
|
||||
print_prefix: impl FnOnce(Self) -> Result<Self, PrintError>,
|
||||
&mut self,
|
||||
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
|
||||
args: &[GenericArg<'tcx>],
|
||||
) -> Result<Self, PrintError> {
|
||||
) -> Result<(), PrintError> {
|
||||
// Don't print any regions if they're all erased.
|
||||
let print_regions = args.iter().any(|arg| match arg.unpack() {
|
||||
GenericArgKind::Lifetime(r) => !r.is_erased(),
|
||||
@ -816,23 +817,23 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
|
||||
}
|
||||
|
||||
self.push("I");
|
||||
self = print_prefix(self)?;
|
||||
print_prefix(self)?;
|
||||
for arg in args {
|
||||
match arg.unpack() {
|
||||
GenericArgKind::Lifetime(lt) => {
|
||||
self = lt.print(self)?;
|
||||
lt.print(self)?;
|
||||
}
|
||||
GenericArgKind::Type(ty) => {
|
||||
self = ty.print(self)?;
|
||||
ty.print(self)?;
|
||||
}
|
||||
GenericArgKind::Const(c) => {
|
||||
self.push("K");
|
||||
self = c.print(self)?;
|
||||
c.print(self)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
self.push("E");
|
||||
|
||||
Ok(self)
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -246,14 +246,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
if pred_str.len() > 50 {
|
||||
// We don't need to save the type to a file, we will be talking about this type already
|
||||
// in a separate note when we explain the obligation, so it will be available that way.
|
||||
pred_str = predicate
|
||||
.print(FmtPrinter::new_with_limit(
|
||||
self.tcx,
|
||||
Namespace::TypeNS,
|
||||
rustc_session::Limit(6),
|
||||
))
|
||||
.unwrap()
|
||||
.into_buffer();
|
||||
let mut cx: FmtPrinter<'_, '_> =
|
||||
FmtPrinter::new_with_limit(self.tcx, Namespace::TypeNS, rustc_session::Limit(6));
|
||||
predicate.print(&mut cx).unwrap();
|
||||
pred_str = cx.into_buffer();
|
||||
}
|
||||
let mut err = struct_span_err!(
|
||||
self.tcx.sess,
|
||||
@ -1408,17 +1404,15 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
self.maybe_detailed_projection_msg(predicate, normalized_term, expected_term)
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
with_forced_trimmed_paths!(format!(
|
||||
"type mismatch resolving `{}`",
|
||||
self.resolve_vars_if_possible(predicate)
|
||||
.print(FmtPrinter::new_with_limit(
|
||||
self.tcx,
|
||||
Namespace::TypeNS,
|
||||
rustc_session::Limit(10),
|
||||
))
|
||||
.unwrap()
|
||||
.into_buffer()
|
||||
))
|
||||
let mut cx = FmtPrinter::new_with_limit(
|
||||
self.tcx,
|
||||
Namespace::TypeNS,
|
||||
rustc_session::Limit(10),
|
||||
);
|
||||
with_forced_trimmed_paths!(format!("type mismatch resolving `{}`", {
|
||||
self.resolve_vars_if_possible(predicate).print(&mut cx).unwrap();
|
||||
cx.into_buffer()
|
||||
}))
|
||||
});
|
||||
let mut diag = struct_span_err!(self.tcx.sess, obligation.cause.span, E0271, "{msg}");
|
||||
|
||||
@ -1463,14 +1457,15 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
ty.span,
|
||||
with_forced_trimmed_paths!(Cow::from(format!(
|
||||
"type mismatch resolving `{}`",
|
||||
self.resolve_vars_if_possible(predicate)
|
||||
.print(FmtPrinter::new_with_limit(
|
||||
{
|
||||
let mut cx = FmtPrinter::new_with_limit(
|
||||
self.tcx,
|
||||
Namespace::TypeNS,
|
||||
rustc_session::Limit(5),
|
||||
))
|
||||
.unwrap()
|
||||
.into_buffer()
|
||||
);
|
||||
self.resolve_vars_if_possible(predicate).print(&mut cx).unwrap();
|
||||
cx.into_buffer()
|
||||
}
|
||||
))),
|
||||
)),
|
||||
_ => None,
|
||||
|
@ -62,18 +62,15 @@ mod imp {
|
||||
unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), libc::GRND_NONBLOCK) }
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "espidf", target_os = "horizon"))]
|
||||
#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "freebsd"))]
|
||||
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
|
||||
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
|
||||
}
|
||||
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
|
||||
// FIXME: using the above when libary std's libc is updated
|
||||
#[cfg(not(target_os = "freebsd"))]
|
||||
use libc::getrandom;
|
||||
#[cfg(target_os = "freebsd")]
|
||||
extern "C" {
|
||||
fn getrandom(
|
||||
buffer: *mut libc::c_void,
|
||||
length: libc::size_t,
|
||||
buf: *mut libc::c_void,
|
||||
buflen: libc::size_t,
|
||||
flags: libc::c_uint,
|
||||
) -> libc::ssize_t;
|
||||
}
|
||||
@ -236,6 +233,7 @@ mod imp {
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: once the 10.x release becomes the minimum, this can be dropped for simplification.
|
||||
#[cfg(target_os = "netbsd")]
|
||||
mod imp {
|
||||
use crate::ptr;
|
||||
|
@ -641,13 +641,13 @@ fn build_const(cx: &mut DocContext<'_>, def_id: DefId) -> clean::Constant {
|
||||
clean::simplify::move_bounds_to_generic_parameters(&mut generics);
|
||||
|
||||
clean::Constant {
|
||||
type_: clean_middle_ty(
|
||||
type_: Box::new(clean_middle_ty(
|
||||
ty::Binder::dummy(cx.tcx.type_of(def_id).instantiate_identity()),
|
||||
cx,
|
||||
Some(def_id),
|
||||
None,
|
||||
),
|
||||
generics: Box::new(generics),
|
||||
)),
|
||||
generics,
|
||||
kind: clean::ConstantKind::Extern { def_id },
|
||||
}
|
||||
}
|
||||
|
@ -259,13 +259,13 @@ fn clean_lifetime<'tcx>(lifetime: &hir::Lifetime, cx: &mut DocContext<'tcx>) ->
|
||||
pub(crate) fn clean_const<'tcx>(constant: &hir::ConstArg, cx: &mut DocContext<'tcx>) -> Constant {
|
||||
let def_id = cx.tcx.hir().body_owner_def_id(constant.value.body).to_def_id();
|
||||
Constant {
|
||||
type_: clean_middle_ty(
|
||||
type_: Box::new(clean_middle_ty(
|
||||
ty::Binder::dummy(cx.tcx.type_of(def_id).instantiate_identity()),
|
||||
cx,
|
||||
Some(def_id),
|
||||
None,
|
||||
),
|
||||
generics: Box::new(Generics::default()),
|
||||
)),
|
||||
generics: Generics::default(),
|
||||
kind: ConstantKind::Anonymous { body: constant.value.body },
|
||||
}
|
||||
}
|
||||
@ -276,8 +276,8 @@ pub(crate) fn clean_middle_const<'tcx>(
|
||||
) -> Constant {
|
||||
// FIXME: instead of storing the stringified expression, store `self` directly instead.
|
||||
Constant {
|
||||
type_: clean_middle_ty(constant.map_bound(|c| c.ty()), cx, None, None),
|
||||
generics: Box::new(Generics::default()),
|
||||
type_: Box::new(clean_middle_ty(constant.map_bound(|c| c.ty()), cx, None, None)),
|
||||
generics: Generics::default(),
|
||||
kind: ConstantKind::TyConst { expr: constant.skip_binder().to_string().into() },
|
||||
}
|
||||
}
|
||||
@ -1216,14 +1216,14 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext
|
||||
hir::TraitItemKind::Const(ty, Some(default)) => {
|
||||
let generics = enter_impl_trait(cx, |cx| clean_generics(trait_item.generics, cx));
|
||||
AssocConstItem(
|
||||
Box::new(generics),
|
||||
clean_ty(ty, cx),
|
||||
generics,
|
||||
Box::new(clean_ty(ty, cx)),
|
||||
ConstantKind::Local { def_id: local_did, body: default },
|
||||
)
|
||||
}
|
||||
hir::TraitItemKind::Const(ty, None) => {
|
||||
let generics = enter_impl_trait(cx, |cx| clean_generics(trait_item.generics, cx));
|
||||
TyAssocConstItem(Box::new(generics), clean_ty(ty, cx))
|
||||
TyAssocConstItem(generics, Box::new(clean_ty(ty, cx)))
|
||||
}
|
||||
hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Provided(body)) => {
|
||||
let m = clean_function(cx, sig, trait_item.generics, FunctionArgs::Body(body));
|
||||
@ -1272,7 +1272,7 @@ pub(crate) fn clean_impl_item<'tcx>(
|
||||
hir::ImplItemKind::Const(ty, expr) => {
|
||||
let generics = clean_generics(impl_.generics, cx);
|
||||
let default = ConstantKind::Local { def_id: local_did, body: expr };
|
||||
AssocConstItem(Box::new(generics), clean_ty(ty, cx), default)
|
||||
AssocConstItem(generics, Box::new(clean_ty(ty, cx)), default)
|
||||
}
|
||||
hir::ImplItemKind::Fn(ref sig, body) => {
|
||||
let m = clean_function(cx, sig, impl_.generics, FunctionArgs::Body(body));
|
||||
@ -1311,18 +1311,18 @@ pub(crate) fn clean_middle_assoc_item<'tcx>(
|
||||
let tcx = cx.tcx;
|
||||
let kind = match assoc_item.kind {
|
||||
ty::AssocKind::Const => {
|
||||
let ty = clean_middle_ty(
|
||||
let ty = Box::new(clean_middle_ty(
|
||||
ty::Binder::dummy(tcx.type_of(assoc_item.def_id).instantiate_identity()),
|
||||
cx,
|
||||
Some(assoc_item.def_id),
|
||||
None,
|
||||
);
|
||||
));
|
||||
|
||||
let mut generics = Box::new(clean_ty_generics(
|
||||
let mut generics = clean_ty_generics(
|
||||
cx,
|
||||
tcx.generics_of(assoc_item.def_id),
|
||||
tcx.explicit_predicates_of(assoc_item.def_id),
|
||||
));
|
||||
);
|
||||
simplify::move_bounds_to_generic_parameters(&mut generics);
|
||||
|
||||
let provided = match assoc_item.container {
|
||||
@ -2718,8 +2718,8 @@ fn clean_maybe_renamed_item<'tcx>(
|
||||
StaticItem(Static { type_: clean_ty(ty, cx), mutability, expr: Some(body_id) })
|
||||
}
|
||||
ItemKind::Const(ty, generics, body_id) => ConstantItem(Constant {
|
||||
type_: clean_ty(ty, cx),
|
||||
generics: Box::new(clean_generics(generics, cx)),
|
||||
type_: Box::new(clean_ty(ty, cx)),
|
||||
generics: clean_generics(generics, cx),
|
||||
kind: ConstantKind::Local { body: body_id, def_id },
|
||||
}),
|
||||
ItemKind::OpaqueTy(ref ty) => OpaqueTyItem(OpaqueTy {
|
||||
|
@ -852,9 +852,9 @@ pub(crate) enum ItemKind {
|
||||
ProcMacroItem(ProcMacro),
|
||||
PrimitiveItem(PrimitiveType),
|
||||
/// A required associated constant in a trait declaration.
|
||||
TyAssocConstItem(Box<Generics>, Type),
|
||||
TyAssocConstItem(Generics, Box<Type>),
|
||||
/// An associated constant in a trait impl or a provided one in a trait declaration.
|
||||
AssocConstItem(Box<Generics>, Type, ConstantKind),
|
||||
AssocConstItem(Generics, Box<Type>, ConstantKind),
|
||||
/// A required associated type in a trait declaration.
|
||||
///
|
||||
/// The bounds may be non-empty if there is a `where` clause.
|
||||
@ -2282,8 +2282,8 @@ pub(crate) struct Static {
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
|
||||
pub(crate) struct Constant {
|
||||
pub(crate) type_: Type,
|
||||
pub(crate) generics: Box<Generics>,
|
||||
pub(crate) type_: Box<Type>,
|
||||
pub(crate) generics: Generics,
|
||||
pub(crate) kind: ConstantKind,
|
||||
}
|
||||
|
||||
@ -2524,8 +2524,7 @@ mod size_asserts {
|
||||
static_assert_size!(GenericParamDef, 56);
|
||||
static_assert_size!(Generics, 16);
|
||||
static_assert_size!(Item, 56);
|
||||
// FIXME(generic_const_items): Further reduce the size.
|
||||
static_assert_size!(ItemKind, 72);
|
||||
static_assert_size!(ItemKind, 56);
|
||||
static_assert_size!(PathSegment, 40);
|
||||
static_assert_size!(Type, 32);
|
||||
// tidy-alphabetical-end
|
||||
|
@ -177,7 +177,7 @@ impl FromWithTcx<clean::Constant> for Constant {
|
||||
let expr = constant.expr(tcx);
|
||||
let value = constant.value(tcx);
|
||||
let is_literal = constant.is_literal(tcx);
|
||||
Constant { type_: constant.type_.into_tcx(tcx), expr, value, is_literal }
|
||||
Constant { type_: (*constant.type_).into_tcx(tcx), expr, value, is_literal }
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,11 +325,11 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
|
||||
}
|
||||
// FIXME(generic_const_items): Add support for generic associated consts.
|
||||
TyAssocConstItem(_generics, ty) => {
|
||||
ItemEnum::AssocConst { type_: ty.into_tcx(tcx), default: None }
|
||||
ItemEnum::AssocConst { type_: (*ty).into_tcx(tcx), default: None }
|
||||
}
|
||||
// FIXME(generic_const_items): Add support for generic associated consts.
|
||||
AssocConstItem(_generics, ty, default) => {
|
||||
ItemEnum::AssocConst { type_: ty.into_tcx(tcx), default: Some(default.expr(tcx)) }
|
||||
ItemEnum::AssocConst { type_: (*ty).into_tcx(tcx), default: Some(default.expr(tcx)) }
|
||||
}
|
||||
TyAssocTypeItem(g, b) => ItemEnum::AssocType {
|
||||
generics: g.into_tcx(tcx),
|
||||
|
12
tests/ui/consts/issue-116186.rs
Normal file
12
tests/ui/consts/issue-116186.rs
Normal file
@ -0,0 +1,12 @@
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(generic_const_exprs)]
|
||||
|
||||
fn something(path: [usize; N]) -> impl Clone {
|
||||
//~^ ERROR cannot find value `N` in this scope
|
||||
match path {
|
||||
[] => 0, //~ ERROR cannot pattern-match on an array without a fixed length
|
||||
_ => 1,
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {}
|
21
tests/ui/consts/issue-116186.stderr
Normal file
21
tests/ui/consts/issue-116186.stderr
Normal file
@ -0,0 +1,21 @@
|
||||
error[E0425]: cannot find value `N` in this scope
|
||||
--> $DIR/issue-116186.rs:4:28
|
||||
|
|
||||
LL | fn something(path: [usize; N]) -> impl Clone {
|
||||
| ^ not found in this scope
|
||||
|
|
||||
help: you might be missing a const parameter
|
||||
|
|
||||
LL | fn something<const N: /* Type */>(path: [usize; N]) -> impl Clone {
|
||||
| +++++++++++++++++++++
|
||||
|
||||
error[E0730]: cannot pattern-match on an array without a fixed length
|
||||
--> $DIR/issue-116186.rs:7:9
|
||||
|
|
||||
LL | [] => 0,
|
||||
| ^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0425, E0730.
|
||||
For more information about an error, try `rustc --explain E0425`.
|
@ -554,13 +554,9 @@ cc = ["@davidtwco", "@compiler-errors", "@JohnTitor", "@TaKO8Ki"]
|
||||
message = "`rustc_macros::diagnostics` was changed"
|
||||
cc = ["@davidtwco", "@compiler-errors", "@JohnTitor", "@TaKO8Ki"]
|
||||
|
||||
[mentions."compiler/rustc_smir"]
|
||||
message = "This PR changes Stable MIR"
|
||||
cc = ["@oli-obk", "@celinval", "@spastorino", "@ouz-a"]
|
||||
|
||||
[mentions."compiler/stable_mir"]
|
||||
message = "This PR changes Stable MIR"
|
||||
cc = ["@oli-obk", "@celinval", "@spastorino"]
|
||||
cc = ["@oli-obk", "@celinval", "@spastorino", "@ouz-a"]
|
||||
|
||||
[mentions."compiler/rustc_target/src/spec"]
|
||||
message = """
|
||||
|
Loading…
Reference in New Issue
Block a user