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 9 pull requests #76137

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6b0d44e
Make some Ordering methods const
Aug 12, 2020
acd3962
Fix typo in release notes
camelid Aug 25, 2020
91e4aaa
Use intra-doc links for `core/src/slice.mod.rs`
Amjad50 Aug 26, 2020
8e33137
Fixes `intra-doc` same scope links
Amjad50 Aug 26, 2020
a04e120
Used intra-doc links for `NonNull::dangling()` occurrences
Amjad50 Aug 26, 2020
6aae4a2
Used intra-doc links for `ptr#safety` occurrences
Amjad50 Aug 26, 2020
2d6ab12
Liballoc extend use intra doc link
pickfire Aug 28, 2020
7be129e
Add missing hyphen
camelid Aug 28, 2020
c7e428e
Liballoc vec doc use associated function
pickfire Aug 29, 2020
8a92718
Switch to intra-doc links in core/src/{convert,iter}/mod.rs
nixphix Aug 27, 2020
01d95f2
resolve comments
nixphix Aug 27, 2020
300a007
Fix intra-doc path resolution problem in `library/alloc/src/slice.rs`
Amjad50 Aug 30, 2020
7ea4c28
add i32::MAX link
nixphix Aug 30, 2020
523fea4
revert Some(Item) link
nixphix Aug 30, 2020
5fac991
Add unstable `const_ordering` feature, and some tests.
Aug 30, 2020
a97dcfa
Run cfg-stripping on generic parameters before invoking derive macros
Aaron1011 Aug 28, 2020
6ff471b
ty: remove obsolete printer
davidtwco Aug 28, 2020
30dc32b
Add (non-public) slice::split_at_unchecked() and split_at_mut_uncheck…
sdroege Aug 28, 2020
d08996a
Get rid of bounds check in slice::chunks_exact() and related function…
sdroege Aug 26, 2020
8d3cf92
Improve documentation of slice::get_unchecked() / split_at_unchecked()
sdroege Aug 30, 2020
89fc3fb
Stabilize feature `const_ordering`
Aug 30, 2020
12f4624
Update `since` to correct release
Aug 30, 2020
8af7b00
Rollup merge of #75463 - CDirkx:ordering-const, r=CDirkx
Dylan-DPC Aug 31, 2020
6650103
Rollup merge of #75926 - camelid:patch-5, r=jonas-schievink
Dylan-DPC Aug 31, 2020
b20b97a
Rollup merge of #75932 - Amjad50:intra-doc-core-slice, r=jyn514
Dylan-DPC Aug 31, 2020
f02f8c6
Rollup merge of #75936 - sdroege:chunks-exact-construction-bounds-che…
Dylan-DPC Aug 31, 2020
64013aa
Rollup merge of #75969 - nixphix:docs/mod, r=jyn514
Dylan-DPC Aug 31, 2020
69dc972
Rollup merge of #76010 - Aaron1011:fix/cfg-generic-param, r=petrochenkov
Dylan-DPC Aug 31, 2020
1f96030
Rollup merge of #76023 - pickfire:patch-4, r=jyn514
Dylan-DPC Aug 31, 2020
0af6fed
Rollup merge of #76027 - davidtwco:issue-61139-remove-obsolete-pretty…
Dylan-DPC Aug 31, 2020
a271e97
Rollup merge of #76033 - camelid:patch-7, r=Dylan-DPC
Dylan-DPC Aug 31, 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 RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Language
function's caller's location information for panic messages.][72445]
- [Recursively indexing into tuples no longer needs parentheses.][71322] E.g.
`x.0.0` over `(x.0).0`.
- [`mem::transmute` can now be used in static and constants.][72920] **Note**
- [`mem::transmute` can now be used in statics and constants.][72920] **Note**
You currently can't use `mem::transmute` in constant functions.

Compiler
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_codegen_llvm/src/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::type_::Type;
use rustc_codegen_ssa::traits::*;
use rustc_middle::bug;
use rustc_middle::ty::layout::{FnAbiExt, TyAndLayout};
use rustc_middle::ty::print::obsolete::DefPathBasedNames;
use rustc_middle::ty::{self, Ty, TypeFoldable};
use rustc_target::abi::{Abi, AddressSpace, Align, FieldsShape};
use rustc_target::abi::{Int, Pointer, F32, F64};
Expand Down Expand Up @@ -60,9 +59,7 @@ fn uncached_llvm_type<'a, 'tcx>(
// ty::Dynamic(..) |
ty::Foreign(..) |
ty::Str => {
let mut name = String::with_capacity(32);
let printer = DefPathBasedNames::new(cx.tcx, true, true);
printer.push_type_name(layout.ty, &mut name, false);
let mut name = layout.ty.to_string();
if let (&ty::Adt(def, _), &Variants::Single { index })
= (&layout.ty.kind, &layout.variants)
{
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_ssa/src/mono_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<'a, 'tcx: 'a> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {
fn define<Bx: BuilderMethods<'a, 'tcx>>(&self, cx: &'a Bx::CodegenCx) {
debug!(
"BEGIN IMPLEMENTING '{} ({})' in cgu {}",
self.to_string(cx.tcx(), true),
self,
self.to_raw_string(),
cx.codegen_unit().name()
);
Expand All @@ -45,7 +45,7 @@ impl<'a, 'tcx: 'a> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {

debug!(
"END IMPLEMENTING '{} ({})' in cgu {}",
self.to_string(cx.tcx(), true),
self,
self.to_raw_string(),
cx.codegen_unit().name()
);
Expand All @@ -59,7 +59,7 @@ impl<'a, 'tcx: 'a> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {
) {
debug!(
"BEGIN PREDEFINING '{} ({})' in cgu {}",
self.to_string(cx.tcx(), true),
self,
self.to_raw_string(),
cx.codegen_unit().name()
);
Expand All @@ -80,7 +80,7 @@ impl<'a, 'tcx: 'a> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {

debug!(
"END PREDEFINING '{} ({})' in cgu {}",
self.to_string(cx.tcx(), true),
self,
self.to_raw_string(),
cx.codegen_unit().name()
);
Expand Down
11 changes: 7 additions & 4 deletions compiler/rustc_expand/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,6 @@ impl<'a> StripUnconfigured<'a> {
items.flat_map_in_place(|item| self.configure(item));
}

pub fn configure_generic_params(&mut self, params: &mut Vec<ast::GenericParam>) {
params.flat_map_in_place(|param| self.configure(param));
}

fn configure_variant_data(&mut self, vdata: &mut ast::VariantData) {
match vdata {
ast::VariantData::Struct(fields, ..) | ast::VariantData::Tuple(fields, _) => {
Expand Down Expand Up @@ -496,6 +492,13 @@ impl<'a> MutVisitor for StripUnconfigured<'a> {
Some(expr)
}

fn flat_map_generic_param(
&mut self,
param: ast::GenericParam,
) -> SmallVec<[ast::GenericParam; 1]> {
noop_flat_map_generic_param(configure!(self, param), self)
}

fn flat_map_stmt(&mut self, stmt: ast::Stmt) -> SmallVec<[ast::Stmt; 1]> {
noop_flat_map_stmt(configure!(self, stmt), self)
}
Expand Down
37 changes: 12 additions & 25 deletions compiler/rustc_middle/src/mir/mono.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::dep_graph::{DepConstructor, DepNode, WorkProduct, WorkProductId};
use crate::ich::{NodeIdHashingMode, StableHashingContext};
use crate::ty::print::obsolete::DefPathBasedNames;
use crate::ty::{subst::InternalSubsts, Instance, InstanceDef, SymbolName, TyCtxt};
use rustc_attr::InlineAttr;
use rustc_data_structures::base_n;
Expand Down Expand Up @@ -171,30 +170,6 @@ impl<'tcx> MonoItem<'tcx> {
!tcx.subst_and_check_impossible_predicates((def_id, &substs))
}

pub fn to_string(&self, tcx: TyCtxt<'tcx>, debug: bool) -> String {
return match *self {
MonoItem::Fn(instance) => to_string_internal(tcx, "fn ", instance, debug),
MonoItem::Static(def_id) => {
let instance = Instance::new(def_id, tcx.intern_substs(&[]));
to_string_internal(tcx, "static ", instance, debug)
}
MonoItem::GlobalAsm(..) => "global_asm".to_string(),
};

fn to_string_internal<'tcx>(
tcx: TyCtxt<'tcx>,
prefix: &str,
instance: Instance<'tcx>,
debug: bool,
) -> String {
let mut result = String::with_capacity(32);
result.push_str(prefix);
let printer = DefPathBasedNames::new(tcx, false, false);
printer.push_instance_as_string(instance, &mut result, debug);
result
}
}

pub fn local_span(&self, tcx: TyCtxt<'tcx>) -> Option<Span> {
match *self {
MonoItem::Fn(Instance { def, .. }) => {
Expand Down Expand Up @@ -229,6 +204,18 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for MonoItem<'tcx> {
}
}

impl<'tcx> fmt::Display for MonoItem<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
MonoItem::Fn(instance) => write!(f, "fn {}", instance),
MonoItem::Static(def_id) => {
write!(f, "static {}", Instance::new(def_id, InternalSubsts::empty()))
}
MonoItem::GlobalAsm(..) => write!(f, "global_asm"),
}
}
}

pub struct CodegenUnit<'tcx> {
/// A name for this CGU. Incremental compilation requires that
/// name be unique amongst **all** crates. Therefore, it should
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/ty/print/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
mod pretty;
pub use self::pretty::*;

pub mod obsolete;

// FIXME(eddyb) false positive, the lifetime parameters are used with `P: Printer<...>`.
#[allow(unused_lifetimes)]
pub trait Print<'tcx, P> {
Expand Down
Loading