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 7 pull requests #73821

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
358dc1d
Added io forwarding methods to the stdio structs
Lucretiel May 28, 2020
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
b60cefe
Removed write_fmt forwarding, to fix recursive borrow issues
Lucretiel Jun 17, 2020
14d385b
Restore some write_fmts
Lucretiel Jun 17, 2020
49f6166
Prepare for LLVM 11
cuviper Jun 26, 2020
3678e5c
errors: use `-Z terminal-width` in JSON emitter
davidtwco Jun 26, 2020
89e2c1d
Mark feature gate as accepted
ecstatic-morse May 21, 2020
0438e25
Remove `control_flow_destroyed` and properly lower `&&` and `||`
ecstatic-morse May 21, 2020
8660621
Remove `const_if_match` feature gate from libraries
ecstatic-morse May 21, 2020
23a907e
MIR const-checking
ecstatic-morse May 21, 2020
ff0096d
HIR const-checking
ecstatic-morse May 21, 2020
edd4b36
Update tests
ecstatic-morse May 21, 2020
23d93c3
Remove `const_if_match` from unstable book
ecstatic-morse May 21, 2020
088d036
Require `allow_internal_unstable` in HIR const-checker
ecstatic-morse May 21, 2020
e0d6ad2
Mark `const_loop` feature gate as accepted
ecstatic-morse Jun 26, 2020
839f9c0
Remove uses of `const_loop` in `rustc`
ecstatic-morse Jun 26, 2020
984e536
Stop checking for `while` and `loop` in a const context
ecstatic-morse Jun 26, 2020
8fe1b1d
Update tests
ecstatic-morse Jun 26, 2020
63078c3
Remove `ignore-tidy-filelength`
ecstatic-morse Jun 26, 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
8e8c54a
Added the parapgrah to path::Path::is_file too
poliorcetics Jun 27, 2020
6fc1714
Rollup merge of #72437 - ecstatic-morse:stabilize-const-if-match, r=o…
Dylan-DPC Jun 27, 2020
e5343ec
Rollup merge of #72705 - Lucretiel:stdio-forwarding, r=Amanieu
Dylan-DPC Jun 27, 2020
d31b8ba
Rollup merge of #73243 - poliorcetics:discourage-is-file, r=Amanieu
Dylan-DPC Jun 27, 2020
4b307b2
Rollup merge of #73525 - cuviper:llvm11, r=nikic
Dylan-DPC Jun 27, 2020
23c8bc4
Rollup merge of #73763 - davidtwco:terminal-width-json-emitter, r=est…
Dylan-DPC Jun 27, 2020
01ed6ef
Rollup merge of #73796 - lcnr:LocalDefId, r=matthewjasper
Dylan-DPC Jun 27, 2020
c6c0515
Rollup merge of #73797 - atetubou:patch-1, r=jonas-schievink
Dylan-DPC Jun 27, 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
14 changes: 0 additions & 14 deletions src/doc/unstable-book/src/language-features/const-if-match.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
#![feature(const_generic_impls_guard)]
#![feature(const_generics)]
#![feature(const_in_array_repeat_expressions)]
#![feature(const_if_match)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![feature(cow_is_borrowed)]
#![feature(dispatch_from_dyn)]
#![feature(core_intrinsics)]
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
#![feature(const_ascii_ctype_on_intrinsics)]
#![feature(const_alloc_layout)]
#![feature(const_discriminant)]
#![feature(const_if_match)]
#![feature(const_loop)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![cfg_attr(bootstrap, feature(const_loop))]
#![feature(const_checked_int_methods)]
#![feature(const_euclidean_int_methods)]
#![feature(const_overflowing_int_methods)]
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1578,7 +1578,7 @@ $EndFeature, "
#[stable(feature = "no_panic_abs", since = "1.13.0")]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[allow(unused_attributes)]
#[allow_internal_unstable(const_if_match)]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn wrapping_abs(self) -> Self {
if self.is_negative() {
Expand Down Expand Up @@ -1867,7 +1867,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($Self
#[stable(feature = "wrapping", since = "1.7.0")]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[allow(unused_attributes)]
#[allow_internal_unstable(const_if_match)]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
pub const fn overflowing_neg(self) -> (Self, bool) {
if self == Self::MIN {
(Self::MIN, true)
Expand Down Expand Up @@ -2160,7 +2160,7 @@ $EndFeature, "
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[allow(unused_attributes)]
#[allow_internal_unstable(const_if_match)]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
#[rustc_inherit_overflow_checks]
pub const fn abs(self) -> Self {
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
2 changes: 1 addition & 1 deletion src/librustc_ast/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
#![feature(bool_to_option)]
#![feature(box_syntax)]
#![feature(const_if_match)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![feature(const_fn)] // For the `transmute` in `P::new`
#![feature(const_panic)]
#![feature(const_transmute)]
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
4 changes: 4 additions & 0 deletions src/librustc_feature/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ declare_features! (
(accepted, transparent_enums, "1.42.0", Some(60405), None),
/// Allows using subslice patterns, `[a, .., b]` and `[a, xs @ .., b]`.
(accepted, slice_patterns, "1.42.0", Some(62254), None),
/// Allows the use of `if` and `match` in constants.
(accepted, const_if_match, "1.45.0", Some(49146), None),
/// Allows the use of `loop` and `while` in constants.
(accepted, const_loop, "1.45.0", Some(52000), None),

// -------------------------------------------------------------------------
// feature-group-end: accepted features
Expand Down
6 changes: 0 additions & 6 deletions src/librustc_feature/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,6 @@ declare_features! (
/// Allows using the `#[register_tool]` attribute.
(active, register_tool, "1.41.0", Some(66079), None),

/// Allows the use of `if` and `match` in constants.
(active, const_if_match, "1.41.0", Some(49146), None),

/// Allows the use of `#[cfg(sanitize = "option")]`; set when -Zsanitizer is used.
(active, cfg_sanitize, "1.41.0", Some(39699), None),

Expand All @@ -530,9 +527,6 @@ declare_features! (
/// Allows using `&mut` in constant functions.
(active, const_mut_refs, "1.41.0", Some(57349), None),

/// Allows the use of `loop` and `while` in constants.
(active, const_loop, "1.41.0", Some(52000), None),

/// Allows bindings in the subpattern of a binding pattern.
/// For example, you can write `x @ Some(y)`.
(active, bindings_after_at, "1.41.0", Some(65490), None),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_hir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html

#![feature(crate_visibility_modifier)]
#![feature(const_if_match)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![feature(const_fn)] // For the unsizing cast on `&[]`
#![feature(const_panic)]
#![feature(in_band_lifetimes)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_index/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(allow_internal_unstable)]
#![feature(const_if_match)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![feature(const_fn)]
#![feature(const_panic)]
#![feature(extend_one)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,27 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
br: &ty::BoundRegion,
) -> Option<(&hir::Ty<'tcx>, &hir::FnDecl<'tcx>)> {
if let Some(anon_reg) = self.tcx().is_suitable_region(region) {
let def_id = anon_reg.def_id;
if let Some(def_id) = def_id.as_local() {
let hir_id = self.tcx().hir().as_local_hir_id(def_id);
let fndecl = match self.tcx().hir().get(hir_id) {
Node::Item(&hir::Item { kind: hir::ItemKind::Fn(ref m, ..), .. })
| Node::TraitItem(&hir::TraitItem {
kind: hir::TraitItemKind::Fn(ref m, ..),
..
})
| Node::ImplItem(&hir::ImplItem {
kind: hir::ImplItemKind::Fn(ref m, ..),
..
}) => &m.decl,
_ => return None,
};
let hir_id = self.tcx().hir().as_local_hir_id(anon_reg.def_id);
let fndecl = match self.tcx().hir().get(hir_id) {
Node::Item(&hir::Item { kind: hir::ItemKind::Fn(ref m, ..), .. })
| Node::TraitItem(&hir::TraitItem {
kind: hir::TraitItemKind::Fn(ref m, ..),
..
})
| Node::ImplItem(&hir::ImplItem {
kind: hir::ImplItemKind::Fn(ref m, ..), ..
}) => &m.decl,
_ => return None,
};

return fndecl
.inputs
.iter()
.find_map(|arg| self.find_component_for_bound_region(arg, br))
.map(|ty| (ty, &**fndecl));
}
fndecl
.inputs
.iter()
.find_map(|arg| self.find_component_for_bound_region(arg, br))
.map(|ty| (ty, &**fndecl))
} else {
None
}
None
}

// This method creates a FindNestedTypeVisitor which returns the type corresponding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
}

if let Some((_, fndecl)) = self.find_anon_type(anon, &br) {
let is_self_anon = self.is_self_anon(is_first, scope_def_id);
if is_self_anon {
if self.is_self_anon(is_first, scope_def_id) {
return None;
}

Expand Down
Loading