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 #73830

Merged
merged 38 commits into from
Jun 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
93cbad6
Add documentation to point to `!is_dir` instead of `is_file`
poliorcetics Jun 11, 2020
ec63f9d
Added the note to Metadata too
poliorcetics Jun 11, 2020
c1243db
Make a note about is_dir vs is_file in Path too
poliorcetics Jun 11, 2020
810f309
MIR sanity check: validate types on assignment
RalfJung May 30, 2020
50d7dea
prepare visit_statement for checking more kinds of statements
RalfJung May 31, 2020
93e3552
also normalize constants when comparing types
RalfJung May 31, 2020
9576e30
also normalize_erasing_regions
RalfJung Jun 1, 2020
8200771
reveal_all when sanity-checking MIR assignment types
RalfJung Jun 6, 2020
978470f
no need to normalize mutability any more
RalfJung Jun 21, 2020
91f73fb
use a TypeRelation to compare the types
RalfJung Jun 21, 2020
7754322
fix typo
RalfJung Jun 22, 2020
7f8fe6a
also use relator in interpreter assignment sanity check
RalfJung Jun 22, 2020
5e5ae8b
expand a comment
RalfJung Jun 22, 2020
a593728
make layout check a mere sanity check
RalfJung Jun 22, 2020
35911ee
reduce sanity check in debug mode
RalfJung Jun 24, 2020
5e28eb5
Adds a clearer message for when the async keyword is missing from a f…
nellshamrell Jun 18, 2020
49f6166
Prepare for LLVM 11
cuviper Jun 26, 2020
a6417b9
improper_ctypes: fix remaining `Reveal:All`
davidtwco Jun 26, 2020
3678e5c
errors: use `-Z terminal-width` in JSON emitter
davidtwco Jun 26, 2020
36ac08e
Make `fn_arg_names` return `Ident` instead of symbol
Aaron1011 Jun 11, 2020
fa6a61c
Explain move errors that occur due to method calls involving `self`
Aaron1011 Jun 11, 2020
a4e7b47
use LocalDefId in module checking
lcnr Jun 27, 2020
1875c79
more LocalDefId in ty::context
lcnr Jun 27, 2020
2d280a5
more LocalDefId cleanup
lcnr Jun 27, 2020
9308860
fix typo in self-profile.md
atetubou Jun 27, 2020
d25d6c5
Update the documentation to point to open instead of is_file and is_dir
poliorcetics Jun 27, 2020
0e0584f
Add links to fs::DirEntry::metadata
robyoung Jun 27, 2020
8e8c54a
Added the parapgrah to path::Path::is_file too
poliorcetics Jun 27, 2020
385d85c
Rollup merge of #72796 - RalfJung:mir-assign-sanity, r=matthewjasper
Manishearth Jun 28, 2020
6a944c1
Rollup merge of #73243 - poliorcetics:discourage-is-file, r=Amanieu
Manishearth Jun 28, 2020
45ec25e
Rollup merge of #73525 - cuviper:llvm11, r=nikic
Manishearth Jun 28, 2020
d227a82
Rollup merge of #73672 - nellshamrell:async-fix, r=estebank
Manishearth Jun 28, 2020
b236e49
Rollup merge of #73708 - Aaron1011:feature/reland-move-fn-self-msg, r…
Manishearth Jun 28, 2020
d5205f2
Rollup merge of #73758 - davidtwco:issue-60855-remaining-reveal-all, …
Manishearth Jun 28, 2020
596af5a
Rollup merge of #73763 - davidtwco:terminal-width-json-emitter, r=est…
Manishearth Jun 28, 2020
800d2e3
Rollup merge of #73796 - lcnr:LocalDefId, r=matthewjasper
Manishearth Jun 28, 2020
dc843a8
Rollup merge of #73797 - atetubou:patch-1, r=jonas-schievink
Manishearth Jun 28, 2020
cdb59d9
Rollup merge of #73809 - robyoung:docs/add-links-to-DirEntry-metadata…
Manishearth Jun 28, 2020
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 src/doc/unstable-book/src/compiler-flags/self-profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For example:
First, run a compilation session and provide the `-Zself-profile` flag:

```console
$ rustc --crate-name foo -Zself-profile`
$ rustc --crate-name foo -Zself-profile
```

This will generate three files in the working directory such as:
Expand Down
1 change: 1 addition & 0 deletions src/libcore/future/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use crate::task::{Context, Poll};
#[must_use = "futures do nothing unless you `.await` or poll them"]
#[stable(feature = "futures_api", since = "1.36.0")]
#[lang = "future_trait"]
#[rustc_on_unimplemented(label = "`{Self}` is not a future", message = "`{Self}` is not a future")]
pub trait Future {
/// The type of value produced on completion.
#[stable(feature = "futures_api", since = "1.36.0")]
Expand Down
16 changes: 10 additions & 6 deletions src/libprofiler_builtins/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ fn main() {
"InstrProfilingUtil.c",
"InstrProfilingValue.c",
"InstrProfilingWriter.c",
// This file was renamed in LLVM 10.
"InstrProfilingRuntime.cc",
"InstrProfilingRuntime.cpp",
// These files were added in LLVM 11.
"InstrProfilingInternal.c",
"InstrProfilingBiasVar.c",
];

if target.contains("msvc") {
Expand Down Expand Up @@ -69,14 +75,12 @@ fn main() {

let src_root = root.join("lib").join("profile");
for src in profile_sources {
cfg.file(src_root.join(src));
let path = src_root.join(src);
if path.exists() {
cfg.file(path);
}
}

// The file was renamed in LLVM 10.
let old_runtime_path = src_root.join("InstrProfilingRuntime.cc");
let new_runtime_path = src_root.join("InstrProfilingRuntime.cpp");
cfg.file(if old_runtime_path.exists() { old_runtime_path } else { new_runtime_path });

cfg.include(root.join("include"));
cfg.warnings(false);
cfg.compile("profiler-rt");
Expand Down
17 changes: 14 additions & 3 deletions src/librustc_ast_lowering/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_data_structures::thin_vec::ThinVec;
use rustc_errors::struct_span_err;
use rustc_hir as hir;
use rustc_hir::def::Res;
use rustc_span::source_map::{respan, DesugaringKind, Span, Spanned};
use rustc_span::source_map::{respan, DesugaringKind, ForLoopLoc, Span, Spanned};
use rustc_span::symbol::{sym, Ident, Symbol};
use rustc_target::asm;
use std::collections::hash_map::Entry;
Expand Down Expand Up @@ -1361,9 +1361,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
body: &Block,
opt_label: Option<Label>,
) -> hir::Expr<'hir> {
let orig_head_span = head.span;
// expand <head>
let mut head = self.lower_expr_mut(head);
let desugared_span = self.mark_span_with_reason(DesugaringKind::ForLoop, head.span, None);
let desugared_span = self.mark_span_with_reason(
DesugaringKind::ForLoop(ForLoopLoc::Head),
orig_head_span,
None,
);
head.span = desugared_span;

let iter = Ident::with_dummy_span(sym::iter);
Expand Down Expand Up @@ -1458,10 +1463,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
// `mut iter => { ... }`
let iter_arm = self.arm(iter_pat, loop_expr);

let into_iter_span = self.mark_span_with_reason(
DesugaringKind::ForLoop(ForLoopLoc::IntoIter),
orig_head_span,
None,
);

// `match ::std::iter::IntoIterator::into_iter(<head>) { ... }`
let into_iter_expr = {
let into_iter_path = &[sym::iter, sym::IntoIterator, sym::into_iter];
self.expr_call_std_path(desugared_span, into_iter_path, arena_vec![self; head])
self.expr_call_std_path(into_iter_span, into_iter_path, arena_vec![self; head])
};

let match_expr = self.arena.alloc(self.expr_match(
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_codegen_llvm/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ pub unsafe fn optimize_thin_module(
kind: ModuleKind::Regular,
};
{
let target = &*module.module_llvm.tm;
let llmod = module.module_llvm.llmod();
save_temp_bitcode(&cgcx, &module, "thin-lto-input");

Expand Down Expand Up @@ -833,7 +834,7 @@ pub unsafe fn optimize_thin_module(
{
let _timer =
cgcx.prof.generic_activity_with_arg("LLVM_thin_lto_rename", thin_module.name());
if !llvm::LLVMRustPrepareThinLTORename(thin_module.shared.data.0, llmod) {
if !llvm::LLVMRustPrepareThinLTORename(thin_module.shared.data.0, llmod, target) {
let msg = "failed to prepare thin LTO module";
return Err(write::llvm_err(&diag_handler, msg));
}
Expand Down Expand Up @@ -865,7 +866,7 @@ pub unsafe fn optimize_thin_module(
{
let _timer =
cgcx.prof.generic_activity_with_arg("LLVM_thin_lto_import", thin_module.name());
if !llvm::LLVMRustPrepareThinLTOImport(thin_module.shared.data.0, llmod) {
if !llvm::LLVMRustPrepareThinLTOImport(thin_module.shared.data.0, llmod, target) {
let msg = "failed to prepare thin LTO module";
return Err(write::llvm_err(&diag_handler, msg));
}
Expand Down
16 changes: 14 additions & 2 deletions src/librustc_codegen_llvm/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ pub enum TypeKind {
Metadata = 14,
X86_MMX = 15,
Token = 16,
ScalableVector = 17,
BFloat = 18,
}

impl TypeKind {
Expand All @@ -255,6 +257,8 @@ impl TypeKind {
TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata,
TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX,
TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token,
TypeKind::ScalableVector => rustc_codegen_ssa::common::TypeKind::ScalableVector,
TypeKind::BFloat => rustc_codegen_ssa::common::TypeKind::BFloat,
}
}
}
Expand Down Expand Up @@ -2141,10 +2145,18 @@ extern "C" {
PreservedSymbols: *const *const c_char,
PreservedSymbolsLen: c_uint,
) -> Option<&'static mut ThinLTOData>;
pub fn LLVMRustPrepareThinLTORename(Data: &ThinLTOData, Module: &Module) -> bool;
pub fn LLVMRustPrepareThinLTORename(
Data: &ThinLTOData,
Module: &Module,
Target: &TargetMachine,
) -> bool;
pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
pub fn LLVMRustPrepareThinLTOImport(Data: &ThinLTOData, Module: &Module) -> bool;
pub fn LLVMRustPrepareThinLTOImport(
Data: &ThinLTOData,
Module: &Module,
Target: &TargetMachine,
) -> bool;
pub fn LLVMRustGetThinLTOModuleImports(
Data: *const ThinLTOData,
ModuleNameCallback: ThinLTOModuleNameCallback,
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_codegen_ssa/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ pub enum TypeKind {
Metadata,
X86_MMX,
Token,
ScalableVector,
BFloat,
}

// FIXME(mw): Anything that is produced via DepGraph::with_task() must implement
Expand Down
15 changes: 14 additions & 1 deletion src/librustc_errors/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub struct JsonEmitter {
pretty: bool,
ui_testing: bool,
json_rendered: HumanReadableErrorType,
terminal_width: Option<usize>,
macro_backtrace: bool,
}

Expand All @@ -45,6 +46,7 @@ impl JsonEmitter {
source_map: Lrc<SourceMap>,
pretty: bool,
json_rendered: HumanReadableErrorType,
terminal_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
JsonEmitter {
Expand All @@ -54,13 +56,15 @@ impl JsonEmitter {
pretty,
ui_testing: false,
json_rendered,
terminal_width,
macro_backtrace,
}
}

pub fn basic(
pretty: bool,
json_rendered: HumanReadableErrorType,
terminal_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
let file_path_mapping = FilePathMapping::empty();
Expand All @@ -69,6 +73,7 @@ impl JsonEmitter {
Lrc::new(SourceMap::new(file_path_mapping)),
pretty,
json_rendered,
terminal_width,
macro_backtrace,
)
}
Expand All @@ -79,6 +84,7 @@ impl JsonEmitter {
source_map: Lrc<SourceMap>,
pretty: bool,
json_rendered: HumanReadableErrorType,
terminal_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
JsonEmitter {
Expand All @@ -88,6 +94,7 @@ impl JsonEmitter {
pretty,
ui_testing: false,
json_rendered,
terminal_width,
macro_backtrace,
}
}
Expand Down Expand Up @@ -247,7 +254,13 @@ impl Diagnostic {
let buf = BufWriter::default();
let output = buf.clone();
je.json_rendered
.new_emitter(Box::new(buf), Some(je.sm.clone()), false, None, je.macro_backtrace)
.new_emitter(
Box::new(buf),
Some(je.sm.clone()),
false,
je.terminal_width,
je.macro_backtrace,
)
.ui_testing(je.ui_testing)
.emit_diagnostic(diag);
let output = Arc::try_unwrap(output.0).unwrap().into_inner().unwrap();
Expand Down
80 changes: 55 additions & 25 deletions src/librustc_hir/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,26 @@ use rustc_span::Span;

use lazy_static::lazy_static;

pub enum LangItemGroup {
Op,
}

const NUM_GROUPS: usize = 1;

macro_rules! expand_group {
() => {
None
};
($group:expr) => {
Some($group)
};
}

// The actual lang items defined come at the end of this file in one handy table.
// So you probably just want to nip down to the end.
macro_rules! language_item_table {
(
$( $variant:ident, $name:expr, $method:ident, $target:expr; )*
$( $variant:ident $($group:expr)?, $name:expr, $method:ident, $target:expr; )*
) => {

enum_from_u32! {
Expand All @@ -45,6 +60,13 @@ macro_rules! language_item_table {
$( $variant => $name, )*
}
}

pub fn group(self) -> Option<LangItemGroup> {
use LangItemGroup::*;
match self {
$( $variant => expand_group!($($group)*), )*
}
}
}

#[derive(HashStable_Generic)]
Expand All @@ -54,6 +76,9 @@ macro_rules! language_item_table {
pub items: Vec<Option<DefId>>,
/// Lang items that were not found during collection.
pub missing: Vec<LangItem>,
/// Mapping from `LangItemGroup` discriminants to all
/// `DefId`s of lang items in that group.
pub groups: [Vec<DefId>; NUM_GROUPS],
}

impl LanguageItems {
Expand All @@ -64,6 +89,7 @@ macro_rules! language_item_table {
Self {
items: vec![$(init_none($variant)),*],
missing: Vec::new(),
groups: [vec![]; NUM_GROUPS],
}
}

Expand All @@ -79,6 +105,10 @@ macro_rules! language_item_table {
self.items[it as usize].ok_or_else(|| format!("requires `{}` lang_item", it.name()))
}

pub fn group(&self, group: LangItemGroup) -> &[DefId] {
self.groups[group as usize].as_ref()
}

$(
/// Returns the corresponding `DefId` for the lang item
#[doc = $name]
Expand Down Expand Up @@ -171,30 +201,30 @@ language_item_table! {
CoerceUnsizedTraitLangItem, "coerce_unsized", coerce_unsized_trait, Target::Trait;
DispatchFromDynTraitLangItem,"dispatch_from_dyn", dispatch_from_dyn_trait, Target::Trait;

AddTraitLangItem, "add", add_trait, Target::Trait;
SubTraitLangItem, "sub", sub_trait, Target::Trait;
MulTraitLangItem, "mul", mul_trait, Target::Trait;
DivTraitLangItem, "div", div_trait, Target::Trait;
RemTraitLangItem, "rem", rem_trait, Target::Trait;
NegTraitLangItem, "neg", neg_trait, Target::Trait;
NotTraitLangItem, "not", not_trait, Target::Trait;
BitXorTraitLangItem, "bitxor", bitxor_trait, Target::Trait;
BitAndTraitLangItem, "bitand", bitand_trait, Target::Trait;
BitOrTraitLangItem, "bitor", bitor_trait, Target::Trait;
ShlTraitLangItem, "shl", shl_trait, Target::Trait;
ShrTraitLangItem, "shr", shr_trait, Target::Trait;
AddAssignTraitLangItem, "add_assign", add_assign_trait, Target::Trait;
SubAssignTraitLangItem, "sub_assign", sub_assign_trait, Target::Trait;
MulAssignTraitLangItem, "mul_assign", mul_assign_trait, Target::Trait;
DivAssignTraitLangItem, "div_assign", div_assign_trait, Target::Trait;
RemAssignTraitLangItem, "rem_assign", rem_assign_trait, Target::Trait;
BitXorAssignTraitLangItem, "bitxor_assign", bitxor_assign_trait, Target::Trait;
BitAndAssignTraitLangItem, "bitand_assign", bitand_assign_trait, Target::Trait;
BitOrAssignTraitLangItem, "bitor_assign", bitor_assign_trait, Target::Trait;
ShlAssignTraitLangItem, "shl_assign", shl_assign_trait, Target::Trait;
ShrAssignTraitLangItem, "shr_assign", shr_assign_trait, Target::Trait;
IndexTraitLangItem, "index", index_trait, Target::Trait;
IndexMutTraitLangItem, "index_mut", index_mut_trait, Target::Trait;
AddTraitLangItem(Op), "add", add_trait, Target::Trait;
SubTraitLangItem(Op), "sub", sub_trait, Target::Trait;
MulTraitLangItem(Op), "mul", mul_trait, Target::Trait;
DivTraitLangItem(Op), "div", div_trait, Target::Trait;
RemTraitLangItem(Op), "rem", rem_trait, Target::Trait;
NegTraitLangItem(Op), "neg", neg_trait, Target::Trait;
NotTraitLangItem(Op), "not", not_trait, Target::Trait;
BitXorTraitLangItem(Op), "bitxor", bitxor_trait, Target::Trait;
BitAndTraitLangItem(Op), "bitand", bitand_trait, Target::Trait;
BitOrTraitLangItem(Op), "bitor", bitor_trait, Target::Trait;
ShlTraitLangItem(Op), "shl", shl_trait, Target::Trait;
ShrTraitLangItem(Op), "shr", shr_trait, Target::Trait;
AddAssignTraitLangItem(Op), "add_assign", add_assign_trait, Target::Trait;
SubAssignTraitLangItem(Op), "sub_assign", sub_assign_trait, Target::Trait;
MulAssignTraitLangItem(Op), "mul_assign", mul_assign_trait, Target::Trait;
DivAssignTraitLangItem(Op), "div_assign", div_assign_trait, Target::Trait;
RemAssignTraitLangItem(Op), "rem_assign", rem_assign_trait, Target::Trait;
BitXorAssignTraitLangItem(Op),"bitxor_assign", bitxor_assign_trait, Target::Trait;
BitAndAssignTraitLangItem(Op),"bitand_assign", bitand_assign_trait, Target::Trait;
BitOrAssignTraitLangItem(Op),"bitor_assign", bitor_assign_trait, Target::Trait;
ShlAssignTraitLangItem(Op), "shl_assign", shl_assign_trait, Target::Trait;
ShrAssignTraitLangItem(Op), "shr_assign", shr_assign_trait, Target::Trait;
IndexTraitLangItem(Op), "index", index_trait, Target::Trait;
IndexMutTraitLangItem(Op), "index_mut", index_mut_trait, Target::Trait;

UnsafeCellTypeLangItem, "unsafe_cell", unsafe_cell_type, Target::Struct;
VaListTypeLangItem, "va_list", va_list, Target::Struct;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_infer/infer/error_reporting/need_type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
let msg = if let Some(simple_ident) = pattern.simple_ident() {
match pattern.span.desugaring_kind() {
None => format!("consider giving `{}` {}", simple_ident, suffix),
Some(DesugaringKind::ForLoop) => {
Some(DesugaringKind::ForLoop(_)) => {
"the element type for this iterator is not specified".to_string()
}
_ => format!("this needs {}", suffix),
Expand Down
Loading