Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #91760

Merged
merged 23 commits into from
Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5907a8c
Fix incorrect feature flags
jhpratt Nov 14, 2021
64cca29
Fix method name reference in stream documentation
jplatte Nov 21, 2021
15a4ed6
adjust const_eval_select documentation
RalfJung Nov 28, 2021
85558ad
adjust some const_eval_select safety comments
RalfJung Nov 28, 2021
80a308d
Use `HashMap::from()` instead of using `HashMap::new()` with `HashMap…
JosephTLyons Dec 2, 2021
440cffd
Use `BTreeMap::from()` instead of using `BTreeMap::new()` with `BTree…
JosephTLyons Dec 2, 2021
72a6974
Make `HashMap`s mutable again
JosephTLyons Dec 3, 2021
d5f6b9c
code-cov: generate dead functions with private/default linkage
wesleywiser Dec 2, 2021
8bfc76d
Fix Vec::extend_from_slice docs
rukai Dec 4, 2021
41f7692
Document all public items in `rustc_incremental`
pierwill Oct 29, 2021
d9e4502
fix documentation for `core::ready::Ready`
ibraheemdev Dec 8, 2021
15de4cb
Remove redundant [..]s
est31 Dec 3, 2021
99bd24e
Fix span calculation on secondary_label as well
compiler-errors Dec 5, 2021
71c1d56
Rollup merge of #90407 - pierwill:edit-rustc-incremental-docs, r=cjgi…
matthiaskrgr Dec 10, 2021
616f9ef
Rollup merge of #90897 - jhpratt:fix-incorrect-feature-flags, r=dtolnay
matthiaskrgr Dec 10, 2021
60aa03a
Rollup merge of #91105 - jplatte:stream-docs, r=dtolnay
matthiaskrgr Dec 10, 2021
d317da4
Rollup merge of #91325 - RalfJung:const_eval_select, r=dtolnay
matthiaskrgr Dec 10, 2021
b7b4d77
Rollup merge of #91470 - wesleywiser:code_coverage_link_error, r=tmandry
matthiaskrgr Dec 10, 2021
5510803
Rollup merge of #91482 - JosephTLyons:update-HashMap-and-BTreeMap-doc…
matthiaskrgr Dec 10, 2021
ca352c4
Rollup merge of #91524 - rukai:fix_extend_from_slice_docs, r=dtolnay
matthiaskrgr Dec 10, 2021
6cfe9af
Rollup merge of #91575 - compiler-errors:issue-91556, r=cjgillot
matthiaskrgr Dec 10, 2021
4098859
Rollup merge of #91625 - est31:remove_indexes, r=oli-obk
matthiaskrgr Dec 10, 2021
1fca934
Rollup merge of #91646 - ibraheemdev:patch-9, r=dtolnay
matthiaskrgr Dec 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/util/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl LitKind {
// string in the token.
let s = symbol.as_str();
let symbol =
if s.contains(&['\\', '\r'][..]) {
if s.contains(&['\\', '\r']) {
let mut buf = String::with_capacity(s.len());
let mut error = Ok(());
unescape_literal(&s, Mode::Str, &mut |_, unescaped_char| {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {

if let Some(modifiers) = nested_meta.value_str() {
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)*) => {
$(if modifier == $name {
let msg = concat!("`#[link(modifiers=\"", $name, "\")]` is unstable");
Expand Down Expand Up @@ -383,7 +383,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}

ast::ItemKind::Fn(..) => {
if self.sess.contains_name(&i.attrs[..], sym::start) {
if self.sess.contains_name(&i.attrs, sym::start) {
gate_feature_post!(
&self,
start,
Expand All @@ -396,7 +396,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}

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) {
if item.has_name(sym::simd) {
gate_feature_post!(
Expand Down
28 changes: 14 additions & 14 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
ast::MetaItemKind::List(ref items) => {
self.print_path(&item.path, false, 0);
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();
}
}
Expand Down Expand Up @@ -997,7 +997,7 @@ impl<'a> State<'a> {
}
ast::TyKind::Tup(ref elts) => {
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 {
self.word(",");
}
Expand All @@ -1017,10 +1017,10 @@ impl<'a> State<'a> {
ast::TyKind::Path(Some(ref qself), ref path) => self.print_qpath(path, qself, false),
ast::TyKind::TraitObject(ref bounds, syntax) => {
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) => {
self.print_type_bounds("impl", &bounds[..]);
self.print_type_bounds("impl", &bounds);
}
ast::TyKind::Array(ref ty, ref length) => {
self.word("[");
Expand Down Expand Up @@ -1339,7 +1339,7 @@ impl<'a> State<'a> {
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.word(" ");
self.bopen();
Expand Down Expand Up @@ -1368,7 +1368,7 @@ impl<'a> State<'a> {
}
}
self.nbsp();
self.print_type_bounds("=", &real_bounds[..]);
self.print_type_bounds("=", &real_bounds);
self.print_where_clause(&generics.where_clause);
self.word(";");
}
Expand Down Expand Up @@ -1960,10 +1960,10 @@ impl<'a> State<'a> {
self.print_expr_tup(exprs);
}
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, _) => {
self.print_expr_method_call(segment, &args[..]);
self.print_expr_method_call(segment, &args);
}
ast::ExprKind::Binary(op, ref lhs, ref rhs) => {
self.print_expr_binary(op, lhs, rhs);
Expand Down Expand Up @@ -2440,11 +2440,11 @@ impl<'a> State<'a> {
self.print_path(path, true, 0);
}
self.popen();
self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(p));
self.commasep(Inconsistent, &elts, |s, p| s.print_pat(p));
self.pclose();
}
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) => {
self.print_path(path, true, 0);
Expand All @@ -2462,7 +2462,7 @@ impl<'a> State<'a> {
self.word_space("{");
self.commasep_cmnt(
Consistent,
&fields[..],
&fields,
|s, f| {
s.cbox(INDENT_UNIT);
if !f.is_shorthand {
Expand All @@ -2485,7 +2485,7 @@ impl<'a> State<'a> {
}
PatKind::Tuple(ref elts) => {
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 {
self.word(",");
}
Expand Down Expand Up @@ -2527,7 +2527,7 @@ impl<'a> State<'a> {
}
PatKind::Slice(ref elts) => {
self.word("[");
self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(p));
self.commasep(Inconsistent, &elts, |s, p| s.print_pat(p));
self.word("]");
}
PatKind::Rest => self.word(".."),
Expand Down Expand Up @@ -2836,7 +2836,7 @@ impl<'a> State<'a> {
self.print_path(&tree.prefix, false, 0);
self.word("::{");
}
self.commasep(Inconsistent, &items[..], |this, &(ref tree, _)| {
self.commasep(Inconsistent, &items, |this, &(ref tree, _)| {
this.print_use_tree(tree)
});
self.word("}");
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
Some(&idx) => Some(idx),
None => {
let msg = format!("there is no argument named `{}`", name);
ecx.struct_span_err(span, &msg[..]).emit();
ecx.struct_span_err(span, &msg).emit();
None
}
},
Expand Down
20 changes: 10 additions & 10 deletions compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,17 +766,17 @@ impl<'a> TraitDef<'a> {
self,
struct_def,
type_ident,
&self_args[..],
&nonself_args[..],
&self_args,
&nonself_args,
)
} else {
method_def.expand_struct_method_body(
cx,
self,
struct_def,
type_ident,
&self_args[..],
&nonself_args[..],
&self_args,
&nonself_args,
use_temporaries,
)
};
Expand Down Expand Up @@ -815,8 +815,8 @@ impl<'a> TraitDef<'a> {
self,
enum_def,
type_ident,
&self_args[..],
&nonself_args[..],
&self_args,
&nonself_args,
)
} else {
method_def.expand_enum_method_body(
Expand All @@ -825,7 +825,7 @@ impl<'a> TraitDef<'a> {
enum_def,
type_ident,
self_args,
&nonself_args[..],
&nonself_args,
)
};

Expand Down Expand Up @@ -1217,7 +1217,7 @@ impl<'a> MethodDef<'a> {
let vi_idents = self_arg_names
.iter()
.map(|name| {
let vi_suffix = format!("{}_vi", &name[..]);
let vi_suffix = format!("{}_vi", name);
Ident::from_str_and_span(&vi_suffix, span)
})
.collect::<Vec<Ident>>();
Expand All @@ -1226,7 +1226,7 @@ impl<'a> MethodDef<'a> {
// delegated expression that handles the catch-all case,
// using `__variants_tuple` to drive logic if necessary.
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());

Expand Down Expand Up @@ -1261,7 +1261,7 @@ impl<'a> MethodDef<'a> {
idents
};
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);
self_pats_idents.push(idents);
}
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_builtin_macros/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ impl<'a, 'b> Context<'a, 'b> {
} else {
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!(
"did you intend to capture a variable `{}` from \
Expand Down Expand Up @@ -995,8 +995,9 @@ pub fn expand_preparsed_format_args(
e.note(&note);
}
if let Some((label, span)) = err.secondary_label {
let sp = fmt_span.from_inner(span);
e.span_label(sp, label);
if efmt_kind_is_lit {
e.span_label(fmt_span.from_inner(span), label);
}
}
e.emit();
return DummyResult::raw_expr(sp, true);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_gcc/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext<GccCodegenBackend>, _diag_han
if config.emit_asm {
let _timer = 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);
context.compile_to_file(OutputKind::Assembler, path.to_str().expect("path to str"));
}
Expand All @@ -41,7 +41,7 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext<GccCodegenBackend>, _diag_han
EmitObj::ObjectCode(_) => {
let _timer = cgcx
.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 {
"std_example.7rcbfp3g-cgu.15" => {
println!("Dumping reproducer {}", module.name);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ pub(crate) fn inline_asm_call(
.collect::<Vec<_>>();

debug!("Asm Output Type: {:?}", output);
let fty = bx.cx.type_func(&argtys[..], output);
let fty = bx.cx.type_func(&argtys, output);
unsafe {
// Ask LLVM to verify that the constraints are well-formed.
let constraints_ok = llvm::LLVMRustInlineAsmVerify(fty, cons.as_ptr().cast(), cons.len());
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ pub(crate) fn run_pass_manager(
config: &ModuleConfig,
thin: bool,
) -> 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
// LTO-specific optimization passes that LLVM provides.
Expand Down
36 changes: 16 additions & 20 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ pub(crate) unsafe fn optimize(
module: &ModuleCodegen<ModuleLlvm>,
config: &ModuleConfig,
) -> 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 llcx = &*module.module_llvm.llcx;
Expand Down Expand Up @@ -663,14 +663,14 @@ pub(crate) unsafe fn optimize(
{
let _timer = cgcx.prof.extra_verbose_generic_activity(
"LLVM_module_optimize_function_passes",
&module.name[..],
&*module.name,
);
llvm::LLVMRustRunFunctionPassManager(fpm, llmod);
}
{
let _timer = cgcx.prof.extra_verbose_generic_activity(
"LLVM_module_optimize_module_passes",
&module.name[..],
&*module.name,
);
llvm::LLVMRunPassManager(mpm, llmod);
}
Expand Down Expand Up @@ -733,7 +733,7 @@ pub(crate) unsafe fn codegen(
module: ModuleCodegen<ModuleLlvm>,
config: &ModuleConfig,
) -> 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 llcx = &*module.module_llvm.llcx;
Expand Down Expand Up @@ -782,7 +782,7 @@ pub(crate) unsafe fn codegen(
if config.bitcode_needed() {
let _timer = cgcx
.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 data = thin.data();

Expand All @@ -795,29 +795,26 @@ pub(crate) unsafe fn codegen(
}

if config.emit_bc || config.emit_obj == EmitObj::Bitcode {
let _timer = cgcx.prof.generic_activity_with_arg(
"LLVM_module_codegen_emit_bitcode",
&module.name[..],
);
let _timer = cgcx
.prof
.generic_activity_with_arg("LLVM_module_codegen_emit_bitcode", &*module.name);
if let Err(e) = fs::write(&bc_out, data) {
let msg = format!("failed to write bytecode to {}: {}", bc_out.display(), e);
diag_handler.err(&msg);
}
}

if config.emit_obj == EmitObj::ObjectCode(BitcodeSection::Full) {
let _timer = cgcx.prof.generic_activity_with_arg(
"LLVM_module_codegen_embed_bitcode",
&module.name[..],
);
let _timer = cgcx
.prof
.generic_activity_with_arg("LLVM_module_codegen_embed_bitcode", &*module.name);
embed_bitcode(cgcx, llcx, llmod, &config.bc_cmdline, data);
}
}

if config.emit_ir {
let _timer = cgcx
.prof
.generic_activity_with_arg("LLVM_module_codegen_emit_ir", &module.name[..]);
let _timer =
cgcx.prof.generic_activity_with_arg("LLVM_module_codegen_emit_ir", &*module.name);
let out = cgcx.output_filenames.temp_path(OutputType::LlvmAssembly, module_name);
let out_c = path_to_c_string(&out);

Expand Down Expand Up @@ -866,9 +863,8 @@ pub(crate) unsafe fn codegen(
}

if config.emit_asm {
let _timer = cgcx
.prof
.generic_activity_with_arg("LLVM_module_codegen_emit_asm", &module.name[..]);
let _timer =
cgcx.prof.generic_activity_with_arg("LLVM_module_codegen_emit_asm", &*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,
Expand Down Expand Up @@ -898,7 +894,7 @@ pub(crate) unsafe fn codegen(
EmitObj::ObjectCode(_) => {
let _timer = cgcx
.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 = match cgcx.split_debuginfo {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl CodegenCx<'ll, 'tcx> {
!null_terminated as Bool,
);
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);
});
llvm::LLVMSetInitializer(g, sc);
Expand Down
Loading