Rollup merge of #91625 - est31:remove_indexes, r=oli-obk
Remove redundant [..]s
This commit is contained in:
commit
40988591ec
@ -57,7 +57,7 @@ fn from_lit_token(lit: token::Lit) -> Result<LitKind, LitError> {
|
|||||||
// string in the token.
|
// string in the token.
|
||||||
let s = symbol.as_str();
|
let s = symbol.as_str();
|
||||||
let symbol =
|
let symbol =
|
||||||
if s.contains(&['\\', '\r'][..]) {
|
if s.contains(&['\\', '\r']) {
|
||||||
let mut buf = String::with_capacity(s.len());
|
let mut buf = String::with_capacity(s.len());
|
||||||
let mut error = Ok(());
|
let mut error = Ok(());
|
||||||
unescape_literal(&s, Mode::Str, &mut |_, unescaped_char| {
|
unescape_literal(&s, Mode::Str, &mut |_, unescaped_char| {
|
||||||
|
@ -347,7 +347,7 @@ macro_rules! gate_doc { ($($name:ident => $feature:ident)*) => {
|
|||||||
|
|
||||||
if let Some(modifiers) = nested_meta.value_str() {
|
if let Some(modifiers) = nested_meta.value_str() {
|
||||||
for modifier in modifiers.as_str().split(',') {
|
for modifier in modifiers.as_str().split(',') {
|
||||||
if let Some(modifier) = modifier.strip_prefix(&['+', '-'][..]) {
|
if let Some(modifier) = modifier.strip_prefix(&['+', '-']) {
|
||||||
macro_rules! gate_modifier { ($($name:literal => $feature:ident)*) => {
|
macro_rules! gate_modifier { ($($name:literal => $feature:ident)*) => {
|
||||||
$(if modifier == $name {
|
$(if modifier == $name {
|
||||||
let msg = concat!("`#[link(modifiers=\"", $name, "\")]` is unstable");
|
let msg = concat!("`#[link(modifiers=\"", $name, "\")]` is unstable");
|
||||||
@ -383,7 +383,7 @@ fn visit_item(&mut self, i: &'a ast::Item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ast::ItemKind::Fn(..) => {
|
ast::ItemKind::Fn(..) => {
|
||||||
if self.sess.contains_name(&i.attrs[..], sym::start) {
|
if self.sess.contains_name(&i.attrs, sym::start) {
|
||||||
gate_feature_post!(
|
gate_feature_post!(
|
||||||
&self,
|
&self,
|
||||||
start,
|
start,
|
||||||
@ -396,7 +396,7 @@ fn visit_item(&mut self, i: &'a ast::Item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ast::ItemKind::Struct(..) => {
|
ast::ItemKind::Struct(..) => {
|
||||||
for attr in self.sess.filter_by_name(&i.attrs[..], sym::repr) {
|
for attr in self.sess.filter_by_name(&i.attrs, sym::repr) {
|
||||||
for item in attr.meta_item_list().unwrap_or_else(Vec::new) {
|
for item in attr.meta_item_list().unwrap_or_else(Vec::new) {
|
||||||
if item.has_name(sym::simd) {
|
if item.has_name(sym::simd) {
|
||||||
gate_feature_post!(
|
gate_feature_post!(
|
||||||
|
@ -499,7 +499,7 @@ fn print_meta_item(&mut self, item: &ast::MetaItem) {
|
|||||||
ast::MetaItemKind::List(ref items) => {
|
ast::MetaItemKind::List(ref items) => {
|
||||||
self.print_path(&item.path, false, 0);
|
self.print_path(&item.path, false, 0);
|
||||||
self.popen();
|
self.popen();
|
||||||
self.commasep(Consistent, &items[..], |s, i| s.print_meta_list_item(i));
|
self.commasep(Consistent, &items, |s, i| s.print_meta_list_item(i));
|
||||||
self.pclose();
|
self.pclose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -997,7 +997,7 @@ pub fn print_type(&mut self, ty: &ast::Ty) {
|
|||||||
}
|
}
|
||||||
ast::TyKind::Tup(ref elts) => {
|
ast::TyKind::Tup(ref elts) => {
|
||||||
self.popen();
|
self.popen();
|
||||||
self.commasep(Inconsistent, &elts[..], |s, ty| s.print_type(ty));
|
self.commasep(Inconsistent, &elts, |s, ty| s.print_type(ty));
|
||||||
if elts.len() == 1 {
|
if elts.len() == 1 {
|
||||||
self.word(",");
|
self.word(",");
|
||||||
}
|
}
|
||||||
@ -1017,10 +1017,10 @@ pub fn print_type(&mut self, ty: &ast::Ty) {
|
|||||||
ast::TyKind::Path(Some(ref qself), ref path) => self.print_qpath(path, qself, false),
|
ast::TyKind::Path(Some(ref qself), ref path) => self.print_qpath(path, qself, false),
|
||||||
ast::TyKind::TraitObject(ref bounds, syntax) => {
|
ast::TyKind::TraitObject(ref bounds, syntax) => {
|
||||||
let prefix = if syntax == ast::TraitObjectSyntax::Dyn { "dyn" } else { "" };
|
let prefix = if syntax == ast::TraitObjectSyntax::Dyn { "dyn" } else { "" };
|
||||||
self.print_type_bounds(prefix, &bounds[..]);
|
self.print_type_bounds(prefix, &bounds);
|
||||||
}
|
}
|
||||||
ast::TyKind::ImplTrait(_, ref bounds) => {
|
ast::TyKind::ImplTrait(_, ref bounds) => {
|
||||||
self.print_type_bounds("impl", &bounds[..]);
|
self.print_type_bounds("impl", &bounds);
|
||||||
}
|
}
|
||||||
ast::TyKind::Array(ref ty, ref length) => {
|
ast::TyKind::Array(ref ty, ref length) => {
|
||||||
self.word("[");
|
self.word("[");
|
||||||
@ -1339,7 +1339,7 @@ fn print_associated_type(
|
|||||||
real_bounds.push(b.clone());
|
real_bounds.push(b.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.print_type_bounds(":", &real_bounds[..]);
|
self.print_type_bounds(":", &real_bounds);
|
||||||
self.print_where_clause(&generics.where_clause);
|
self.print_where_clause(&generics.where_clause);
|
||||||
self.word(" ");
|
self.word(" ");
|
||||||
self.bopen();
|
self.bopen();
|
||||||
@ -1368,7 +1368,7 @@ fn print_associated_type(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.nbsp();
|
self.nbsp();
|
||||||
self.print_type_bounds("=", &real_bounds[..]);
|
self.print_type_bounds("=", &real_bounds);
|
||||||
self.print_where_clause(&generics.where_clause);
|
self.print_where_clause(&generics.where_clause);
|
||||||
self.word(";");
|
self.word(";");
|
||||||
}
|
}
|
||||||
@ -1960,10 +1960,10 @@ fn print_expr_outer_attr_style(&mut self, expr: &ast::Expr, is_inline: bool) {
|
|||||||
self.print_expr_tup(exprs);
|
self.print_expr_tup(exprs);
|
||||||
}
|
}
|
||||||
ast::ExprKind::Call(ref func, ref args) => {
|
ast::ExprKind::Call(ref func, ref args) => {
|
||||||
self.print_expr_call(func, &args[..]);
|
self.print_expr_call(func, &args);
|
||||||
}
|
}
|
||||||
ast::ExprKind::MethodCall(ref segment, ref args, _) => {
|
ast::ExprKind::MethodCall(ref segment, ref args, _) => {
|
||||||
self.print_expr_method_call(segment, &args[..]);
|
self.print_expr_method_call(segment, &args);
|
||||||
}
|
}
|
||||||
ast::ExprKind::Binary(op, ref lhs, ref rhs) => {
|
ast::ExprKind::Binary(op, ref lhs, ref rhs) => {
|
||||||
self.print_expr_binary(op, lhs, rhs);
|
self.print_expr_binary(op, lhs, rhs);
|
||||||
@ -2440,11 +2440,11 @@ fn print_qpath(&mut self, path: &ast::Path, qself: &ast::QSelf, colons_before_pa
|
|||||||
self.print_path(path, true, 0);
|
self.print_path(path, true, 0);
|
||||||
}
|
}
|
||||||
self.popen();
|
self.popen();
|
||||||
self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(p));
|
self.commasep(Inconsistent, &elts, |s, p| s.print_pat(p));
|
||||||
self.pclose();
|
self.pclose();
|
||||||
}
|
}
|
||||||
PatKind::Or(ref pats) => {
|
PatKind::Or(ref pats) => {
|
||||||
self.strsep("|", true, Inconsistent, &pats[..], |s, p| s.print_pat(p));
|
self.strsep("|", true, Inconsistent, &pats, |s, p| s.print_pat(p));
|
||||||
}
|
}
|
||||||
PatKind::Path(None, ref path) => {
|
PatKind::Path(None, ref path) => {
|
||||||
self.print_path(path, true, 0);
|
self.print_path(path, true, 0);
|
||||||
@ -2462,7 +2462,7 @@ fn print_qpath(&mut self, path: &ast::Path, qself: &ast::QSelf, colons_before_pa
|
|||||||
self.word_space("{");
|
self.word_space("{");
|
||||||
self.commasep_cmnt(
|
self.commasep_cmnt(
|
||||||
Consistent,
|
Consistent,
|
||||||
&fields[..],
|
&fields,
|
||||||
|s, f| {
|
|s, f| {
|
||||||
s.cbox(INDENT_UNIT);
|
s.cbox(INDENT_UNIT);
|
||||||
if !f.is_shorthand {
|
if !f.is_shorthand {
|
||||||
@ -2485,7 +2485,7 @@ fn print_qpath(&mut self, path: &ast::Path, qself: &ast::QSelf, colons_before_pa
|
|||||||
}
|
}
|
||||||
PatKind::Tuple(ref elts) => {
|
PatKind::Tuple(ref elts) => {
|
||||||
self.popen();
|
self.popen();
|
||||||
self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(p));
|
self.commasep(Inconsistent, &elts, |s, p| s.print_pat(p));
|
||||||
if elts.len() == 1 {
|
if elts.len() == 1 {
|
||||||
self.word(",");
|
self.word(",");
|
||||||
}
|
}
|
||||||
@ -2527,7 +2527,7 @@ fn print_qpath(&mut self, path: &ast::Path, qself: &ast::QSelf, colons_before_pa
|
|||||||
}
|
}
|
||||||
PatKind::Slice(ref elts) => {
|
PatKind::Slice(ref elts) => {
|
||||||
self.word("[");
|
self.word("[");
|
||||||
self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(p));
|
self.commasep(Inconsistent, &elts, |s, p| s.print_pat(p));
|
||||||
self.word("]");
|
self.word("]");
|
||||||
}
|
}
|
||||||
PatKind::Rest => self.word(".."),
|
PatKind::Rest => self.word(".."),
|
||||||
@ -2836,7 +2836,7 @@ pub fn print_type_bounds(&mut self, prefix: &'static str, bounds: &[ast::Generic
|
|||||||
self.print_path(&tree.prefix, false, 0);
|
self.print_path(&tree.prefix, false, 0);
|
||||||
self.word("::{");
|
self.word("::{");
|
||||||
}
|
}
|
||||||
self.commasep(Inconsistent, &items[..], |this, &(ref tree, _)| {
|
self.commasep(Inconsistent, &items, |this, &(ref tree, _)| {
|
||||||
this.print_use_tree(tree)
|
this.print_use_tree(tree)
|
||||||
});
|
});
|
||||||
self.word("}");
|
self.word("}");
|
||||||
|
@ -712,7 +712,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
|
|||||||
Some(&idx) => Some(idx),
|
Some(&idx) => Some(idx),
|
||||||
None => {
|
None => {
|
||||||
let msg = format!("there is no argument named `{}`", name);
|
let msg = format!("there is no argument named `{}`", name);
|
||||||
ecx.struct_span_err(span, &msg[..]).emit();
|
ecx.struct_span_err(span, &msg).emit();
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -766,8 +766,8 @@ fn expand_struct_def(
|
|||||||
self,
|
self,
|
||||||
struct_def,
|
struct_def,
|
||||||
type_ident,
|
type_ident,
|
||||||
&self_args[..],
|
&self_args,
|
||||||
&nonself_args[..],
|
&nonself_args,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
method_def.expand_struct_method_body(
|
method_def.expand_struct_method_body(
|
||||||
@ -775,8 +775,8 @@ fn expand_struct_def(
|
|||||||
self,
|
self,
|
||||||
struct_def,
|
struct_def,
|
||||||
type_ident,
|
type_ident,
|
||||||
&self_args[..],
|
&self_args,
|
||||||
&nonself_args[..],
|
&nonself_args,
|
||||||
use_temporaries,
|
use_temporaries,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
@ -815,8 +815,8 @@ fn expand_enum_def(
|
|||||||
self,
|
self,
|
||||||
enum_def,
|
enum_def,
|
||||||
type_ident,
|
type_ident,
|
||||||
&self_args[..],
|
&self_args,
|
||||||
&nonself_args[..],
|
&nonself_args,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
method_def.expand_enum_method_body(
|
method_def.expand_enum_method_body(
|
||||||
@ -825,7 +825,7 @@ fn expand_enum_def(
|
|||||||
enum_def,
|
enum_def,
|
||||||
type_ident,
|
type_ident,
|
||||||
self_args,
|
self_args,
|
||||||
&nonself_args[..],
|
&nonself_args,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1217,7 +1217,7 @@ fn build_enum_match_tuple<'b>(
|
|||||||
let vi_idents = self_arg_names
|
let vi_idents = self_arg_names
|
||||||
.iter()
|
.iter()
|
||||||
.map(|name| {
|
.map(|name| {
|
||||||
let vi_suffix = format!("{}_vi", &name[..]);
|
let vi_suffix = format!("{}_vi", name);
|
||||||
Ident::from_str_and_span(&vi_suffix, span)
|
Ident::from_str_and_span(&vi_suffix, span)
|
||||||
})
|
})
|
||||||
.collect::<Vec<Ident>>();
|
.collect::<Vec<Ident>>();
|
||||||
@ -1226,7 +1226,7 @@ fn build_enum_match_tuple<'b>(
|
|||||||
// delegated expression that handles the catch-all case,
|
// delegated expression that handles the catch-all case,
|
||||||
// using `__variants_tuple` to drive logic if necessary.
|
// using `__variants_tuple` to drive logic if necessary.
|
||||||
let catch_all_substructure =
|
let catch_all_substructure =
|
||||||
EnumNonMatchingCollapsed(self_arg_idents, &variants[..], &vi_idents[..]);
|
EnumNonMatchingCollapsed(self_arg_idents, &variants, &vi_idents);
|
||||||
|
|
||||||
let first_fieldless = variants.iter().find(|v| v.data.fields().is_empty());
|
let first_fieldless = variants.iter().find(|v| v.data.fields().is_empty());
|
||||||
|
|
||||||
@ -1261,7 +1261,7 @@ fn build_enum_match_tuple<'b>(
|
|||||||
idents
|
idents
|
||||||
};
|
};
|
||||||
for self_arg_name in &self_arg_names[1..] {
|
for self_arg_name in &self_arg_names[1..] {
|
||||||
let (p, idents) = mk_self_pat(cx, &self_arg_name[..]);
|
let (p, idents) = mk_self_pat(cx, &self_arg_name);
|
||||||
subpats.push(p);
|
subpats.push(p);
|
||||||
self_pats_idents.push(idents);
|
self_pats_idents.push(idents);
|
||||||
}
|
}
|
||||||
|
@ -549,7 +549,7 @@ fn verify_arg_type(&mut self, arg: Position, ty: ArgumentType) {
|
|||||||
} else {
|
} else {
|
||||||
self.fmtsp
|
self.fmtsp
|
||||||
};
|
};
|
||||||
let mut err = self.ecx.struct_span_err(sp, &msg[..]);
|
let mut err = self.ecx.struct_span_err(sp, &msg);
|
||||||
|
|
||||||
err.note(&format!(
|
err.note(&format!(
|
||||||
"did you intend to capture a variable `{}` from \
|
"did you intend to capture a variable `{}` from \
|
||||||
|
@ -32,7 +32,7 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext<GccCodegenBackend>, _diag_han
|
|||||||
if config.emit_asm {
|
if config.emit_asm {
|
||||||
let _timer = cgcx
|
let _timer = cgcx
|
||||||
.prof
|
.prof
|
||||||
.generic_activity_with_arg("LLVM_module_codegen_emit_asm", &module.name[..]);
|
.generic_activity_with_arg("LLVM_module_codegen_emit_asm", &*module.name);
|
||||||
let path = cgcx.output_filenames.temp_path(OutputType::Assembly, module_name);
|
let path = cgcx.output_filenames.temp_path(OutputType::Assembly, module_name);
|
||||||
context.compile_to_file(OutputKind::Assembler, path.to_str().expect("path to str"));
|
context.compile_to_file(OutputKind::Assembler, path.to_str().expect("path to str"));
|
||||||
}
|
}
|
||||||
@ -41,7 +41,7 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext<GccCodegenBackend>, _diag_han
|
|||||||
EmitObj::ObjectCode(_) => {
|
EmitObj::ObjectCode(_) => {
|
||||||
let _timer = cgcx
|
let _timer = cgcx
|
||||||
.prof
|
.prof
|
||||||
.generic_activity_with_arg("LLVM_module_codegen_emit_obj", &module.name[..]);
|
.generic_activity_with_arg("LLVM_module_codegen_emit_obj", &*module.name);
|
||||||
match &*module.name {
|
match &*module.name {
|
||||||
"std_example.7rcbfp3g-cgu.15" => {
|
"std_example.7rcbfp3g-cgu.15" => {
|
||||||
println!("Dumping reproducer {}", module.name);
|
println!("Dumping reproducer {}", module.name);
|
||||||
|
@ -477,7 +477,7 @@ pub(crate) fn inline_asm_call(
|
|||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
debug!("Asm Output Type: {:?}", output);
|
debug!("Asm Output Type: {:?}", output);
|
||||||
let fty = bx.cx.type_func(&argtys[..], output);
|
let fty = bx.cx.type_func(&argtys, output);
|
||||||
unsafe {
|
unsafe {
|
||||||
// Ask LLVM to verify that the constraints are well-formed.
|
// Ask LLVM to verify that the constraints are well-formed.
|
||||||
let constraints_ok = llvm::LLVMRustInlineAsmVerify(fty, cons.as_ptr().cast(), cons.len());
|
let constraints_ok = llvm::LLVMRustInlineAsmVerify(fty, cons.as_ptr().cast(), cons.len());
|
||||||
|
@ -587,7 +587,7 @@ pub(crate) fn run_pass_manager(
|
|||||||
config: &ModuleConfig,
|
config: &ModuleConfig,
|
||||||
thin: bool,
|
thin: bool,
|
||||||
) -> Result<(), FatalError> {
|
) -> Result<(), FatalError> {
|
||||||
let _timer = cgcx.prof.extra_verbose_generic_activity("LLVM_lto_optimize", &module.name[..]);
|
let _timer = cgcx.prof.extra_verbose_generic_activity("LLVM_lto_optimize", &*module.name);
|
||||||
|
|
||||||
// Now we have one massive module inside of llmod. Time to run the
|
// Now we have one massive module inside of llmod. Time to run the
|
||||||
// LTO-specific optimization passes that LLVM provides.
|
// LTO-specific optimization passes that LLVM provides.
|
||||||
|
@ -510,7 +510,7 @@ pub(crate) unsafe fn optimize(
|
|||||||
module: &ModuleCodegen<ModuleLlvm>,
|
module: &ModuleCodegen<ModuleLlvm>,
|
||||||
config: &ModuleConfig,
|
config: &ModuleConfig,
|
||||||
) -> Result<(), FatalError> {
|
) -> Result<(), FatalError> {
|
||||||
let _timer = cgcx.prof.generic_activity_with_arg("LLVM_module_optimize", &module.name[..]);
|
let _timer = cgcx.prof.generic_activity_with_arg("LLVM_module_optimize", &*module.name);
|
||||||
|
|
||||||
let llmod = module.module_llvm.llmod();
|
let llmod = module.module_llvm.llmod();
|
||||||
let llcx = &*module.module_llvm.llcx;
|
let llcx = &*module.module_llvm.llcx;
|
||||||
@ -663,14 +663,14 @@ pub(crate) unsafe fn optimize(
|
|||||||
{
|
{
|
||||||
let _timer = cgcx.prof.extra_verbose_generic_activity(
|
let _timer = cgcx.prof.extra_verbose_generic_activity(
|
||||||
"LLVM_module_optimize_function_passes",
|
"LLVM_module_optimize_function_passes",
|
||||||
&module.name[..],
|
&*module.name,
|
||||||
);
|
);
|
||||||
llvm::LLVMRustRunFunctionPassManager(fpm, llmod);
|
llvm::LLVMRustRunFunctionPassManager(fpm, llmod);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
let _timer = cgcx.prof.extra_verbose_generic_activity(
|
let _timer = cgcx.prof.extra_verbose_generic_activity(
|
||||||
"LLVM_module_optimize_module_passes",
|
"LLVM_module_optimize_module_passes",
|
||||||
&module.name[..],
|
&*module.name,
|
||||||
);
|
);
|
||||||
llvm::LLVMRunPassManager(mpm, llmod);
|
llvm::LLVMRunPassManager(mpm, llmod);
|
||||||
}
|
}
|
||||||
@ -733,7 +733,7 @@ pub(crate) unsafe fn codegen(
|
|||||||
module: ModuleCodegen<ModuleLlvm>,
|
module: ModuleCodegen<ModuleLlvm>,
|
||||||
config: &ModuleConfig,
|
config: &ModuleConfig,
|
||||||
) -> Result<CompiledModule, FatalError> {
|
) -> Result<CompiledModule, FatalError> {
|
||||||
let _timer = cgcx.prof.generic_activity_with_arg("LLVM_module_codegen", &module.name[..]);
|
let _timer = cgcx.prof.generic_activity_with_arg("LLVM_module_codegen", &*module.name);
|
||||||
{
|
{
|
||||||
let llmod = module.module_llvm.llmod();
|
let llmod = module.module_llvm.llmod();
|
||||||
let llcx = &*module.module_llvm.llcx;
|
let llcx = &*module.module_llvm.llcx;
|
||||||
@ -782,7 +782,7 @@ unsafe fn with_codegen<'ll, F, R>(
|
|||||||
if config.bitcode_needed() {
|
if config.bitcode_needed() {
|
||||||
let _timer = cgcx
|
let _timer = cgcx
|
||||||
.prof
|
.prof
|
||||||
.generic_activity_with_arg("LLVM_module_codegen_make_bitcode", &module.name[..]);
|
.generic_activity_with_arg("LLVM_module_codegen_make_bitcode", &*module.name);
|
||||||
let thin = ThinBuffer::new(llmod);
|
let thin = ThinBuffer::new(llmod);
|
||||||
let data = thin.data();
|
let data = thin.data();
|
||||||
|
|
||||||
@ -795,10 +795,9 @@ unsafe fn with_codegen<'ll, F, R>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if config.emit_bc || config.emit_obj == EmitObj::Bitcode {
|
if config.emit_bc || config.emit_obj == EmitObj::Bitcode {
|
||||||
let _timer = cgcx.prof.generic_activity_with_arg(
|
let _timer = cgcx
|
||||||
"LLVM_module_codegen_emit_bitcode",
|
.prof
|
||||||
&module.name[..],
|
.generic_activity_with_arg("LLVM_module_codegen_emit_bitcode", &*module.name);
|
||||||
);
|
|
||||||
if let Err(e) = fs::write(&bc_out, data) {
|
if let Err(e) = fs::write(&bc_out, data) {
|
||||||
let msg = format!("failed to write bytecode to {}: {}", bc_out.display(), e);
|
let msg = format!("failed to write bytecode to {}: {}", bc_out.display(), e);
|
||||||
diag_handler.err(&msg);
|
diag_handler.err(&msg);
|
||||||
@ -806,18 +805,16 @@ unsafe fn with_codegen<'ll, F, R>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if config.emit_obj == EmitObj::ObjectCode(BitcodeSection::Full) {
|
if config.emit_obj == EmitObj::ObjectCode(BitcodeSection::Full) {
|
||||||
let _timer = cgcx.prof.generic_activity_with_arg(
|
let _timer = cgcx
|
||||||
"LLVM_module_codegen_embed_bitcode",
|
.prof
|
||||||
&module.name[..],
|
.generic_activity_with_arg("LLVM_module_codegen_embed_bitcode", &*module.name);
|
||||||
);
|
|
||||||
embed_bitcode(cgcx, llcx, llmod, &config.bc_cmdline, data);
|
embed_bitcode(cgcx, llcx, llmod, &config.bc_cmdline, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.emit_ir {
|
if config.emit_ir {
|
||||||
let _timer = cgcx
|
let _timer =
|
||||||
.prof
|
cgcx.prof.generic_activity_with_arg("LLVM_module_codegen_emit_ir", &*module.name);
|
||||||
.generic_activity_with_arg("LLVM_module_codegen_emit_ir", &module.name[..]);
|
|
||||||
let out = cgcx.output_filenames.temp_path(OutputType::LlvmAssembly, module_name);
|
let out = cgcx.output_filenames.temp_path(OutputType::LlvmAssembly, module_name);
|
||||||
let out_c = path_to_c_string(&out);
|
let out_c = path_to_c_string(&out);
|
||||||
|
|
||||||
@ -866,9 +863,8 @@ extern "C" fn demangle_callback(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if config.emit_asm {
|
if config.emit_asm {
|
||||||
let _timer = cgcx
|
let _timer =
|
||||||
.prof
|
cgcx.prof.generic_activity_with_arg("LLVM_module_codegen_emit_asm", &*module.name);
|
||||||
.generic_activity_with_arg("LLVM_module_codegen_emit_asm", &module.name[..]);
|
|
||||||
let path = cgcx.output_filenames.temp_path(OutputType::Assembly, module_name);
|
let path = cgcx.output_filenames.temp_path(OutputType::Assembly, module_name);
|
||||||
|
|
||||||
// We can't use the same module for asm and object code output,
|
// We can't use the same module for asm and object code output,
|
||||||
@ -898,7 +894,7 @@ extern "C" fn demangle_callback(
|
|||||||
EmitObj::ObjectCode(_) => {
|
EmitObj::ObjectCode(_) => {
|
||||||
let _timer = cgcx
|
let _timer = cgcx
|
||||||
.prof
|
.prof
|
||||||
.generic_activity_with_arg("LLVM_module_codegen_emit_obj", &module.name[..]);
|
.generic_activity_with_arg("LLVM_module_codegen_emit_obj", &*module.name);
|
||||||
|
|
||||||
let dwo_out = cgcx.output_filenames.temp_path_dwo(module_name);
|
let dwo_out = cgcx.output_filenames.temp_path_dwo(module_name);
|
||||||
let dwo_out = match cgcx.split_debuginfo {
|
let dwo_out = match cgcx.split_debuginfo {
|
||||||
|
@ -120,7 +120,7 @@ fn const_cstr(&self, s: Symbol, null_terminated: bool) -> &'ll Value {
|
|||||||
!null_terminated as Bool,
|
!null_terminated as Bool,
|
||||||
);
|
);
|
||||||
let sym = self.generate_local_symbol_name("str");
|
let sym = self.generate_local_symbol_name("str");
|
||||||
let g = self.define_global(&sym[..], self.val_ty(sc)).unwrap_or_else(|| {
|
let g = self.define_global(&sym, self.val_ty(sc)).unwrap_or_else(|| {
|
||||||
bug!("symbol `{}` is already defined", sym);
|
bug!("symbol `{}` is already defined", sym);
|
||||||
});
|
});
|
||||||
llvm::LLVMSetInitializer(g, sc);
|
llvm::LLVMSetInitializer(g, sc);
|
||||||
|
@ -225,7 +225,7 @@ impl CodegenCx<'ll, 'tcx> {
|
|||||||
let gv = match kind {
|
let gv = match kind {
|
||||||
Some(kind) if !self.tcx.sess.fewer_names() => {
|
Some(kind) if !self.tcx.sess.fewer_names() => {
|
||||||
let name = self.generate_local_symbol_name(kind);
|
let name = self.generate_local_symbol_name(kind);
|
||||||
let gv = self.define_global(&name[..], self.val_ty(cv)).unwrap_or_else(|| {
|
let gv = self.define_global(&name, self.val_ty(cv)).unwrap_or_else(|| {
|
||||||
bug!("symbol `{}` is already defined", name);
|
bug!("symbol `{}` is already defined", name);
|
||||||
});
|
});
|
||||||
llvm::LLVMRustSetLinkage(gv, llvm::Linkage::PrivateLinkage);
|
llvm::LLVMRustSetLinkage(gv, llvm::Linkage::PrivateLinkage);
|
||||||
|
@ -89,7 +89,7 @@ pub fn finalize<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let filenames_size = filenames_buffer.len();
|
let filenames_size = filenames_buffer.len();
|
||||||
let filenames_val = cx.const_bytes(&filenames_buffer[..]);
|
let filenames_val = cx.const_bytes(&filenames_buffer);
|
||||||
let filenames_ref = coverageinfo::hash_bytes(filenames_buffer);
|
let filenames_ref = coverageinfo::hash_bytes(filenames_buffer);
|
||||||
|
|
||||||
// Generate the LLVM IR representation of the coverage map and store it in a well-known global
|
// Generate the LLVM IR representation of the coverage map and store it in a well-known global
|
||||||
@ -238,7 +238,7 @@ fn save_function_record(
|
|||||||
) {
|
) {
|
||||||
// Concatenate the encoded coverage mappings
|
// Concatenate the encoded coverage mappings
|
||||||
let coverage_mapping_size = coverage_mapping_buffer.len();
|
let coverage_mapping_size = coverage_mapping_buffer.len();
|
||||||
let coverage_mapping_val = cx.const_bytes(&coverage_mapping_buffer[..]);
|
let coverage_mapping_val = cx.const_bytes(&coverage_mapping_buffer);
|
||||||
|
|
||||||
let func_name_hash = coverageinfo::hash_str(&mangled_function_name);
|
let func_name_hash = coverageinfo::hash_str(&mangled_function_name);
|
||||||
let func_name_hash_val = cx.const_u64(func_name_hash);
|
let func_name_hash_val = cx.const_u64(func_name_hash);
|
||||||
|
@ -456,7 +456,7 @@ fn vec_slice_metadata(
|
|||||||
let metadata = composite_type_metadata(
|
let metadata = composite_type_metadata(
|
||||||
cx,
|
cx,
|
||||||
slice_ptr_type,
|
slice_ptr_type,
|
||||||
&slice_type_name[..],
|
&slice_type_name,
|
||||||
unique_type_id,
|
unique_type_id,
|
||||||
member_descriptions,
|
member_descriptions,
|
||||||
NO_SCOPE_METADATA,
|
NO_SCOPE_METADATA,
|
||||||
@ -579,7 +579,7 @@ fn trait_pointer_metadata(
|
|||||||
composite_type_metadata(
|
composite_type_metadata(
|
||||||
cx,
|
cx,
|
||||||
trait_object_type.unwrap_or(trait_type),
|
trait_object_type.unwrap_or(trait_type),
|
||||||
&trait_type_name[..],
|
&trait_type_name,
|
||||||
unique_type_id,
|
unique_type_id,
|
||||||
member_descriptions,
|
member_descriptions,
|
||||||
containing_scope,
|
containing_scope,
|
||||||
@ -2398,7 +2398,7 @@ fn set_members_of_composite_type(
|
|||||||
|
|
||||||
let type_params = compute_type_parameters(cx, composite_type);
|
let type_params = compute_type_parameters(cx, composite_type);
|
||||||
unsafe {
|
unsafe {
|
||||||
let type_array = create_DIArray(DIB(cx), &member_metadata[..]);
|
let type_array = create_DIArray(DIB(cx), &member_metadata);
|
||||||
llvm::LLVMRustDICompositeTypeReplaceArrays(
|
llvm::LLVMRustDICompositeTypeReplaceArrays(
|
||||||
DIB(cx),
|
DIB(cx),
|
||||||
composite_type_metadata,
|
composite_type_metadata,
|
||||||
@ -2437,7 +2437,7 @@ fn compute_type_parameters(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>) -> &'ll DIAr
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
return create_DIArray(DIB(cx), &template_params[..]);
|
return create_DIArray(DIB(cx), &template_params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return create_DIArray(DIB(cx), &[]);
|
return create_DIArray(DIB(cx), &[]);
|
||||||
|
@ -474,7 +474,7 @@ fn get_template_parameters<'ll, 'tcx>(
|
|||||||
vec![]
|
vec![]
|
||||||
};
|
};
|
||||||
|
|
||||||
create_DIArray(DIB(cx), &template_params[..])
|
create_DIArray(DIB(cx), &template_params)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_parameter_names(cx: &CodegenCx<'_, '_>, generics: &ty::Generics) -> Vec<Symbol> {
|
fn get_parameter_names(cx: &CodegenCx<'_, '_>, generics: &ty::Generics) -> Vec<Symbol> {
|
||||||
|
@ -677,11 +677,11 @@ pub fn module_kind(&self) -> ModuleKind {
|
|||||||
fn start_profiling<'a>(&self, cgcx: &'a CodegenContext<B>) -> TimingGuard<'a> {
|
fn start_profiling<'a>(&self, cgcx: &'a CodegenContext<B>) -> TimingGuard<'a> {
|
||||||
match *self {
|
match *self {
|
||||||
WorkItem::Optimize(ref m) => {
|
WorkItem::Optimize(ref m) => {
|
||||||
cgcx.prof.generic_activity_with_arg("codegen_module_optimize", &m.name[..])
|
cgcx.prof.generic_activity_with_arg("codegen_module_optimize", &*m.name)
|
||||||
}
|
}
|
||||||
WorkItem::CopyPostLtoArtifacts(ref m) => cgcx
|
WorkItem::CopyPostLtoArtifacts(ref m) => cgcx
|
||||||
.prof
|
.prof
|
||||||
.generic_activity_with_arg("codegen_copy_artifacts_from_incr_cache", &m.name[..]),
|
.generic_activity_with_arg("codegen_copy_artifacts_from_incr_cache", &*m.name),
|
||||||
WorkItem::LTO(ref m) => {
|
WorkItem::LTO(ref m) => {
|
||||||
cgcx.prof.generic_activity_with_arg("codegen_module_perform_lto", m.name())
|
cgcx.prof.generic_activity_with_arg("codegen_module_perform_lto", m.name())
|
||||||
}
|
}
|
||||||
|
@ -122,8 +122,8 @@ pub fn langcall(tcx: TyCtxt<'_>, span: Option<Span>, msg: &str, li: LangItem) ->
|
|||||||
tcx.lang_items().require(li).unwrap_or_else(|s| {
|
tcx.lang_items().require(li).unwrap_or_else(|s| {
|
||||||
let msg = format!("{} {}", msg, s);
|
let msg = format!("{} {}", msg, s);
|
||||||
match span {
|
match span {
|
||||||
Some(span) => tcx.sess.span_fatal(span, &msg[..]),
|
Some(span) => tcx.sess.span_fatal(span, &msg),
|
||||||
None => tcx.sess.fatal(&msg[..]),
|
None => tcx.sess.fatal(&msg),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ pub(super) fn eval_terminator(
|
|||||||
self.eval_fn_call(
|
self.eval_fn_call(
|
||||||
fn_val,
|
fn_val,
|
||||||
abi,
|
abi,
|
||||||
&args[..],
|
&args,
|
||||||
ret,
|
ret,
|
||||||
match (cleanup, caller_can_unwind) {
|
match (cleanup, caller_can_unwind) {
|
||||||
(Some(cleanup), true) => StackPopUnwind::Cleanup(*cleanup),
|
(Some(cleanup), true) => StackPopUnwind::Cleanup(*cleanup),
|
||||||
|
@ -142,7 +142,7 @@ fn finish(hasher: stable_hasher::StableHasher) -> Self {
|
|||||||
impl<E: rustc_serialize::Encoder> Encodable<E> for Fingerprint {
|
impl<E: rustc_serialize::Encoder> Encodable<E> for Fingerprint {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn encode(&self, s: &mut E) -> Result<(), E::Error> {
|
fn encode(&self, s: &mut E) -> Result<(), E::Error> {
|
||||||
s.emit_raw_bytes(&self.to_le_bytes()[..])?;
|
s.emit_raw_bytes(&self.to_le_bytes())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ impl<D: rustc_serialize::Decoder> Decodable<D> for Fingerprint {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn decode(d: &mut D) -> Result<Self, D::Error> {
|
fn decode(d: &mut D) -> Result<Self, D::Error> {
|
||||||
let mut bytes = [0u8; 16];
|
let mut bytes = [0u8; 16];
|
||||||
d.read_raw_bytes_into(&mut bytes[..])?;
|
d.read_raw_bytes_into(&mut bytes)?;
|
||||||
Ok(Fingerprint::from_le_bytes(bytes))
|
Ok(Fingerprint::from_le_bytes(bytes))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -649,7 +649,7 @@ impl Drop for VerboseTimingGuard<'_> {
|
|||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some((start_time, start_rss, ref message)) = self.start_and_message {
|
if let Some((start_time, start_rss, ref message)) = self.start_and_message {
|
||||||
let end_rss = get_resident_set_size();
|
let end_rss = get_resident_set_size();
|
||||||
print_time_passes_entry(&message[..], start_time.elapsed(), start_rss, end_rss);
|
print_time_passes_entry(&message, start_time.elapsed(), start_rss, end_rss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ pub fn new_with_nul(s: &str) -> SmallCStr {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn as_c_str(&self) -> &ffi::CStr {
|
pub fn as_c_str(&self) -> &ffi::CStr {
|
||||||
unsafe { ffi::CStr::from_bytes_with_nul_unchecked(&self.data[..]) }
|
unsafe { ffi::CStr::from_bytes_with_nul_unchecked(&self.data) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -253,7 +253,7 @@ fn generic_extension<'cx>(
|
|||||||
for (i, lhs) in lhses.iter().enumerate() {
|
for (i, lhs) in lhses.iter().enumerate() {
|
||||||
// try each arm's matchers
|
// try each arm's matchers
|
||||||
let lhs_tt = match *lhs {
|
let lhs_tt = match *lhs {
|
||||||
mbe::TokenTree::Delimited(_, ref delim) => &delim.tts[..],
|
mbe::TokenTree::Delimited(_, ref delim) => &delim.tts,
|
||||||
_ => cx.span_bug(sp, "malformed macro lhs"),
|
_ => cx.span_bug(sp, "malformed macro lhs"),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ fn generic_extension<'cx>(
|
|||||||
for lhs in lhses {
|
for lhs in lhses {
|
||||||
// try each arm's matchers
|
// try each arm's matchers
|
||||||
let lhs_tt = match *lhs {
|
let lhs_tt = match *lhs {
|
||||||
mbe::TokenTree::Delimited(_, ref delim) => &delim.tts[..],
|
mbe::TokenTree::Delimited(_, ref delim) => &delim.tts,
|
||||||
_ => continue,
|
_ => continue,
|
||||||
};
|
};
|
||||||
if let Success(_) =
|
if let Success(_) =
|
||||||
@ -677,11 +677,11 @@ fn build_recur(sets: &mut FirstSets, tts: &[TokenTree]) -> TokenSet {
|
|||||||
first.replace_with(tt.clone());
|
first.replace_with(tt.clone());
|
||||||
}
|
}
|
||||||
TokenTree::Delimited(span, ref delimited) => {
|
TokenTree::Delimited(span, ref delimited) => {
|
||||||
build_recur(sets, &delimited.tts[..]);
|
build_recur(sets, &delimited.tts);
|
||||||
first.replace_with(delimited.open_tt(span));
|
first.replace_with(delimited.open_tt(span));
|
||||||
}
|
}
|
||||||
TokenTree::Sequence(sp, ref seq_rep) => {
|
TokenTree::Sequence(sp, ref seq_rep) => {
|
||||||
let subfirst = build_recur(sets, &seq_rep.tts[..]);
|
let subfirst = build_recur(sets, &seq_rep.tts);
|
||||||
|
|
||||||
match sets.first.entry(sp.entire()) {
|
match sets.first.entry(sp.entire()) {
|
||||||
Entry::Vacant(vac) => {
|
Entry::Vacant(vac) => {
|
||||||
@ -748,7 +748,7 @@ fn first(&self, tts: &[mbe::TokenTree]) -> TokenSet {
|
|||||||
let subfirst = match self.first.get(&sp.entire()) {
|
let subfirst = match self.first.get(&sp.entire()) {
|
||||||
Some(&Some(ref subfirst)) => subfirst,
|
Some(&Some(ref subfirst)) => subfirst,
|
||||||
Some(&None) => {
|
Some(&None) => {
|
||||||
subfirst_owned = self.first(&seq_rep.tts[..]);
|
subfirst_owned = self.first(&seq_rep.tts);
|
||||||
&subfirst_owned
|
&subfirst_owned
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
@ -175,12 +175,12 @@ pub(super) fn transcribe<'a>(
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
LockstepIterSize::Contradiction(ref msg) => {
|
LockstepIterSize::Contradiction(msg) => {
|
||||||
// FIXME: this really ought to be caught at macro definition time... It
|
// FIXME: this really ought to be caught at macro definition time... It
|
||||||
// happens when two meta-variables are used in the same repetition in a
|
// happens when two meta-variables are used in the same repetition in a
|
||||||
// sequence, but they come from different sequence matchers and repeat
|
// sequence, but they come from different sequence matchers and repeat
|
||||||
// different amounts.
|
// different amounts.
|
||||||
return Err(cx.struct_span_err(seq.span(), &msg[..]));
|
return Err(cx.struct_span_err(seq.span(), &msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
LockstepIterSize::Constraint(len, _) => {
|
LockstepIterSize::Constraint(len, _) => {
|
||||||
|
@ -659,7 +659,7 @@ pub fn render_opts<'a, N, E, G, W>(g: &'a G, w: &mut W, options: &[RenderOption]
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeln!(text, ";").unwrap();
|
writeln!(text, ";").unwrap();
|
||||||
w.write_all(&text[..])?;
|
w.write_all(&text)?;
|
||||||
|
|
||||||
text.clear();
|
text.clear();
|
||||||
}
|
}
|
||||||
@ -684,7 +684,7 @@ pub fn render_opts<'a, N, E, G, W>(g: &'a G, w: &mut W, options: &[RenderOption]
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeln!(text, ";").unwrap();
|
writeln!(text, ";").unwrap();
|
||||||
w.write_all(&text[..])?;
|
w.write_all(&text)?;
|
||||||
|
|
||||||
text.clear();
|
text.clear();
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ pub fn print_type(&mut self, ty: &hir::Ty<'_>) {
|
|||||||
}
|
}
|
||||||
hir::TyKind::Tup(ref elts) => {
|
hir::TyKind::Tup(ref elts) => {
|
||||||
self.popen();
|
self.popen();
|
||||||
self.commasep(Inconsistent, &elts[..], |s, ty| s.print_type(&ty));
|
self.commasep(Inconsistent, &elts, |s, ty| s.print_type(&ty));
|
||||||
if elts.len() == 1 {
|
if elts.len() == 1 {
|
||||||
self.word(",");
|
self.word(",");
|
||||||
}
|
}
|
||||||
@ -1860,7 +1860,7 @@ pub fn print_pat(&mut self, pat: &hir::Pat<'_>) {
|
|||||||
self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p));
|
self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p));
|
self.commasep(Inconsistent, &elts, |s, p| s.print_pat(&p));
|
||||||
}
|
}
|
||||||
self.pclose();
|
self.pclose();
|
||||||
}
|
}
|
||||||
@ -1873,7 +1873,7 @@ pub fn print_pat(&mut self, pat: &hir::Pat<'_>) {
|
|||||||
self.word_space("{");
|
self.word_space("{");
|
||||||
self.commasep_cmnt(
|
self.commasep_cmnt(
|
||||||
Consistent,
|
Consistent,
|
||||||
&fields[..],
|
&fields,
|
||||||
|s, f| {
|
|s, f| {
|
||||||
s.cbox(INDENT_UNIT);
|
s.cbox(INDENT_UNIT);
|
||||||
if !f.is_shorthand {
|
if !f.is_shorthand {
|
||||||
@ -1895,7 +1895,7 @@ pub fn print_pat(&mut self, pat: &hir::Pat<'_>) {
|
|||||||
self.word("}");
|
self.word("}");
|
||||||
}
|
}
|
||||||
PatKind::Or(ref pats) => {
|
PatKind::Or(ref pats) => {
|
||||||
self.strsep("|", true, Inconsistent, &pats[..], |s, p| s.print_pat(&p));
|
self.strsep("|", true, Inconsistent, &pats, |s, p| s.print_pat(&p));
|
||||||
}
|
}
|
||||||
PatKind::Tuple(ref elts, ddpos) => {
|
PatKind::Tuple(ref elts, ddpos) => {
|
||||||
self.popen();
|
self.popen();
|
||||||
@ -1956,7 +1956,7 @@ pub fn print_pat(&mut self, pat: &hir::Pat<'_>) {
|
|||||||
}
|
}
|
||||||
PatKind::Slice(ref before, ref slice, ref after) => {
|
PatKind::Slice(ref before, ref slice, ref after) => {
|
||||||
self.word("[");
|
self.word("[");
|
||||||
self.commasep(Inconsistent, &before[..], |s, p| s.print_pat(&p));
|
self.commasep(Inconsistent, &before, |s, p| s.print_pat(&p));
|
||||||
if let Some(ref p) = *slice {
|
if let Some(ref p) = *slice {
|
||||||
if !before.is_empty() {
|
if !before.is_empty() {
|
||||||
self.word_space(",");
|
self.word_space(",");
|
||||||
@ -1971,7 +1971,7 @@ pub fn print_pat(&mut self, pat: &hir::Pat<'_>) {
|
|||||||
self.word_space(",");
|
self.word_space(",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.commasep(Inconsistent, &after[..], |s, p| s.print_pat(&p));
|
self.commasep(Inconsistent, &after, |s, p| s.print_pat(&p));
|
||||||
self.word("]");
|
self.word("]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
|
|||||||
compilation session directory: {}",
|
compilation session directory: {}",
|
||||||
e
|
e
|
||||||
);
|
);
|
||||||
sess.fatal(&msg[..])
|
sess.fatal(&msg)
|
||||||
});
|
});
|
||||||
|
|
||||||
for swp in work_products {
|
for swp in work_products {
|
||||||
|
@ -207,7 +207,7 @@ fn check_panic_str<'tcx>(
|
|||||||
arg: &'tcx hir::Expr<'tcx>,
|
arg: &'tcx hir::Expr<'tcx>,
|
||||||
fmt: &str,
|
fmt: &str,
|
||||||
) {
|
) {
|
||||||
if !fmt.contains(&['{', '}'][..]) {
|
if !fmt.contains(&['{', '}']) {
|
||||||
// No brace, no problem.
|
// No brace, no problem.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) {
|
|||||||
if let Some(modifiers) = item.value_str() {
|
if let Some(modifiers) = item.value_str() {
|
||||||
let span = item.name_value_literal_span().unwrap();
|
let span = item.name_value_literal_span().unwrap();
|
||||||
for modifier in modifiers.as_str().split(',') {
|
for modifier in modifiers.as_str().split(',') {
|
||||||
let (modifier, value) = match modifier.strip_prefix(&['+', '-'][..]) {
|
let (modifier, value) = match modifier.strip_prefix(&['+', '-']) {
|
||||||
Some(m) => (m, modifier.starts_with('+')),
|
Some(m) => (m, modifier.starts_with('+')),
|
||||||
None => {
|
None => {
|
||||||
sess.span_err(
|
sess.span_err(
|
||||||
|
@ -2119,7 +2119,7 @@ pub fn new() -> EncodedMetadata {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn raw_data(&self) -> &[u8] {
|
pub fn raw_data(&self) -> &[u8] {
|
||||||
&self.raw_data[..]
|
&self.raw_data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,6 +530,6 @@ pub fn build_cgu_name_no_mangle<I, C, S>(
|
|||||||
write!(cgu_name, ".{}", special_suffix).unwrap();
|
write!(cgu_name, ".{}", special_suffix).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
Symbol::intern(&cgu_name[..])
|
Symbol::intern(&cgu_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ pub fn successors(&self) -> Successors<'_> {
|
|||||||
| InlineAsm { destination: Some(ref t), cleanup: Some(ref u), .. } => {
|
| InlineAsm { destination: Some(ref t), cleanup: Some(ref u), .. } => {
|
||||||
Some(t).into_iter().chain(slice::from_ref(u))
|
Some(t).into_iter().chain(slice::from_ref(u))
|
||||||
}
|
}
|
||||||
SwitchInt { ref targets, .. } => None.into_iter().chain(&targets.targets[..]),
|
SwitchInt { ref targets, .. } => None.into_iter().chain(&targets.targets),
|
||||||
FalseEdge { ref real_target, ref imaginary_target } => {
|
FalseEdge { ref real_target, ref imaginary_target } => {
|
||||||
Some(real_target).into_iter().chain(slice::from_ref(imaginary_target))
|
Some(real_target).into_iter().chain(slice::from_ref(imaginary_target))
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@ pub fn successors_mut(&mut self) -> SuccessorsMut<'_> {
|
|||||||
| InlineAsm { destination: Some(ref mut t), cleanup: Some(ref mut u), .. } => {
|
| InlineAsm { destination: Some(ref mut t), cleanup: Some(ref mut u), .. } => {
|
||||||
Some(t).into_iter().chain(slice::from_mut(u))
|
Some(t).into_iter().chain(slice::from_mut(u))
|
||||||
}
|
}
|
||||||
SwitchInt { ref mut targets, .. } => None.into_iter().chain(&mut targets.targets[..]),
|
SwitchInt { ref mut targets, .. } => None.into_iter().chain(&mut targets.targets),
|
||||||
FalseEdge { ref mut real_target, ref mut imaginary_target } => {
|
FalseEdge { ref mut real_target, ref mut imaginary_target } => {
|
||||||
Some(real_target).into_iter().chain(slice::from_mut(imaginary_target))
|
Some(real_target).into_iter().chain(slice::from_mut(imaginary_target))
|
||||||
}
|
}
|
||||||
|
@ -587,18 +587,18 @@ pub fn nested_obligations(self) -> Vec<N> {
|
|||||||
pub fn borrow_nested_obligations(&self) -> &[N] {
|
pub fn borrow_nested_obligations(&self) -> &[N] {
|
||||||
match &self {
|
match &self {
|
||||||
ImplSource::UserDefined(i) => &i.nested[..],
|
ImplSource::UserDefined(i) => &i.nested[..],
|
||||||
ImplSource::Param(n, _) => &n[..],
|
ImplSource::Param(n, _) => &n,
|
||||||
ImplSource::Builtin(i) => &i.nested[..],
|
ImplSource::Builtin(i) => &i.nested,
|
||||||
ImplSource::AutoImpl(d) => &d.nested[..],
|
ImplSource::AutoImpl(d) => &d.nested,
|
||||||
ImplSource::Closure(c) => &c.nested[..],
|
ImplSource::Closure(c) => &c.nested,
|
||||||
ImplSource::Generator(c) => &c.nested[..],
|
ImplSource::Generator(c) => &c.nested,
|
||||||
ImplSource::Object(d) => &d.nested[..],
|
ImplSource::Object(d) => &d.nested,
|
||||||
ImplSource::FnPointer(d) => &d.nested[..],
|
ImplSource::FnPointer(d) => &d.nested,
|
||||||
ImplSource::DiscriminantKind(ImplSourceDiscriminantKindData)
|
ImplSource::DiscriminantKind(ImplSourceDiscriminantKindData)
|
||||||
| ImplSource::Pointee(ImplSourcePointeeData)
|
| ImplSource::Pointee(ImplSourcePointeeData)
|
||||||
| ImplSource::ConstDrop(ImplSourceConstDropData) => &[],
|
| ImplSource::ConstDrop(ImplSourceConstDropData) => &[],
|
||||||
ImplSource::TraitAlias(d) => &d.nested[..],
|
ImplSource::TraitAlias(d) => &d.nested,
|
||||||
ImplSource::TraitUpcasting(d) => &d.nested[..],
|
ImplSource::TraitUpcasting(d) => &d.nested,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ fn tokens_to_string(tokens: &[TokenType]) -> String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let expect = tokens_to_string(&expected[..]);
|
let expect = tokens_to_string(&expected);
|
||||||
let actual = super::token_descr(&self.token);
|
let actual = super::token_descr(&self.token);
|
||||||
let (msg_exp, (label_sp, label_exp)) = if expected.len() > 1 {
|
let (msg_exp, (label_sp, label_exp)) = if expected.len() > 1 {
|
||||||
let short_expect = if expected.len() > 6 {
|
let short_expect = if expected.len() > 6 {
|
||||||
@ -909,7 +909,7 @@ pub(super) fn check_no_chained_comparison(
|
|||||||
// So far we have parsed `foo<bar<`, consume the rest of the type args.
|
// So far we have parsed `foo<bar<`, consume the rest of the type args.
|
||||||
let modifiers =
|
let modifiers =
|
||||||
[(token::Lt, 1), (token::Gt, -1), (token::BinOp(token::Shr), -2)];
|
[(token::Lt, 1), (token::Gt, -1), (token::BinOp(token::Shr), -2)];
|
||||||
self.consume_tts(1, &modifiers[..]);
|
self.consume_tts(1, &modifiers);
|
||||||
|
|
||||||
if !&[token::OpenDelim(token::Paren), token::ModSep]
|
if !&[token::OpenDelim(token::Paren), token::ModSep]
|
||||||
.contains(&self.token.kind)
|
.contains(&self.token.kind)
|
||||||
@ -1001,7 +1001,7 @@ fn consume_fn_args(&mut self) -> Result<(), ()> {
|
|||||||
// Consume the fn call arguments.
|
// Consume the fn call arguments.
|
||||||
let modifiers =
|
let modifiers =
|
||||||
[(token::OpenDelim(token::Paren), 1), (token::CloseDelim(token::Paren), -1)];
|
[(token::OpenDelim(token::Paren), 1), (token::CloseDelim(token::Paren), -1)];
|
||||||
self.consume_tts(1, &modifiers[..]);
|
self.consume_tts(1, &modifiers);
|
||||||
|
|
||||||
if self.token.kind == token::Eof {
|
if self.token.kind == token::Eof {
|
||||||
// Not entirely sure that what we consumed were fn arguments, rollback.
|
// Not entirely sure that what we consumed were fn arguments, rollback.
|
||||||
|
@ -158,7 +158,7 @@ fn new(sess: &'sess Session, data: Mmap, start_pos: usize) -> Self {
|
|||||||
|
|
||||||
// Wrap in a scope so we can borrow `data`.
|
// Wrap in a scope so we can borrow `data`.
|
||||||
let footer: Footer = {
|
let footer: Footer = {
|
||||||
let mut decoder = opaque::Decoder::new(&data[..], start_pos);
|
let mut decoder = opaque::Decoder::new(&data, start_pos);
|
||||||
|
|
||||||
// Decode the *position* of the footer, which can be found in the
|
// Decode the *position* of the footer, which can be found in the
|
||||||
// last 8 bytes of the file.
|
// last 8 bytes of the file.
|
||||||
|
@ -1735,7 +1735,7 @@ fn parse_native_lib_modifiers(
|
|||||||
) -> (NativeLibKind, Option<bool>) {
|
) -> (NativeLibKind, Option<bool>) {
|
||||||
let mut verbatim = None;
|
let mut verbatim = None;
|
||||||
for modifier in modifiers.split(',') {
|
for modifier in modifiers.split(',') {
|
||||||
let (modifier, value) = match modifier.strip_prefix(&['+', '-'][..]) {
|
let (modifier, value) = match modifier.strip_prefix(&['+', '-']) {
|
||||||
Some(m) => (m, modifier.starts_with('+')),
|
Some(m) => (m, modifier.starts_with('+')),
|
||||||
None => early_error(
|
None => early_error(
|
||||||
error_format,
|
error_format,
|
||||||
@ -2027,7 +2027,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
|
|||||||
|
|
||||||
let unparsed_crate_types = matches.opt_strs("crate-type");
|
let unparsed_crate_types = matches.opt_strs("crate-type");
|
||||||
let crate_types = parse_crate_types_from_list(unparsed_crate_types)
|
let crate_types = parse_crate_types_from_list(unparsed_crate_types)
|
||||||
.unwrap_or_else(|e| early_error(error_format, &e[..]));
|
.unwrap_or_else(|e| early_error(error_format, &e));
|
||||||
|
|
||||||
let mut debugging_opts = DebuggingOptions::build(matches, error_format);
|
let mut debugging_opts = DebuggingOptions::build(matches, error_format);
|
||||||
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
|
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
|
||||||
@ -2151,7 +2151,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
|
|||||||
|
|
||||||
let mut search_paths = vec![];
|
let mut search_paths = vec![];
|
||||||
for s in &matches.opt_strs("L") {
|
for s in &matches.opt_strs("L") {
|
||||||
search_paths.push(SearchPath::from_cli_opt(&s[..], error_format));
|
search_paths.push(SearchPath::from_cli_opt(&s, error_format));
|
||||||
}
|
}
|
||||||
|
|
||||||
let libs = parse_libs(matches, error_format);
|
let libs = parse_libs(matches, error_format);
|
||||||
|
@ -1383,7 +1383,7 @@ fn encode(&self, s: &mut S) -> Result<(), S::Error> {
|
|||||||
// Encode the first element.
|
// Encode the first element.
|
||||||
lines[0].encode(s)?;
|
lines[0].encode(s)?;
|
||||||
|
|
||||||
let diff_iter = lines[..].array_windows().map(|&[fst, snd]| snd - fst);
|
let diff_iter = lines.array_windows().map(|&[fst, snd]| snd - fst);
|
||||||
|
|
||||||
match bytes_per_diff {
|
match bytes_per_diff {
|
||||||
1 => {
|
1 => {
|
||||||
@ -1506,7 +1506,7 @@ pub fn new(
|
|||||||
assert!(end_pos <= u32::MAX as usize);
|
assert!(end_pos <= u32::MAX as usize);
|
||||||
|
|
||||||
let (lines, multibyte_chars, non_narrow_chars) =
|
let (lines, multibyte_chars, non_narrow_chars) =
|
||||||
analyze_source_file::analyze_source_file(&src[..], start_pos);
|
analyze_source_file::analyze_source_file(&src, start_pos);
|
||||||
|
|
||||||
SourceFile {
|
SourceFile {
|
||||||
name,
|
name,
|
||||||
|
@ -231,7 +231,7 @@ fn on_unimplemented_note(
|
|||||||
if let Ok(Some(command)) =
|
if let Ok(Some(command)) =
|
||||||
OnUnimplementedDirective::of_item(self.tcx, trait_ref.def_id, def_id)
|
OnUnimplementedDirective::of_item(self.tcx, trait_ref.def_id, def_id)
|
||||||
{
|
{
|
||||||
command.evaluate(self.tcx, trait_ref, &flags[..])
|
command.evaluate(self.tcx, trait_ref, &flags)
|
||||||
} else {
|
} else {
|
||||||
OnUnimplementedNote::default()
|
OnUnimplementedNote::default()
|
||||||
}
|
}
|
||||||
|
@ -804,7 +804,7 @@ fn suggest_add_reference_to_arg(
|
|||||||
} else if let ObligationCauseCode::BindingObligation(_, _)
|
} else if let ObligationCauseCode::BindingObligation(_, _)
|
||||||
| ObligationCauseCode::ItemObligation(_) = &*code
|
| ObligationCauseCode::ItemObligation(_) = &*code
|
||||||
{
|
{
|
||||||
try_borrowing(*poly_trait_ref, &never_suggest_borrow[..])
|
try_borrowing(*poly_trait_ref, &never_suggest_borrow)
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
@ -1132,7 +1132,7 @@ fn suggest_impl_trait(
|
|||||||
<https://doc.rust-lang.org/book/ch17-02-trait-objects.html\
|
<https://doc.rust-lang.org/book/ch17-02-trait-objects.html\
|
||||||
#using-trait-objects-that-allow-for-values-of-different-types>";
|
#using-trait-objects-that-allow-for-values-of-different-types>";
|
||||||
let has_dyn = snippet.split_whitespace().next().map_or(false, |s| s == "dyn");
|
let has_dyn = snippet.split_whitespace().next().map_or(false, |s| s == "dyn");
|
||||||
let trait_obj = if has_dyn { &snippet[4..] } else { &snippet[..] };
|
let trait_obj = if has_dyn { &snippet[4..] } else { &snippet };
|
||||||
if only_never_return {
|
if only_never_return {
|
||||||
// No return paths, probably using `panic!()` or similar.
|
// No return paths, probably using `panic!()` or similar.
|
||||||
// Suggest `-> T`, `-> impl Trait`, and if `Trait` is object safe, `-> Box<dyn Trait>`.
|
// Suggest `-> T`, `-> impl Trait`, and if `Trait` is object safe, `-> Box<dyn Trait>`.
|
||||||
|
@ -1350,7 +1350,7 @@ trait here instead: `trait NewTrait: {} {{}}`",
|
|||||||
tcx,
|
tcx,
|
||||||
span,
|
span,
|
||||||
item.trait_ref().def_id(),
|
item.trait_ref().def_id(),
|
||||||
&object_safety_violations[..],
|
&object_safety_violations,
|
||||||
)
|
)
|
||||||
.emit();
|
.emit();
|
||||||
return tcx.ty_error();
|
return tcx.ty_error();
|
||||||
|
@ -496,7 +496,7 @@ fn confirm_builtin_call(
|
|||||||
call_expr.span,
|
call_expr.span,
|
||||||
call_expr,
|
call_expr,
|
||||||
fn_sig.inputs(),
|
fn_sig.inputs(),
|
||||||
&expected_arg_tys[..],
|
&expected_arg_tys,
|
||||||
arg_exprs,
|
arg_exprs,
|
||||||
fn_sig.c_variadic,
|
fn_sig.c_variadic,
|
||||||
TupleArgumentsFlag::DontTupleArguments,
|
TupleArgumentsFlag::DontTupleArguments,
|
||||||
|
@ -1436,7 +1436,7 @@ fn inferred_kind(
|
|||||||
<dyn AstConv<'_>>::create_substs_for_generic_args(
|
<dyn AstConv<'_>>::create_substs_for_generic_args(
|
||||||
tcx,
|
tcx,
|
||||||
def_id,
|
def_id,
|
||||||
&[][..],
|
&[],
|
||||||
has_self,
|
has_self,
|
||||||
self_ty,
|
self_ty,
|
||||||
&arg_count,
|
&arg_count,
|
||||||
|
@ -54,13 +54,13 @@ pub(in super::super) fn check_method_argument_types(
|
|||||||
|
|
||||||
let err_inputs = match tuple_arguments {
|
let err_inputs = match tuple_arguments {
|
||||||
DontTupleArguments => err_inputs,
|
DontTupleArguments => err_inputs,
|
||||||
TupleArguments => vec![self.tcx.intern_tup(&err_inputs[..])],
|
TupleArguments => vec![self.tcx.intern_tup(&err_inputs)],
|
||||||
};
|
};
|
||||||
|
|
||||||
self.check_argument_types(
|
self.check_argument_types(
|
||||||
sp,
|
sp,
|
||||||
expr,
|
expr,
|
||||||
&err_inputs[..],
|
&err_inputs,
|
||||||
&[],
|
&[],
|
||||||
args_no_rcvr,
|
args_no_rcvr,
|
||||||
false,
|
false,
|
||||||
@ -324,7 +324,7 @@ pub(in super::super) fn check_argument_types(
|
|||||||
self.point_at_type_arg_instead_of_call_if_possible(errors, expr);
|
self.point_at_type_arg_instead_of_call_if_possible(errors, expr);
|
||||||
self.point_at_arg_instead_of_call_if_possible(
|
self.point_at_arg_instead_of_call_if_possible(
|
||||||
errors,
|
errors,
|
||||||
&final_arg_types[..],
|
&final_arg_types,
|
||||||
expr,
|
expr,
|
||||||
sp,
|
sp,
|
||||||
&args,
|
&args,
|
||||||
|
@ -1372,7 +1372,7 @@ fn consider_candidates<'b, ProbesIter>(
|
|||||||
|
|
||||||
if applicable_candidates.len() > 1 {
|
if applicable_candidates.len() > 1 {
|
||||||
if let Some(pick) =
|
if let Some(pick) =
|
||||||
self.collapse_candidates_to_trait_pick(self_ty, &applicable_candidates[..])
|
self.collapse_candidates_to_trait_pick(self_ty, &applicable_candidates)
|
||||||
{
|
{
|
||||||
return Some(Ok(pick));
|
return Some(Ok(pick));
|
||||||
}
|
}
|
||||||
|
@ -1344,7 +1344,7 @@ fn suggest_use_candidates(
|
|||||||
if candidates.len() > limit {
|
if candidates.len() > limit {
|
||||||
msg.push_str(&format!("\nand {} others", candidates.len() - limit));
|
msg.push_str(&format!("\nand {} others", candidates.len() - limit));
|
||||||
}
|
}
|
||||||
err.note(&msg[..]);
|
err.note(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2998,9 +2998,9 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
|
|||||||
)
|
)
|
||||||
.emit();
|
.emit();
|
||||||
InlineAttr::None
|
InlineAttr::None
|
||||||
} else if list_contains_name(&items[..], sym::always) {
|
} else if list_contains_name(&items, sym::always) {
|
||||||
InlineAttr::Always
|
InlineAttr::Always
|
||||||
} else if list_contains_name(&items[..], sym::never) {
|
} else if list_contains_name(&items, sym::never) {
|
||||||
InlineAttr::Never
|
InlineAttr::Never
|
||||||
} else {
|
} else {
|
||||||
struct_span_err!(
|
struct_span_err!(
|
||||||
@ -3034,9 +3034,9 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
|
|||||||
if items.len() != 1 {
|
if items.len() != 1 {
|
||||||
err(attr.span, "expected one argument");
|
err(attr.span, "expected one argument");
|
||||||
OptimizeAttr::None
|
OptimizeAttr::None
|
||||||
} else if list_contains_name(&items[..], sym::size) {
|
} else if list_contains_name(&items, sym::size) {
|
||||||
OptimizeAttr::Size
|
OptimizeAttr::Size
|
||||||
} else if list_contains_name(&items[..], sym::speed) {
|
} else if list_contains_name(&items, sym::speed) {
|
||||||
OptimizeAttr::Speed
|
OptimizeAttr::Speed
|
||||||
} else {
|
} else {
|
||||||
err(items[0].span(), "invalid argument");
|
err(items[0].span(), "invalid argument");
|
||||||
|
Loading…
Reference in New Issue
Block a user