Auto merge of #76027 - davidtwco:issue-61139-remove-obsolete-pretty-printer, r=eddyb

ty: remove obsolete pretty printer

Fixes #61139.

This PR removes the obsolete printer and replaces all uses of it with `FmtPrinter`. Of the replaced uses, all but one use was in `debug!` logging, two cases were notable:

- `MonoItem::to_string` is used in `-Z print-mono-items` and therefore affects the output of all codegen-units tests (which have been updated).
- `DefPathBasedNames` was used in `librustc_codegen_llvm/type_of.rs` with `LLVMStructCreateNamed` and that'll now get different values, but nothing will break as a result of this.

cc @eddyb (whom I've discussed this with)
This commit is contained in:
bors 2020-08-31 05:32:54 +00:00
commit 8ed5cb56b5
44 changed files with 385 additions and 664 deletions

View file

@ -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};
@ -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)
{

View file

@ -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()
);
@ -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()
);
@ -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()
);
@ -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()
);

View file

@ -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;
@ -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, .. }) => {
@ -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

View file

@ -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> {

View file

@ -1,251 +0,0 @@
//! Allows for producing a unique string key for a mono item.
//! These keys are used by the handwritten auto-tests, so they need to be
//! predictable and human-readable.
//!
//! Note: A lot of this could looks very similar to what's already in `ty::print`.
//! FIXME(eddyb) implement a custom `PrettyPrinter` for this.
use crate::bug;
use crate::ty::subst::SubstsRef;
use crate::ty::{self, Const, Instance, Ty, TyCtxt};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use std::fmt::Write;
use std::iter;
/// Same as `unique_type_name()` but with the result pushed onto the given
/// `output` parameter.
pub struct DefPathBasedNames<'tcx> {
tcx: TyCtxt<'tcx>,
omit_disambiguators: bool,
omit_local_crate_name: bool,
}
impl DefPathBasedNames<'tcx> {
pub fn new(tcx: TyCtxt<'tcx>, omit_disambiguators: bool, omit_local_crate_name: bool) -> Self {
DefPathBasedNames { tcx, omit_disambiguators, omit_local_crate_name }
}
// Pushes the type name of the specified type to the provided string.
// If `debug` is true, printing normally unprintable types is allowed
// (e.g. `ty::GeneratorWitness`). This parameter should only be set when
// this method is being used for logging purposes (e.g. with `debug!` or `info!`)
// When being used for codegen purposes, `debug` should be set to `false`
// in order to catch unexpected types that should never end up in a type name.
pub fn push_type_name(&self, t: Ty<'tcx>, output: &mut String, debug: bool) {
match t.kind {
ty::Bool => output.push_str("bool"),
ty::Char => output.push_str("char"),
ty::Str => output.push_str("str"),
ty::Never => output.push_str("!"),
ty::Int(ty) => output.push_str(ty.name_str()),
ty::Uint(ty) => output.push_str(ty.name_str()),
ty::Float(ty) => output.push_str(ty.name_str()),
ty::Adt(adt_def, substs) => {
self.push_def_path(adt_def.did, output);
self.push_generic_params(substs, iter::empty(), output, debug);
}
ty::Tuple(component_types) => {
output.push('(');
for component_type in component_types {
self.push_type_name(component_type.expect_ty(), output, debug);
output.push_str(", ");
}
if !component_types.is_empty() {
output.pop();
output.pop();
}
output.push(')');
}
ty::RawPtr(ty::TypeAndMut { ty: inner_type, mutbl }) => {
output.push('*');
match mutbl {
hir::Mutability::Not => output.push_str("const "),
hir::Mutability::Mut => output.push_str("mut "),
}
self.push_type_name(inner_type, output, debug);
}
ty::Ref(_, inner_type, mutbl) => {
output.push('&');
output.push_str(mutbl.prefix_str());
self.push_type_name(inner_type, output, debug);
}
ty::Array(inner_type, len) => {
output.push('[');
self.push_type_name(inner_type, output, debug);
let len = len.eval_usize(self.tcx, ty::ParamEnv::reveal_all());
write!(output, "; {}", len).unwrap();
output.push(']');
}
ty::Slice(inner_type) => {
output.push('[');
self.push_type_name(inner_type, output, debug);
output.push(']');
}
ty::Dynamic(ref trait_data, ..) => {
if let Some(principal) = trait_data.principal() {
self.push_def_path(principal.def_id(), output);
self.push_generic_params(
principal.skip_binder().substs,
trait_data.projection_bounds(),
output,
debug,
);
} else {
output.push_str("dyn '_");
}
}
ty::Foreign(did) => self.push_def_path(did, output),
ty::FnDef(..) | ty::FnPtr(_) => {
let sig = t.fn_sig(self.tcx);
output.push_str(sig.unsafety().prefix_str());
let abi = sig.abi();
if abi != ::rustc_target::spec::abi::Abi::Rust {
output.push_str("extern \"");
output.push_str(abi.name());
output.push_str("\" ");
}
output.push_str("fn(");
let sig =
self.tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), &sig);
if !sig.inputs().is_empty() {
for &parameter_type in sig.inputs() {
self.push_type_name(parameter_type, output, debug);
output.push_str(", ");
}
output.pop();
output.pop();
}
if sig.c_variadic {
if !sig.inputs().is_empty() {
output.push_str(", ...");
} else {
output.push_str("...");
}
}
output.push(')');
if !sig.output().is_unit() {
output.push_str(" -> ");
self.push_type_name(sig.output(), output, debug);
}
}
ty::Generator(def_id, substs, _) | ty::Closure(def_id, substs) => {
self.push_def_path(def_id, output);
let generics = self.tcx.generics_of(self.tcx.closure_base_def_id(def_id));
let substs = substs.truncate_to(self.tcx, generics);
self.push_generic_params(substs, iter::empty(), output, debug);
}
ty::Param(_) => {
output.push_str(&t.to_string());
}
ty::Error(_)
| ty::Bound(..)
| ty::Infer(_)
| ty::Placeholder(..)
| ty::Projection(..)
| ty::GeneratorWitness(_)
| ty::Opaque(..) => {
if debug {
output.push_str(&format!("`{:?}`", t));
} else {
bug!(
"DefPathBasedNames: trying to create type name for unexpected type: {:?}",
t,
);
}
}
}
}
// Pushes the the name of the specified const to the provided string.
// If `debug` is true, the unprintable types of constants will be printed with `fmt::Debug`
// (see `push_type_name` for more details).
pub fn push_const_name(&self, ct: &Const<'tcx>, output: &mut String, debug: bool) {
write!(output, "{}", ct).unwrap();
output.push_str(": ");
self.push_type_name(ct.ty, output, debug);
}
pub fn push_def_path(&self, def_id: DefId, output: &mut String) {
let def_path = self.tcx.def_path(def_id);
// some_crate::
if !(self.omit_local_crate_name && def_id.is_local()) {
output.push_str(&self.tcx.crate_name(def_path.krate).as_str());
output.push_str("::");
}
// foo::bar::ItemName::
for part in self.tcx.def_path(def_id).data {
if self.omit_disambiguators {
write!(output, "{}::", part.data.as_symbol()).unwrap();
} else {
write!(output, "{}[{}]::", part.data.as_symbol(), part.disambiguator).unwrap();
}
}
// remove final "::"
output.pop();
output.pop();
}
fn push_generic_params<I>(
&self,
substs: SubstsRef<'tcx>,
projections: I,
output: &mut String,
debug: bool,
) where
I: Iterator<Item = ty::PolyExistentialProjection<'tcx>>,
{
let mut projections = projections.peekable();
if substs.non_erasable_generics().next().is_none() && projections.peek().is_none() {
return;
}
output.push('<');
for type_parameter in substs.types() {
self.push_type_name(type_parameter, output, debug);
output.push_str(", ");
}
for projection in projections {
let projection = projection.skip_binder();
let name = &self.tcx.associated_item(projection.item_def_id).ident.as_str();
output.push_str(name);
output.push_str("=");
self.push_type_name(projection.ty, output, debug);
output.push_str(", ");
}
for const_parameter in substs.consts() {
self.push_const_name(const_parameter, output, debug);
output.push_str(", ");
}
output.pop();
output.pop();
output.push('>');
}
pub fn push_instance_as_string(
&self,
instance: Instance<'tcx>,
output: &mut String,
debug: bool,
) {
self.push_def_path(instance.def_id(), output);
self.push_generic_params(instance.substs, iter::empty(), output, debug);
}
}

View file

@ -191,7 +191,6 @@ use rustc_middle::mir::mono::{InstantiationMode, MonoItem};
use rustc_middle::mir::visit::Visitor as MirVisitor;
use rustc_middle::mir::{self, Local, Location};
use rustc_middle::ty::adjustment::{CustomCoerceUnsized, PointerCast};
use rustc_middle::ty::print::obsolete::DefPathBasedNames;
use rustc_middle::ty::subst::{GenericArgKind, InternalSubsts};
use rustc_middle::ty::{self, GenericParamDefKind, Instance, Ty, TyCtxt, TypeFoldable};
use rustc_session::config::EntryFnType;
@ -348,7 +347,7 @@ fn collect_items_rec<'tcx>(
// We've been here already, no need to search again.
return;
}
debug!("BEGIN collect_items_rec({})", starting_point.node.to_string(tcx, true));
debug!("BEGIN collect_items_rec({})", starting_point.node);
let mut neighbors = Vec::new();
let recursion_depth_reset;
@ -397,7 +396,7 @@ fn collect_items_rec<'tcx>(
recursion_depths.insert(def_id, depth);
}
debug!("END collect_items_rec({})", starting_point.node.to_string(tcx, true));
debug!("END collect_items_rec({})", starting_point.node);
}
fn record_accesses<'a, 'tcx: 'a>(
@ -992,7 +991,7 @@ impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> {
let def_id = self.tcx.hir().local_def_id(item.hir_id);
debug!(
"RootCollector: ADT drop-glue for {}",
def_id_to_string(self.tcx, def_id)
self.tcx.def_path_str(def_id.to_def_id())
);
let ty = Instance::new(def_id.to_def_id(), InternalSubsts::empty())
@ -1004,14 +1003,14 @@ impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> {
hir::ItemKind::GlobalAsm(..) => {
debug!(
"RootCollector: ItemKind::GlobalAsm({})",
def_id_to_string(self.tcx, self.tcx.hir().local_def_id(item.hir_id))
self.tcx.def_path_str(self.tcx.hir().local_def_id(item.hir_id).to_def_id())
);
self.output.push(dummy_spanned(MonoItem::GlobalAsm(item.hir_id)));
}
hir::ItemKind::Static(..) => {
let def_id = self.tcx.hir().local_def_id(item.hir_id);
debug!("RootCollector: ItemKind::Static({})", def_id_to_string(self.tcx, def_id));
self.output.push(dummy_spanned(MonoItem::Static(def_id.to_def_id())));
let def_id = self.tcx.hir().local_def_id(item.hir_id).to_def_id();
debug!("RootCollector: ItemKind::Static({})", self.tcx.def_path_str(def_id));
self.output.push(dummy_spanned(MonoItem::Static(def_id)));
}
hir::ItemKind::Const(..) => {
// const items only generate mono items if they are
@ -1134,7 +1133,7 @@ fn create_mono_items_for_default_impls<'tcx>(
debug!(
"create_mono_items_for_default_impls(item={})",
def_id_to_string(tcx, impl_def_id)
tcx.def_path_str(impl_def_id.to_def_id())
);
if let Some(trait_ref) = tcx.impl_trait_ref(impl_def_id) {
@ -1218,13 +1217,6 @@ fn collect_neighbours<'tcx>(
MirNeighborCollector { tcx, body: &body, output, instance }.visit_body(&body);
}
fn def_id_to_string(tcx: TyCtxt<'_>, def_id: LocalDefId) -> String {
let mut output = String::new();
let printer = DefPathBasedNames::new(tcx, false, false);
printer.push_def_path(def_id.to_def_id(), &mut output);
output
}
fn collect_const_value<'tcx>(
tcx: TyCtxt<'tcx>,
value: ConstValue<'tcx>,

View file

@ -246,7 +246,7 @@ where
debug!(
" - {} [{:?}] [{}] estimated size {}",
mono_item.to_string(tcx, true),
mono_item,
linkage,
symbol_hash,
mono_item.size_estimate(tcx)
@ -374,7 +374,7 @@ fn collect_and_partition_mono_items<'tcx>(
let mut item_keys: Vec<_> = items
.iter()
.map(|i| {
let mut output = i.to_string(tcx, false);
let mut output = i.to_string();
output.push_str(" @@");
let mut empty = Vec::new();
let cgus = item_to_cgus.get_mut(i).unwrap_or(&mut empty);

View file

@ -6,15 +6,15 @@
// aux-build:cgu_generic_function.rs
extern crate cgu_generic_function;
//~ MONO_ITEM fn cross_crate_generic_functions::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
//~ MONO_ITEM fn cgu_generic_function::bar[0]<u32>
//~ MONO_ITEM fn cgu_generic_function::foo[0]<u32>
//~ MONO_ITEM fn cgu_generic_function::bar::<u32>
//~ MONO_ITEM fn cgu_generic_function::foo::<u32>
let _ = cgu_generic_function::foo(1u32);
//~ MONO_ITEM fn cgu_generic_function::bar[0]<u64>
//~ MONO_ITEM fn cgu_generic_function::foo[0]<u64>
//~ MONO_ITEM fn cgu_generic_function::bar::<u64>
//~ MONO_ITEM fn cgu_generic_function::foo::<u64>
let _ = cgu_generic_function::foo(2u64);
// This should not introduce a codegen item

View file

@ -8,7 +8,7 @@ extern crate cgu_export_trait_method;
use cgu_export_trait_method::Trait;
//~ MONO_ITEM fn cross_crate_trait_method::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
// The object code of these methods is contained in the external crate, so
@ -19,31 +19,31 @@ fn start(_: isize, _: *const *const u8) -> isize {
// Currently, no object code is generated for trait methods with default
// implementations, unless they are actually called from somewhere. Therefore
// we cannot import the implementations and have to create our own inline.
//~ MONO_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl[0]<u32>
//~ MONO_ITEM fn <u32 as cgu_export_trait_method::Trait>::with_default_impl
let _ = Trait::with_default_impl(0u32);
//~ MONO_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl[0]<char>
//~ MONO_ITEM fn <char as cgu_export_trait_method::Trait>::with_default_impl
let _ = Trait::with_default_impl('c');
//~ MONO_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl_generic[0]<u32, &str>
//~ MONO_ITEM fn <u32 as cgu_export_trait_method::Trait>::with_default_impl_generic::<&str>
let _ = Trait::with_default_impl_generic(0u32, "abc");
//~ MONO_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl_generic[0]<u32, bool>
//~ MONO_ITEM fn <u32 as cgu_export_trait_method::Trait>::with_default_impl_generic::<bool>
let _ = Trait::with_default_impl_generic(0u32, false);
//~ MONO_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl_generic[0]<char, i16>
//~ MONO_ITEM fn <char as cgu_export_trait_method::Trait>::with_default_impl_generic::<i16>
let _ = Trait::with_default_impl_generic('x', 1i16);
//~ MONO_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl_generic[0]<char, i32>
//~ MONO_ITEM fn <char as cgu_export_trait_method::Trait>::with_default_impl_generic::<i32>
let _ = Trait::with_default_impl_generic('y', 0i32);
//~ MONO_ITEM fn cgu_export_trait_method::{{impl}}[1]::without_default_impl_generic[0]<char>
//~ MONO_ITEM fn <u32 as cgu_export_trait_method::Trait>::without_default_impl_generic::<char>
let _: (u32, char) = Trait::without_default_impl_generic('c');
//~ MONO_ITEM fn cgu_export_trait_method::{{impl}}[1]::without_default_impl_generic[0]<bool>
//~ MONO_ITEM fn <u32 as cgu_export_trait_method::Trait>::without_default_impl_generic::<bool>
let _: (u32, bool) = Trait::without_default_impl_generic(false);
//~ MONO_ITEM fn cgu_export_trait_method::{{impl}}[0]::without_default_impl_generic[0]<char>
//~ MONO_ITEM fn <char as cgu_export_trait_method::Trait>::without_default_impl_generic::<char>
let _: (char, char) = Trait::without_default_impl_generic('c');
//~ MONO_ITEM fn cgu_export_trait_method::{{impl}}[0]::without_default_impl_generic[0]<bool>
//~ MONO_ITEM fn <char as cgu_export_trait_method::Trait>::without_default_impl_generic::<bool>
let _: (char, bool) = Trait::without_default_impl_generic(false);
0

View file

@ -4,19 +4,19 @@
#![feature(start)]
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<drop_in_place_intrinsic::StructWithDtor[0]> @@ drop_in_place_intrinsic-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<StructWithDtor> - shim(Some(StructWithDtor)) @@ drop_in_place_intrinsic-cgu.0[Internal]
struct StructWithDtor(u32);
impl Drop for StructWithDtor {
//~ MONO_ITEM fn drop_in_place_intrinsic::{{impl}}[0]::drop[0]
//~ MONO_ITEM fn <StructWithDtor as std::ops::Drop>::drop
fn drop(&mut self) {}
}
//~ MONO_ITEM fn drop_in_place_intrinsic::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<[StructWithDtor; 2]> - shim(Some([StructWithDtor; 2])) @@ drop_in_place_intrinsic-cgu.0[Internal]
let x = [StructWithDtor(0), StructWithDtor(1)];
drop_slice_in_place(&x);
@ -24,13 +24,13 @@ fn start(_: isize, _: *const *const u8) -> isize {
0
}
//~ MONO_ITEM fn drop_in_place_intrinsic::drop_slice_in_place[0]
//~ MONO_ITEM fn drop_slice_in_place
fn drop_slice_in_place(x: &[StructWithDtor]) {
unsafe {
// This is the interesting thing in this test case: Normally we would
// not have drop-glue for the unsized [StructWithDtor]. This has to be
// generated though when the drop_in_place() intrinsic is used.
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic-cgu.0[Internal]
::std::ptr::drop_in_place(x as *const _ as *mut [StructWithDtor]);
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<[StructWithDtor]> - shim(Some([StructWithDtor])) @@ drop_in_place_intrinsic-cgu.0[Internal]
::std::intrinsics::drop_in_place(x as *const _ as *mut [StructWithDtor]);
}
}

View file

@ -1,3 +1,4 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager
#![deny(dead_code)]
@ -13,26 +14,26 @@ fn take_fn_pointer<T1, T2>(f: fn(T1, T2), x: T1, y: T2) {
(f)(x, y)
}
//~ MONO_ITEM fn function_as_argument::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
//~ MONO_ITEM fn function_as_argument::take_fn_once[0]<u32, &str, fn(u32, &str)>
//~ MONO_ITEM fn function_as_argument::function[0]<u32, &str>
//~ MONO_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0]<fn(u32, &str), (u32, &str)>
//~ MONO_ITEM fn take_fn_once::<u32, &str, fn(u32, &str) {function::<u32, &str>}>
//~ MONO_ITEM fn function::<u32, &str>
//~ MONO_ITEM fn <fn(u32, &str) {function::<u32, &str>} as std::ops::FnOnce<(u32, &str)>>::call_once - shim(fn(u32, &str) {function::<u32, &str>})
take_fn_once(function, 0u32, "abc");
//~ MONO_ITEM fn function_as_argument::take_fn_once[0]<char, f64, fn(char, f64)>
//~ MONO_ITEM fn function_as_argument::function[0]<char, f64>
//~ MONO_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0]<fn(char, f64), (char, f64)>
//~ MONO_ITEM fn take_fn_once::<char, f64, fn(char, f64) {function::<char, f64>}>
//~ MONO_ITEM fn function::<char, f64>
//~ MONO_ITEM fn <fn(char, f64) {function::<char, f64>} as std::ops::FnOnce<(char, f64)>>::call_once - shim(fn(char, f64) {function::<char, f64>})
take_fn_once(function, 'c', 0f64);
//~ MONO_ITEM fn function_as_argument::take_fn_pointer[0]<i32, ()>
//~ MONO_ITEM fn function_as_argument::function[0]<i32, ()>
//~ MONO_ITEM fn take_fn_pointer::<i32, ()>
//~ MONO_ITEM fn function::<i32, ()>
take_fn_pointer(function, 0i32, ());
//~ MONO_ITEM fn function_as_argument::take_fn_pointer[0]<f32, i64>
//~ MONO_ITEM fn function_as_argument::function[0]<f32, i64>
//~ MONO_ITEM fn take_fn_pointer::<f32, i64>
//~ MONO_ITEM fn function::<f32, i64>
take_fn_pointer(function, 0f32, 0i64);
0

View file

@ -37,22 +37,22 @@ enum EnumNoDrop<T1, T2> {
struct NonGenericNoDrop(i32);
struct NonGenericWithDrop(i32);
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::NonGenericWithDrop[0]> @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<NonGenericWithDrop> - shim(Some(NonGenericWithDrop)) @@ generic_drop_glue-cgu.0[Internal]
impl Drop for NonGenericWithDrop {
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[2]::drop[0]
//~ MONO_ITEM fn <NonGenericWithDrop as std::ops::Drop>::drop
fn drop(&mut self) {}
}
//~ MONO_ITEM fn generic_drop_glue::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<i8, char>> @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<i8, char>
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<StructWithDrop<i8, char>> - shim(Some(StructWithDrop<i8, char>)) @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn <StructWithDrop<i8, char> as std::ops::Drop>::drop
let _ = StructWithDrop { x: 0i8, y: 'a' }.x;
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>> @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<StructWithDrop<&str, NonGenericNoDrop>> - shim(Some(StructWithDrop<&str, NonGenericNoDrop>)) @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn <StructWithDrop<&str, NonGenericNoDrop> as std::ops::Drop>::drop
let _ = StructWithDrop { x: "&str", y: NonGenericNoDrop(0) }.y;
// Should produce no drop glue
@ -60,18 +60,18 @@ fn start(_: isize, _: *const *const u8) -> isize {
// This is supposed to generate drop-glue because it contains a field that
// needs to be dropped.
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructNoDrop[0]<generic_drop_glue::NonGenericWithDrop[0], f64>> @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<StructNoDrop<NonGenericWithDrop, f64>> - shim(Some(StructNoDrop<NonGenericWithDrop, f64>)) @@ generic_drop_glue-cgu.0[Internal]
let _ = StructNoDrop { x: NonGenericWithDrop(0), y: 0f64 }.y;
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<i32, i64>> @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0]<i32, i64>
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<EnumWithDrop<i32, i64>> - shim(Some(EnumWithDrop<i32, i64>)) @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn <EnumWithDrop<i32, i64> as std::ops::Drop>::drop
let _ = match EnumWithDrop::A::<i32, i64>(0) {
EnumWithDrop::A(x) => x,
EnumWithDrop::B(x) => x as i32
};
//~MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<f64, f32>> @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0]<f64, f32>
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<EnumWithDrop<f64, f32>> - shim(Some(EnumWithDrop<f64, f32>)) @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn <EnumWithDrop<f64, f32> as std::ops::Drop>::drop
let _ = match EnumWithDrop::B::<f64, f32>(1.0) {
EnumWithDrop::A(x) => x,
EnumWithDrop::B(x) => x as f64

View file

@ -16,39 +16,39 @@ fn foo3<T1, T2, T3>(a: T1, b: T2, c: T3) -> (T1, T2, T3) {
}
// This function should be instantiated even if no used
//~ MONO_ITEM fn generic_functions::lifetime_only[0]
//~ MONO_ITEM fn lifetime_only
pub fn lifetime_only<'a>(a: &'a u32) -> &'a u32 {
a
}
//~ MONO_ITEM fn generic_functions::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
//~ MONO_ITEM fn generic_functions::foo1[0]<i32>
//~ MONO_ITEM fn foo1::<i32>
let _ = foo1(2i32);
//~ MONO_ITEM fn generic_functions::foo1[0]<i64>
//~ MONO_ITEM fn foo1::<i64>
let _ = foo1(2i64);
//~ MONO_ITEM fn generic_functions::foo1[0]<&str>
//~ MONO_ITEM fn foo1::<&str>
let _ = foo1("abc");
//~ MONO_ITEM fn generic_functions::foo1[0]<char>
//~ MONO_ITEM fn foo1::<char>
let _ = foo1('v');
//~ MONO_ITEM fn generic_functions::foo2[0]<i32, i32>
//~ MONO_ITEM fn foo2::<i32, i32>
let _ = foo2(2i32, 2i32);
//~ MONO_ITEM fn generic_functions::foo2[0]<i64, &str>
//~ MONO_ITEM fn foo2::<i64, &str>
let _ = foo2(2i64, "abc");
//~ MONO_ITEM fn generic_functions::foo2[0]<&str, usize>
//~ MONO_ITEM fn foo2::<&str, usize>
let _ = foo2("a", 2usize);
//~ MONO_ITEM fn generic_functions::foo2[0]<char, ()>
//~ MONO_ITEM fn foo2::<char, ()>
let _ = foo2('v', ());
//~ MONO_ITEM fn generic_functions::foo3[0]<i32, i32, i32>
//~ MONO_ITEM fn foo3::<i32, i32, i32>
let _ = foo3(2i32, 2i32, 2i32);
//~ MONO_ITEM fn generic_functions::foo3[0]<i64, &str, char>
//~ MONO_ITEM fn foo3::<i64, &str, char>
let _ = foo3(2i64, "abc", 'c');
//~ MONO_ITEM fn generic_functions::foo3[0]<i16, &str, usize>
//~ MONO_ITEM fn foo3::<i16, &str, usize>
let _ = foo3(0i16, "a", 2usize);
//~ MONO_ITEM fn generic_functions::foo3[0]<char, (), ()>
//~ MONO_ITEM fn foo3::<char, (), ()>
let _ = foo3('v', (), ());
0

View file

@ -30,41 +30,41 @@ pub struct LifeTimeOnly<'a> {
impl<'a> LifeTimeOnly<'a> {
//~ MONO_ITEM fn generic_impl::{{impl}}[1]::foo[0]
//~ MONO_ITEM fn LifeTimeOnly::foo
pub fn foo(&self) {}
//~ MONO_ITEM fn generic_impl::{{impl}}[1]::bar[0]
//~ MONO_ITEM fn LifeTimeOnly::bar
pub fn bar(&'a self) {}
//~ MONO_ITEM fn generic_impl::{{impl}}[1]::baz[0]
//~ MONO_ITEM fn LifeTimeOnly::baz
pub fn baz<'b>(&'b self) {}
pub fn non_instantiated<T>(&self) {}
}
//~ MONO_ITEM fn generic_impl::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
//~ MONO_ITEM fn generic_impl::{{impl}}[0]::new[0]<i32>
//~ MONO_ITEM fn generic_impl::id[0]<i32>
//~ MONO_ITEM fn generic_impl::{{impl}}[0]::get[0]<i32, i16>
//~ MONO_ITEM fn Struct::<i32>::new
//~ MONO_ITEM fn id::<i32>
//~ MONO_ITEM fn Struct::<i32>::get::<i16>
let _ = Struct::new(0i32).get(0i16);
//~ MONO_ITEM fn generic_impl::{{impl}}[0]::new[0]<i64>
//~ MONO_ITEM fn generic_impl::id[0]<i64>
//~ MONO_ITEM fn generic_impl::{{impl}}[0]::get[0]<i64, i16>
//~ MONO_ITEM fn Struct::<i64>::new
//~ MONO_ITEM fn id::<i64>
//~ MONO_ITEM fn Struct::<i64>::get::<i16>
let _ = Struct::new(0i64).get(0i16);
//~ MONO_ITEM fn generic_impl::{{impl}}[0]::new[0]<char>
//~ MONO_ITEM fn generic_impl::id[0]<char>
//~ MONO_ITEM fn generic_impl::{{impl}}[0]::get[0]<char, i16>
//~ MONO_ITEM fn Struct::<char>::new
//~ MONO_ITEM fn id::<char>
//~ MONO_ITEM fn Struct::<char>::get::<i16>
let _ = Struct::new('c').get(0i16);
//~ MONO_ITEM fn generic_impl::{{impl}}[0]::new[0]<&str>
//~ MONO_ITEM fn generic_impl::id[0]<&str>
//~ MONO_ITEM fn generic_impl::{{impl}}[0]::get[0]<generic_impl::Struct[0]<&str>, i16>
//~ MONO_ITEM fn Struct::<&str>::new
//~ MONO_ITEM fn id::<&str>
//~ MONO_ITEM fn Struct::<Struct<&str>>::get::<i16>
let _ = Struct::new(Struct::new("str")).get(0i16);
//~ MONO_ITEM fn generic_impl::{{impl}}[0]::new[0]<generic_impl::Struct[0]<&str>>
//~ MONO_ITEM fn generic_impl::id[0]<generic_impl::Struct[0]<&str>>
//~ MONO_ITEM fn Struct::<Struct<&str>>::new
//~ MONO_ITEM fn id::<Struct<&str>>
let _ = (Struct::new(Struct::new("str")).f)(Struct::new("str"));
0

View file

@ -11,14 +11,14 @@ trait SomeTrait {
// discovered.
pub fn generic_function<T>(x: T) -> (T, i32) {
impl SomeTrait for i64 {
//~ MONO_ITEM fn impl_in_non_instantiated_generic::generic_function[0]::{{impl}}[0]::foo[0]
//~ MONO_ITEM fn generic_function::<impl SomeTrait for i64>::foo
fn foo(&self) {}
}
(x, 0)
}
//~ MONO_ITEM fn impl_in_non_instantiated_generic::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
0i64.foo();

View file

@ -19,20 +19,20 @@ impl<T> Trait for Struct<T> {
fn bar(&self) {}
}
//~ MONO_ITEM fn instantiation_through_vtable::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
let s1 = Struct { _a: 0u32 };
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u32>> @@ instantiation_through_vtable-cgu.0[Internal]
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0]<u32>
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0]<u32>
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<Struct<u32>> - shim(None) @@ instantiation_through_vtable-cgu.0[Internal]
//~ MONO_ITEM fn <Struct<u32> as Trait>::foo
//~ MONO_ITEM fn <Struct<u32> as Trait>::bar
let _ = &s1 as &Trait;
let s1 = Struct { _a: 0u64 };
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u64>> @@ instantiation_through_vtable-cgu.0[Internal]
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0]<u64>
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0]<u64>
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<Struct<u64>> - shim(None) @@ instantiation_through_vtable-cgu.0[Internal]
//~ MONO_ITEM fn <Struct<u64> as Trait>::foo
//~ MONO_ITEM fn <Struct<u64> as Trait>::bar
let _ = &s1 as &Trait;
0

View file

@ -4,13 +4,13 @@
#![feature(start)]
fn generic_fn<T>(a: T) -> (T, i32) {
//~ MONO_ITEM fn items_within_generic_items::generic_fn[0]::nested_fn[0]
//~ MONO_ITEM fn generic_fn::nested_fn
fn nested_fn(a: i32) -> i32 {
a + 1
}
let x = {
//~ MONO_ITEM fn items_within_generic_items::generic_fn[0]::nested_fn[1]
//~ MONO_ITEM fn generic_fn::nested_fn
fn nested_fn(a: i32) -> i32 {
a + 2
}
@ -21,14 +21,14 @@ fn generic_fn<T>(a: T) -> (T, i32) {
return (a, x + nested_fn(0));
}
//~ MONO_ITEM fn items_within_generic_items::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
//~ MONO_ITEM fn items_within_generic_items::generic_fn[0]<i64>
//~ MONO_ITEM fn generic_fn::<i64>
let _ = generic_fn(0i64);
//~ MONO_ITEM fn items_within_generic_items::generic_fn[0]<u16>
//~ MONO_ITEM fn generic_fn::<u16>
let _ = generic_fn(0u16);
//~ MONO_ITEM fn items_within_generic_items::generic_fn[0]<i8>
//~ MONO_ITEM fn generic_fn::<i8>
let _ = generic_fn(0i8);
0

View file

@ -5,13 +5,13 @@
#![deny(dead_code)]
#![feature(start)]
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::StructWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<StructWithDrop> - shim(Some(StructWithDrop)) @@ non_generic_drop_glue-cgu.0[Internal]
struct StructWithDrop {
x: i32
}
impl Drop for StructWithDrop {
//~ MONO_ITEM fn non_generic_drop_glue::{{impl}}[0]::drop[0]
//~ MONO_ITEM fn <StructWithDrop as std::ops::Drop>::drop
fn drop(&mut self) {}
}
@ -19,13 +19,13 @@ struct StructNoDrop {
x: i32
}
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::EnumWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<EnumWithDrop> - shim(Some(EnumWithDrop)) @@ non_generic_drop_glue-cgu.0[Internal]
enum EnumWithDrop {
A(i32)
}
impl Drop for EnumWithDrop {
//~ MONO_ITEM fn non_generic_drop_glue::{{impl}}[1]::drop[0]
//~ MONO_ITEM fn <EnumWithDrop as std::ops::Drop>::drop
fn drop(&mut self) {}
}
@ -33,7 +33,7 @@ enum EnumNoDrop {
A(i32)
}
//~ MONO_ITEM fn non_generic_drop_glue::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
let _ = StructWithDrop { x: 0 }.x;

View file

@ -3,24 +3,24 @@
#![deny(dead_code)]
#![feature(start)]
//~ MONO_ITEM fn non_generic_functions::foo[0]
//~ MONO_ITEM fn foo
fn foo() {
{
//~ MONO_ITEM fn non_generic_functions::foo[0]::foo[0]
//~ MONO_ITEM fn foo::foo
fn foo() {}
foo();
}
{
//~ MONO_ITEM fn non_generic_functions::foo[0]::foo[1]
//~ MONO_ITEM fn foo::foo
fn foo() {}
foo();
}
}
//~ MONO_ITEM fn non_generic_functions::bar[0]
//~ MONO_ITEM fn bar
fn bar() {
//~ MONO_ITEM fn non_generic_functions::bar[0]::baz[0]
//~ MONO_ITEM fn bar::baz
fn baz() {}
baz();
}
@ -28,38 +28,38 @@ fn bar() {
struct Struct { _x: i32 }
impl Struct {
//~ MONO_ITEM fn non_generic_functions::{{impl}}[0]::foo[0]
//~ MONO_ITEM fn Struct::foo
fn foo() {
{
//~ MONO_ITEM fn non_generic_functions::{{impl}}[0]::foo[0]::foo[0]
//~ MONO_ITEM fn Struct::foo::foo
fn foo() {}
foo();
}
{
//~ MONO_ITEM fn non_generic_functions::{{impl}}[0]::foo[0]::foo[1]
//~ MONO_ITEM fn Struct::foo::foo
fn foo() {}
foo();
}
}
//~ MONO_ITEM fn non_generic_functions::{{impl}}[0]::bar[0]
//~ MONO_ITEM fn Struct::bar
fn bar(&self) {
{
//~ MONO_ITEM fn non_generic_functions::{{impl}}[0]::bar[0]::foo[0]
//~ MONO_ITEM fn Struct::bar::foo
fn foo() {}
foo();
}
{
//~ MONO_ITEM fn non_generic_functions::{{impl}}[0]::bar[0]::foo[1]
//~ MONO_ITEM fn Struct::bar::foo
fn foo() {}
foo();
}
}
}
//~ MONO_ITEM fn non_generic_functions::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
foo();

View file

@ -12,7 +12,7 @@ pub struct Indexable {
impl Index<usize> for Indexable {
type Output = u8;
//~ MONO_ITEM fn overloaded_operators::{{impl}}[0]::index[0]
//~ MONO_ITEM fn <Indexable as std::ops::Index<usize>>::index
fn index(&self, index: usize) -> &Self::Output {
if index >= 3 {
&self.data[0]
@ -23,7 +23,7 @@ impl Index<usize> for Indexable {
}
impl IndexMut<usize> for Indexable {
//~ MONO_ITEM fn overloaded_operators::{{impl}}[1]::index_mut[0]
//~ MONO_ITEM fn <Indexable as std::ops::IndexMut<usize>>::index_mut
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
if index >= 3 {
&mut self.data[0]
@ -34,8 +34,8 @@ impl IndexMut<usize> for Indexable {
}
//~ MONO_ITEM fn overloaded_operators::{{impl}}[5]::eq[0]
//~ MONO_ITEM fn overloaded_operators::{{impl}}[5]::ne[0]
//~ MONO_ITEM fn <Equatable as std::cmp::PartialEq>::eq
//~ MONO_ITEM fn <Equatable as std::cmp::PartialEq>::ne
#[derive(PartialEq)]
pub struct Equatable(u32);
@ -43,7 +43,7 @@ pub struct Equatable(u32);
impl Add<u32> for Equatable {
type Output = u32;
//~ MONO_ITEM fn overloaded_operators::{{impl}}[2]::add[0]
//~ MONO_ITEM fn <Equatable as std::ops::Add<u32>>::add
fn add(self, rhs: u32) -> u32 {
self.0 + rhs
}
@ -52,7 +52,7 @@ impl Add<u32> for Equatable {
impl Deref for Equatable {
type Target = u32;
//~ MONO_ITEM fn overloaded_operators::{{impl}}[3]::deref[0]
//~ MONO_ITEM fn <Equatable as std::ops::Deref>::deref
fn deref(&self) -> &Self::Target {
&self.0
}

View file

@ -6,10 +6,10 @@ pub static FN : fn() = foo::<i32>;
pub fn foo<T>() { }
//~ MONO_ITEM fn static_init::foo[0]<T>
//~ MONO_ITEM static static_init::FN[0]
//~ MONO_ITEM fn foo::<T>
//~ MONO_ITEM static FN
//~ MONO_ITEM fn static_init::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
0

View file

@ -37,7 +37,7 @@ fn foo() {
};
}
//~ MONO_ITEM fn statics_and_consts::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
foo();
@ -46,9 +46,9 @@ fn start(_: isize, _: *const *const u8) -> isize {
0
}
//~ MONO_ITEM static statics_and_consts::STATIC1[0]
//~ MONO_ITEM static STATIC1
//~ MONO_ITEM fn statics_and_consts::foo[0]
//~ MONO_ITEM static statics_and_consts::foo[0]::STATIC2[0]
//~ MONO_ITEM static statics_and_consts::foo[0]::STATIC2[1]
//~ MONO_ITEM static statics_and_consts::foo[0]::STATIC2[2]
//~ MONO_ITEM fn foo
//~ MONO_ITEM static foo::STATIC2
//~ MONO_ITEM static foo::STATIC2
//~ MONO_ITEM static foo::STATIC2

View file

@ -10,7 +10,7 @@ pub trait SomeTrait {
impl SomeTrait for i64 {
//~ MONO_ITEM fn trait_implementations::{{impl}}[0]::foo[0]
//~ MONO_ITEM fn <i64 as SomeTrait>::foo
fn foo(&self) {}
fn bar<T>(&self, _: T) {}
@ -18,7 +18,7 @@ impl SomeTrait for i64 {
impl SomeTrait for i32 {
//~ MONO_ITEM fn trait_implementations::{{impl}}[1]::foo[0]
//~ MONO_ITEM fn <i32 as SomeTrait>::foo
fn foo(&self) {}
fn bar<T>(&self, _: T) {}
@ -32,7 +32,7 @@ pub trait SomeGenericTrait<T> {
// Concrete impl of generic trait
impl SomeGenericTrait<u32> for f64 {
//~ MONO_ITEM fn trait_implementations::{{impl}}[2]::foo[0]
//~ MONO_ITEM fn <f64 as SomeGenericTrait<u32>>::foo
fn foo(&self, _: u32) {}
fn bar<T2>(&self, _: u32, _: T2) {}
@ -45,28 +45,28 @@ impl<T> SomeGenericTrait<T> for f32 {
fn bar<T2>(&self, _: T, _: T2) {}
}
//~ MONO_ITEM fn trait_implementations::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
//~ MONO_ITEM fn trait_implementations::{{impl}}[1]::bar[0]<char>
//~ MONO_ITEM fn <i32 as SomeTrait>::bar::<char>
0i32.bar('x');
//~ MONO_ITEM fn trait_implementations::{{impl}}[2]::bar[0]<&str>
//~ MONO_ITEM fn <f64 as SomeGenericTrait<u32>>::bar::<&str>
0f64.bar(0u32, "&str");
//~ MONO_ITEM fn trait_implementations::{{impl}}[2]::bar[0]<()>
//~ MONO_ITEM fn <f64 as SomeGenericTrait<u32>>::bar::<()>
0f64.bar(0u32, ());
//~ MONO_ITEM fn trait_implementations::{{impl}}[3]::foo[0]<char>
//~ MONO_ITEM fn <f32 as SomeGenericTrait<char>>::foo
0f32.foo('x');
//~ MONO_ITEM fn trait_implementations::{{impl}}[3]::foo[0]<i64>
//~ MONO_ITEM fn <f32 as SomeGenericTrait<i64>>::foo
0f32.foo(-1i64);
//~ MONO_ITEM fn trait_implementations::{{impl}}[3]::bar[0]<u32, ()>
//~ MONO_ITEM fn <f32 as SomeGenericTrait<u32>>::bar::<()>
0f32.bar(0u32, ());
//~ MONO_ITEM fn trait_implementations::{{impl}}[3]::bar[0]<&str, &str>
//~ MONO_ITEM fn <f32 as SomeGenericTrait<&str>>::bar::<&str>
0f32.bar("&str", "&str");
0

View file

@ -1,3 +1,4 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager
#![deny(dead_code)]
@ -26,33 +27,33 @@ fn take_foo_mut<T, F: FnMut(T) -> T>(mut f: F, arg: T) -> T {
(f)(arg)
}
//~ MONO_ITEM fn trait_method_as_argument::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
//~ MONO_ITEM fn trait_method_as_argument::take_foo_once[0]<u32, fn(u32) -> u32>
//~ MONO_ITEM fn trait_method_as_argument::{{impl}}[0]::foo[0]
//~ MONO_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0]<fn(u32) -> u32, (u32)>
//~ MONO_ITEM fn take_foo_once::<u32, fn(u32) -> u32 {<u32 as Trait>::foo}>
//~ MONO_ITEM fn <u32 as Trait>::foo
//~ MONO_ITEM fn <fn(u32) -> u32 {<u32 as Trait>::foo} as std::ops::FnOnce<(u32,)>>::call_once - shim(fn(u32) -> u32 {<u32 as Trait>::foo})
take_foo_once(Trait::foo, 0u32);
//~ MONO_ITEM fn trait_method_as_argument::take_foo_once[0]<char, fn(char) -> char>
//~ MONO_ITEM fn trait_method_as_argument::Trait[0]::foo[0]<char>
//~ MONO_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0]<fn(char) -> char, (char)>
//~ MONO_ITEM fn take_foo_once::<char, fn(char) -> char {<char as Trait>::foo}>
//~ MONO_ITEM fn <char as Trait>::foo
//~ MONO_ITEM fn <fn(char) -> char {<char as Trait>::foo} as std::ops::FnOnce<(char,)>>::call_once - shim(fn(char) -> char {<char as Trait>::foo})
take_foo_once(Trait::foo, 'c');
//~ MONO_ITEM fn trait_method_as_argument::take_foo[0]<u32, fn(u32) -> u32>
//~ MONO_ITEM fn core::ops[0]::function[0]::Fn[0]::call[0]<fn(u32) -> u32, (u32)>
//~ MONO_ITEM fn take_foo::<u32, fn(u32) -> u32 {<u32 as Trait>::foo}>
//~ MONO_ITEM fn <fn(u32) -> u32 {<u32 as Trait>::foo} as std::ops::Fn<(u32,)>>::call - shim(fn(u32) -> u32 {<u32 as Trait>::foo})
take_foo(Trait::foo, 0u32);
//~ MONO_ITEM fn trait_method_as_argument::take_foo[0]<char, fn(char) -> char>
//~ MONO_ITEM fn core::ops[0]::function[0]::Fn[0]::call[0]<fn(char) -> char, (char)>
//~ MONO_ITEM fn take_foo::<char, fn(char) -> char {<char as Trait>::foo}>
//~ MONO_ITEM fn <fn(char) -> char {<char as Trait>::foo} as std::ops::Fn<(char,)>>::call - shim(fn(char) -> char {<char as Trait>::foo})
take_foo(Trait::foo, 'c');
//~ MONO_ITEM fn trait_method_as_argument::take_foo_mut[0]<u32, fn(u32) -> u32>
//~ MONO_ITEM fn core::ops[0]::function[0]::FnMut[0]::call_mut[0]<fn(char) -> char, (char)>
//~ MONO_ITEM fn take_foo_mut::<u32, fn(u32) -> u32 {<u32 as Trait>::foo}>
//~ MONO_ITEM fn <fn(u32) -> u32 {<u32 as Trait>::foo} as std::ops::FnMut<(u32,)>>::call_mut - shim(fn(u32) -> u32 {<u32 as Trait>::foo})
take_foo_mut(Trait::foo, 0u32);
//~ MONO_ITEM fn trait_method_as_argument::take_foo_mut[0]<char, fn(char) -> char>
//~ MONO_ITEM fn core::ops[0]::function[0]::FnMut[0]::call_mut[0]<fn(u32) -> u32, (u32)>
//~ MONO_ITEM fn take_foo_mut::<char, fn(char) -> char {<char as Trait>::foo}>
//~ MONO_ITEM fn <fn(char) -> char {<char as Trait>::foo} as std::ops::FnMut<(char,)>>::call_mut - shim(fn(char) -> char {<char as Trait>::foo})
take_foo_mut(Trait::foo, 'c');
0

View file

@ -13,7 +13,7 @@ impl SomeTrait for i8 {
// For the non-generic foo(), we should generate a codegen-item even if it
// is not called anywhere
//~ MONO_ITEM fn trait_method_default_impl::SomeTrait[0]::foo[0]<i8>
//~ MONO_ITEM fn <i8 as SomeTrait>::foo
}
trait SomeGenericTrait<T1> {
@ -27,7 +27,7 @@ impl SomeGenericTrait<u64> for i32 {
// For the non-generic foo(), we should generate a codegen-item even if it
// is not called anywhere
//~ MONO_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::foo[0]<i32, T1>
//~ MONO_ITEM fn <i32 as SomeGenericTrait<T1>>::foo
}
// Non-generic impl of generic trait
@ -36,25 +36,25 @@ impl<T1> SomeGenericTrait<T1> for u32 {
// since nothing is monomorphic here, nothing should be generated unless used somewhere.
}
//~ MONO_ITEM fn trait_method_default_impl::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
//~ MONO_ITEM fn trait_method_default_impl::SomeTrait[0]::bar[0]<i8, char>
//~ MONO_ITEM fn <i8 as SomeTrait>::bar::<char>
let _ = 1i8.bar('c');
//~ MONO_ITEM fn trait_method_default_impl::SomeTrait[0]::bar[0]<i8, &str>
//~ MONO_ITEM fn <i8 as SomeTrait>::bar::<&str>
let _ = 2i8.bar("&str");
//~ MONO_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0]<i32, u64, char>
//~ MONO_ITEM fn <i32 as SomeGenericTrait<u64>>::bar::<char>
0i32.bar(0u64, 'c');
//~ MONO_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0]<i32, u64, &str>
//~ MONO_ITEM fn <i32 as SomeGenericTrait<u64>>::bar::<&str>
0i32.bar(0u64, "&str");
//~ MONO_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0]<u32, i8, &[char; 1]>
//~ MONO_ITEM fn <u32 as SomeGenericTrait<i8>>::bar::<&[char; 1]>
0u32.bar(0i8, &['c']);
//~ MONO_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0]<u32, i16, ()>
//~ MONO_ITEM fn <u32 as SomeGenericTrait<i16>>::bar::<()>
0u32.bar(0i16, ());
0

View file

@ -5,15 +5,15 @@
#![deny(dead_code)]
#![feature(start)]
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Root[0]> @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<Root> - shim(Some(Root)) @@ transitive_drop_glue-cgu.0[Internal]
struct Root(Intermediate);
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Intermediate[0]> @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<Intermediate> - shim(Some(Intermediate)) @@ transitive_drop_glue-cgu.0[Internal]
struct Intermediate(Leaf);
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Leaf[0]> @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<Leaf> - shim(Some(Leaf)) @@ transitive_drop_glue-cgu.0[Internal]
struct Leaf;
impl Drop for Leaf {
//~ MONO_ITEM fn transitive_drop_glue::{{impl}}[0]::drop[0]
//~ MONO_ITEM fn <Leaf as std::ops::Drop>::drop
fn drop(&mut self) {}
}
@ -25,21 +25,21 @@ impl<T> Drop for LeafGen<T> {
fn drop(&mut self) {}
}
//~ MONO_ITEM fn transitive_drop_glue::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
let _ = Root(Intermediate(Leaf));
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0]<u32>
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<RootGen<u32>> - shim(Some(RootGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<IntermediateGen<u32>> - shim(Some(IntermediateGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<LeafGen<u32>> - shim(Some(LeafGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn <LeafGen<u32> as std::ops::Drop>::drop
let _ = RootGen(IntermediateGen(LeafGen(0u32)));
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0]<i16>
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<RootGen<i16>> - shim(Some(RootGen<i16>)) @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<IntermediateGen<i16>> - shim(Some(IntermediateGen<i16>)) @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<LeafGen<i16>> - shim(Some(LeafGen<i16>)) @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn <LeafGen<i16> as std::ops::Drop>::drop
let _ = RootGen(IntermediateGen(LeafGen(0i16)));
0

View file

@ -5,22 +5,22 @@
#![deny(dead_code)]
#![feature(start)]
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<tuple_drop_glue::Dropped[0]> @@ tuple_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<Dropped> - shim(Some(Dropped)) @@ tuple_drop_glue-cgu.0[Internal]
struct Dropped;
impl Drop for Dropped {
//~ MONO_ITEM fn tuple_drop_glue::{{impl}}[0]::drop[0]
//~ MONO_ITEM fn <Dropped as std::ops::Drop>::drop
fn drop(&mut self) {}
}
//~ MONO_ITEM fn tuple_drop_glue::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<(u32, Dropped)> - shim(Some((u32, Dropped))) @@ tuple_drop_glue-cgu.0[Internal]
let x = (0u32, Dropped);
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<(i16, (Dropped, bool))> - shim(Some((i16, (Dropped, bool)))) @@ tuple_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<(Dropped, bool)> - shim(Some((Dropped, bool))) @@ tuple_drop_glue-cgu.0[Internal]
let x = (0i16, (Dropped, true));
0

View file

@ -3,7 +3,7 @@
#![deny(dead_code)]
#![crate_type = "rlib"]
//~ MONO_ITEM fn unreferenced_const_fn::foo[0] @@ unreferenced_const_fn-cgu.0[External]
//~ MONO_ITEM fn foo @@ unreferenced_const_fn-cgu.0[External]
pub const fn foo(x: u32) -> u32 {
x + 0xf00
}

View file

@ -43,19 +43,19 @@ struct Wrapper<T: ?Sized>(*const T);
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Wrapper<U>> for Wrapper<T> {}
//~ MONO_ITEM fn unsizing::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
// simple case
let bool_sized = &true;
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<bool> @@ unsizing-cgu.0[Internal]
//~ MONO_ITEM fn unsizing::{{impl}}[0]::foo[0]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<bool> - shim(None) @@ unsizing-cgu.0[Internal]
//~ MONO_ITEM fn <bool as Trait>::foo
let _bool_unsized = bool_sized as &Trait;
let char_sized = &'a';
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<char> @@ unsizing-cgu.0[Internal]
//~ MONO_ITEM fn unsizing::{{impl}}[1]::foo[0]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<char> - shim(None) @@ unsizing-cgu.0[Internal]
//~ MONO_ITEM fn <char as Trait>::foo
let _char_unsized = char_sized as &Trait;
// struct field
@ -64,14 +64,14 @@ fn start(_: isize, _: *const *const u8) -> isize {
_b: 2,
_c: 3.0f64
};
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<f64> @@ unsizing-cgu.0[Internal]
//~ MONO_ITEM fn unsizing::{{impl}}[2]::foo[0]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<f64> - shim(None) @@ unsizing-cgu.0[Internal]
//~ MONO_ITEM fn <f64 as Trait>::foo
let _struct_unsized = struct_sized as &Struct<Trait>;
// custom coercion
let wrapper_sized = Wrapper(&0u32);
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<u32> @@ unsizing-cgu.0[Internal]
//~ MONO_ITEM fn unsizing::{{impl}}[3]::foo[0]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<u32> - shim(None) @@ unsizing-cgu.0[Internal]
//~ MONO_ITEM fn <u32 as Trait>::foo
let _wrapper_sized = wrapper_sized as Wrapper<Trait>;
0

View file

@ -74,4 +74,4 @@ impl NonGeneric {
}
// Only the non-generic methods should be instantiated:
//~ MONO_ITEM fn unused_traits_and_generics::{{impl}}[3]::foo[0]
//~ MONO_ITEM fn NonGeneric::foo

View file

@ -12,13 +12,13 @@
// aux-build:cgu_extern_drop_glue.rs
extern crate cgu_extern_drop_glue;
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<cgu_extern_drop_glue::Struct[0]> @@ extern_drop_glue-fallback.cgu[External]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<cgu_extern_drop_glue::Struct> - shim(Some(cgu_extern_drop_glue::Struct)) @@ extern_drop_glue-fallback.cgu[External]
struct LocalStruct(cgu_extern_drop_glue::Struct);
//~ MONO_ITEM fn extern_drop_glue::user[0] @@ extern_drop_glue[External]
//~ MONO_ITEM fn user @@ extern_drop_glue[External]
pub fn user() {
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<extern_drop_glue::LocalStruct[0]> @@ extern_drop_glue-fallback.cgu[External]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<LocalStruct> - shim(Some(LocalStruct)) @@ extern_drop_glue-fallback.cgu[External]
let _ = LocalStruct(cgu_extern_drop_glue::Struct(0));
}
@ -27,9 +27,9 @@ pub mod mod1 {
struct LocalStruct(cgu_extern_drop_glue::Struct);
//~ MONO_ITEM fn extern_drop_glue::mod1[0]::user[0] @@ extern_drop_glue-mod1[External]
//~ MONO_ITEM fn mod1::user @@ extern_drop_glue-mod1[External]
pub fn user() {
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<extern_drop_glue::mod1[0]::LocalStruct[0]> @@ extern_drop_glue-fallback.cgu[External]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<mod1::LocalStruct> - shim(Some(mod1::LocalStruct)) @@ extern_drop_glue-fallback.cgu[External]
let _ = LocalStruct(cgu_extern_drop_glue::Struct(0));
}
}

View file

@ -9,7 +9,7 @@
// aux-build:cgu_generic_function.rs
extern crate cgu_generic_function;
//~ MONO_ITEM fn extern_generic::user[0] @@ extern_generic[Internal]
//~ MONO_ITEM fn user @@ extern_generic[Internal]
fn user() {
let _ = cgu_generic_function::foo("abc");
}
@ -17,7 +17,7 @@ fn user() {
mod mod1 {
use cgu_generic_function;
//~ MONO_ITEM fn extern_generic::mod1[0]::user[0] @@ extern_generic-mod1[Internal]
//~ MONO_ITEM fn mod1::user @@ extern_generic-mod1[Internal]
fn user() {
let _ = cgu_generic_function::foo("abc");
}
@ -25,7 +25,7 @@ mod mod1 {
mod mod1 {
use cgu_generic_function;
//~ MONO_ITEM fn extern_generic::mod1[0]::mod1[0]::user[0] @@ extern_generic-mod1-mod1[Internal]
//~ MONO_ITEM fn mod1::mod1::user @@ extern_generic-mod1-mod1[Internal]
fn user() {
let _ = cgu_generic_function::foo("abc");
}
@ -35,18 +35,18 @@ mod mod1 {
mod mod2 {
use cgu_generic_function;
//~ MONO_ITEM fn extern_generic::mod2[0]::user[0] @@ extern_generic-mod2[Internal]
//~ MONO_ITEM fn mod2::user @@ extern_generic-mod2[Internal]
fn user() {
let _ = cgu_generic_function::foo("abc");
}
}
mod mod3 {
//~ MONO_ITEM fn extern_generic::mod3[0]::non_user[0] @@ extern_generic-mod3[Internal]
//~ MONO_ITEM fn mod3::non_user @@ extern_generic-mod3[Internal]
fn non_user() {}
}
// Make sure the two generic functions from the extern crate get instantiated
// once for the current crate
//~ MONO_ITEM fn cgu_generic_function::foo[0]<&str> @@ cgu_generic_function-in-extern_generic.volatile[External]
//~ MONO_ITEM fn cgu_generic_function::bar[0]<&str> @@ cgu_generic_function-in-extern_generic.volatile[External]
//~ MONO_ITEM fn cgu_generic_function::foo::<&str> @@ cgu_generic_function-in-extern_generic.volatile[External]
//~ MONO_ITEM fn cgu_generic_function::bar::<&str> @@ cgu_generic_function-in-extern_generic.volatile[External]

View file

@ -1,4 +1,3 @@
// ignore-tidy-linelength
// We specify -C incremental here because we want to test the partitioning for
// incremental compilation
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/incremental-merging
@ -14,28 +13,28 @@
// while `ccc` and `ddd` are supposed to stay untouched.
pub mod aaa {
//~ MONO_ITEM fn incremental_merging::aaa[0]::foo[0] @@ incremental_merging-aaa--incremental_merging-bbb[External]
//~ MONO_ITEM fn aaa::foo @@ incremental_merging-aaa--incremental_merging-bbb[External]
pub fn foo(a: u64) -> u64 {
a + 1
}
}
pub mod bbb {
//~ MONO_ITEM fn incremental_merging::bbb[0]::foo[0] @@ incremental_merging-aaa--incremental_merging-bbb[External]
//~ MONO_ITEM fn bbb::foo @@ incremental_merging-aaa--incremental_merging-bbb[External]
pub fn foo(a: u64, b: u64) -> u64 {
a + b + 1
}
}
pub mod ccc {
//~ MONO_ITEM fn incremental_merging::ccc[0]::foo[0] @@ incremental_merging-ccc[External]
//~ MONO_ITEM fn ccc::foo @@ incremental_merging-ccc[External]
pub fn foo(a: u64, b: u64, c: u64) -> u64 {
a + b + c + 1
}
}
pub mod ddd {
//~ MONO_ITEM fn incremental_merging::ddd[0]::foo[0] @@ incremental_merging-ddd[External]
//~ MONO_ITEM fn ddd::foo @@ incremental_merging-ddd[External]
pub fn foo(a: u64, b: u64, c: u64, d: u64) -> u64 {
a + b + c + d + 1
}

View file

@ -12,10 +12,10 @@ extern crate cgu_explicit_inlining;
// This test makes sure that items inlined from external crates are privately
// instantiated in every codegen unit they are used in.
//~ MONO_ITEM fn cgu_explicit_inlining::inlined[0] @@ inlining_from_extern_crate[Internal] inlining_from_extern_crate-mod1[Internal]
//~ MONO_ITEM fn cgu_explicit_inlining::always_inlined[0] @@ inlining_from_extern_crate[Internal] inlining_from_extern_crate-mod2[Internal]
//~ MONO_ITEM fn cgu_explicit_inlining::inlined @@ inlining_from_extern_crate[Internal] inlining_from_extern_crate-mod1[Internal]
//~ MONO_ITEM fn cgu_explicit_inlining::always_inlined @@ inlining_from_extern_crate[Internal] inlining_from_extern_crate-mod2[Internal]
//~ MONO_ITEM fn inlining_from_extern_crate::user[0] @@ inlining_from_extern_crate[External]
//~ MONO_ITEM fn user @@ inlining_from_extern_crate[External]
pub fn user()
{
cgu_explicit_inlining::inlined();
@ -28,7 +28,7 @@ pub fn user()
pub mod mod1 {
use cgu_explicit_inlining;
//~ MONO_ITEM fn inlining_from_extern_crate::mod1[0]::user[0] @@ inlining_from_extern_crate-mod1[External]
//~ MONO_ITEM fn mod1::user @@ inlining_from_extern_crate-mod1[External]
pub fn user()
{
cgu_explicit_inlining::inlined();
@ -41,7 +41,7 @@ pub mod mod1 {
pub mod mod2 {
use cgu_explicit_inlining;
//~ MONO_ITEM fn inlining_from_extern_crate::mod2[0]::user[0] @@ inlining_from_extern_crate-mod2[External]
//~ MONO_ITEM fn mod2::user @@ inlining_from_extern_crate-mod2[External]
pub fn user()
{
cgu_explicit_inlining::always_inlined();

View file

@ -8,22 +8,22 @@
#![allow(dead_code)]
#![crate_type = "rlib"]
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<local_drop_glue::Struct[0]> @@ local_drop_glue-fallback.cgu[External]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<Struct> - shim(Some(Struct)) @@ local_drop_glue-fallback.cgu[External]
struct Struct {
_a: u32,
}
impl Drop for Struct {
//~ MONO_ITEM fn local_drop_glue::{{impl}}[0]::drop[0] @@ local_drop_glue-fallback.cgu[External]
//~ MONO_ITEM fn <Struct as std::ops::Drop>::drop @@ local_drop_glue-fallback.cgu[External]
fn drop(&mut self) {}
}
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<local_drop_glue::Outer[0]> @@ local_drop_glue-fallback.cgu[External]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<Outer> - shim(Some(Outer)) @@ local_drop_glue-fallback.cgu[External]
struct Outer {
_a: Struct,
}
//~ MONO_ITEM fn local_drop_glue::user[0] @@ local_drop_glue[External]
//~ MONO_ITEM fn user @@ local_drop_glue[External]
pub fn user() {
let _ = Outer { _a: Struct { _a: 0 } };
}
@ -31,14 +31,14 @@ pub fn user() {
pub mod mod1 {
use super::Struct;
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<local_drop_glue::mod1[0]::Struct2[0]> @@ local_drop_glue-fallback.cgu[External]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<mod1::Struct2> - shim(Some(mod1::Struct2)) @@ local_drop_glue-fallback.cgu[External]
struct Struct2 {
_a: Struct,
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, local_drop_glue::Struct[0])> @@ local_drop_glue-fallback.cgu[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<(u32, Struct)> - shim(Some((u32, Struct))) @@ local_drop_glue-fallback.cgu[Internal]
_b: (u32, Struct),
}
//~ MONO_ITEM fn local_drop_glue::mod1[0]::user[0] @@ local_drop_glue-mod1[External]
//~ MONO_ITEM fn mod1::user @@ local_drop_glue-mod1[External]
pub fn user() {
let _ = Struct2 { _a: Struct { _a: 0 }, _b: (0, Struct { _a: 0 }) };
}

View file

@ -1,4 +1,3 @@
// ignore-tidy-linelength
// We specify -C incremental here because we want to test the partitioning for
// incremental compilation
// compile-flags:-Zprint-mono-items=eager -Cincremental=tmp/partitioning-tests/local-generic
@ -6,13 +5,13 @@
#![allow(dead_code)]
#![crate_type="lib"]
//~ MONO_ITEM fn local_generic::generic[0]<u32> @@ local_generic.volatile[External]
//~ MONO_ITEM fn local_generic::generic[0]<u64> @@ local_generic.volatile[External]
//~ MONO_ITEM fn local_generic::generic[0]<char> @@ local_generic.volatile[External]
//~ MONO_ITEM fn local_generic::generic[0]<&str> @@ local_generic.volatile[External]
//~ MONO_ITEM fn generic::<u32> @@ local_generic.volatile[External]
//~ MONO_ITEM fn generic::<u64> @@ local_generic.volatile[External]
//~ MONO_ITEM fn generic::<char> @@ local_generic.volatile[External]
//~ MONO_ITEM fn generic::<&str> @@ local_generic.volatile[External]
pub fn generic<T>(x: T) -> T { x }
//~ MONO_ITEM fn local_generic::user[0] @@ local_generic[Internal]
//~ MONO_ITEM fn user @@ local_generic[Internal]
fn user() {
let _ = generic(0u32);
}
@ -20,7 +19,7 @@ fn user() {
mod mod1 {
pub use super::generic;
//~ MONO_ITEM fn local_generic::mod1[0]::user[0] @@ local_generic-mod1[Internal]
//~ MONO_ITEM fn mod1::user @@ local_generic-mod1[Internal]
fn user() {
let _ = generic(0u64);
}
@ -28,7 +27,7 @@ mod mod1 {
mod mod1 {
use super::generic;
//~ MONO_ITEM fn local_generic::mod1[0]::mod1[0]::user[0] @@ local_generic-mod1-mod1[Internal]
//~ MONO_ITEM fn mod1::mod1::user @@ local_generic-mod1-mod1[Internal]
fn user() {
let _ = generic('c');
}
@ -38,7 +37,7 @@ mod mod1 {
mod mod2 {
use super::generic;
//~ MONO_ITEM fn local_generic::mod2[0]::user[0] @@ local_generic-mod2[Internal]
//~ MONO_ITEM fn mod2::user @@ local_generic-mod2[Internal]
fn user() {
let _ = generic("abc");
}

View file

@ -9,7 +9,7 @@
mod inline {
//~ MONO_ITEM fn local_inlining_but_not_all::inline[0]::inlined_function[0] @@ local_inlining_but_not_all-inline[External]
//~ MONO_ITEM fn inline::inlined_function @@ local_inlining_but_not_all-inline[External]
#[inline]
pub fn inlined_function()
{
@ -20,7 +20,7 @@ mod inline {
pub mod user1 {
use super::inline;
//~ MONO_ITEM fn local_inlining_but_not_all::user1[0]::foo[0] @@ local_inlining_but_not_all-user1[External]
//~ MONO_ITEM fn user1::foo @@ local_inlining_but_not_all-user1[External]
pub fn foo() {
inline::inlined_function();
}
@ -29,7 +29,7 @@ pub mod user1 {
pub mod user2 {
use super::inline;
//~ MONO_ITEM fn local_inlining_but_not_all::user2[0]::bar[0] @@ local_inlining_but_not_all-user2[External]
//~ MONO_ITEM fn user2::bar @@ local_inlining_but_not_all-user2[External]
pub fn bar() {
inline::inlined_function();
}
@ -37,7 +37,7 @@ pub mod user2 {
pub mod non_user {
//~ MONO_ITEM fn local_inlining_but_not_all::non_user[0]::baz[0] @@ local_inlining_but_not_all-non_user[External]
//~ MONO_ITEM fn non_user::baz @@ local_inlining_but_not_all-non_user[External]
pub fn baz() {
}

View file

@ -10,7 +10,7 @@
mod inline {
// Important: This function should show up in all codegen units where it is inlined
//~ MONO_ITEM fn local_inlining::inline[0]::inlined_function[0] @@ local_inlining-user1[Internal] local_inlining-user2[Internal]
//~ MONO_ITEM fn inline::inlined_function @@ local_inlining-user1[Internal] local_inlining-user2[Internal]
#[inline(always)]
pub fn inlined_function()
{
@ -21,7 +21,7 @@ mod inline {
pub mod user1 {
use super::inline;
//~ MONO_ITEM fn local_inlining::user1[0]::foo[0] @@ local_inlining-user1[External]
//~ MONO_ITEM fn user1::foo @@ local_inlining-user1[External]
pub fn foo() {
inline::inlined_function();
}
@ -30,7 +30,7 @@ pub mod user1 {
pub mod user2 {
use super::inline;
//~ MONO_ITEM fn local_inlining::user2[0]::bar[0] @@ local_inlining-user2[External]
//~ MONO_ITEM fn user2::bar @@ local_inlining-user2[External]
pub fn bar() {
inline::inlined_function();
}
@ -38,7 +38,7 @@ pub mod user2 {
pub mod non_user {
//~ MONO_ITEM fn local_inlining::non_user[0]::baz[0] @@ local_inlining-non_user[External]
//~ MONO_ITEM fn non_user::baz @@ local_inlining-non_user[External]
pub fn baz() {
}

View file

@ -9,7 +9,7 @@
mod inline {
//~ MONO_ITEM fn local_transitive_inlining::inline[0]::inlined_function[0] @@ local_transitive_inlining-indirect_user[Internal]
//~ MONO_ITEM fn inline::inlined_function @@ local_transitive_inlining-indirect_user[Internal]
#[inline(always)]
pub fn inlined_function()
{
@ -20,7 +20,7 @@ mod inline {
mod direct_user {
use super::inline;
//~ MONO_ITEM fn local_transitive_inlining::direct_user[0]::foo[0] @@ local_transitive_inlining-indirect_user[Internal]
//~ MONO_ITEM fn direct_user::foo @@ local_transitive_inlining-indirect_user[Internal]
#[inline(always)]
pub fn foo() {
inline::inlined_function();
@ -30,7 +30,7 @@ mod direct_user {
pub mod indirect_user {
use super::direct_user;
//~ MONO_ITEM fn local_transitive_inlining::indirect_user[0]::bar[0] @@ local_transitive_inlining-indirect_user[External]
//~ MONO_ITEM fn indirect_user::bar @@ local_transitive_inlining-indirect_user[External]
pub fn bar() {
direct_user::foo();
}
@ -38,7 +38,7 @@ pub mod indirect_user {
pub mod non_user {
//~ MONO_ITEM fn local_transitive_inlining::non_user[0]::baz[0] @@ local_transitive_inlining-non_user[External]
//~ MONO_ITEM fn non_user::baz @@ local_transitive_inlining-non_user[External]
pub fn baz() {
}

View file

@ -1,4 +1,3 @@
// ignore-tidy-linelength
// We specify -C incremental here because we want to test the partitioning for
// incremental compilation
// compile-flags:-Zprint-mono-items=eager -Cincremental=tmp/partitioning-tests/regular-modules
@ -6,67 +5,67 @@
#![allow(dead_code)]
#![crate_type="lib"]
//~ MONO_ITEM fn regular_modules::foo[0] @@ regular_modules[Internal]
//~ MONO_ITEM fn foo @@ regular_modules[Internal]
fn foo() {}
//~ MONO_ITEM fn regular_modules::bar[0] @@ regular_modules[Internal]
//~ MONO_ITEM fn bar @@ regular_modules[Internal]
fn bar() {}
//~ MONO_ITEM static regular_modules::BAZ[0] @@ regular_modules[Internal]
//~ MONO_ITEM static BAZ @@ regular_modules[Internal]
static BAZ: u64 = 0;
mod mod1 {
//~ MONO_ITEM fn regular_modules::mod1[0]::foo[0] @@ regular_modules-mod1[Internal]
//~ MONO_ITEM fn mod1::foo @@ regular_modules-mod1[Internal]
fn foo() {}
//~ MONO_ITEM fn regular_modules::mod1[0]::bar[0] @@ regular_modules-mod1[Internal]
//~ MONO_ITEM fn mod1::bar @@ regular_modules-mod1[Internal]
fn bar() {}
//~ MONO_ITEM static regular_modules::mod1[0]::BAZ[0] @@ regular_modules-mod1[Internal]
//~ MONO_ITEM static mod1::BAZ @@ regular_modules-mod1[Internal]
static BAZ: u64 = 0;
mod mod1 {
//~ MONO_ITEM fn regular_modules::mod1[0]::mod1[0]::foo[0] @@ regular_modules-mod1-mod1[Internal]
//~ MONO_ITEM fn mod1::mod1::foo @@ regular_modules-mod1-mod1[Internal]
fn foo() {}
//~ MONO_ITEM fn regular_modules::mod1[0]::mod1[0]::bar[0] @@ regular_modules-mod1-mod1[Internal]
//~ MONO_ITEM fn mod1::mod1::bar @@ regular_modules-mod1-mod1[Internal]
fn bar() {}
//~ MONO_ITEM static regular_modules::mod1[0]::mod1[0]::BAZ[0] @@ regular_modules-mod1-mod1[Internal]
//~ MONO_ITEM static mod1::mod1::BAZ @@ regular_modules-mod1-mod1[Internal]
static BAZ: u64 = 0;
}
mod mod2 {
//~ MONO_ITEM fn regular_modules::mod1[0]::mod2[0]::foo[0] @@ regular_modules-mod1-mod2[Internal]
//~ MONO_ITEM fn mod1::mod2::foo @@ regular_modules-mod1-mod2[Internal]
fn foo() {}
//~ MONO_ITEM fn regular_modules::mod1[0]::mod2[0]::bar[0] @@ regular_modules-mod1-mod2[Internal]
//~ MONO_ITEM fn mod1::mod2::bar @@ regular_modules-mod1-mod2[Internal]
fn bar() {}
//~ MONO_ITEM static regular_modules::mod1[0]::mod2[0]::BAZ[0] @@ regular_modules-mod1-mod2[Internal]
//~ MONO_ITEM static mod1::mod2::BAZ @@ regular_modules-mod1-mod2[Internal]
static BAZ: u64 = 0;
}
}
mod mod2 {
//~ MONO_ITEM fn regular_modules::mod2[0]::foo[0] @@ regular_modules-mod2[Internal]
//~ MONO_ITEM fn mod2::foo @@ regular_modules-mod2[Internal]
fn foo() {}
//~ MONO_ITEM fn regular_modules::mod2[0]::bar[0] @@ regular_modules-mod2[Internal]
//~ MONO_ITEM fn mod2::bar @@ regular_modules-mod2[Internal]
fn bar() {}
//~ MONO_ITEM static regular_modules::mod2[0]::BAZ[0] @@ regular_modules-mod2[Internal]
//~ MONO_ITEM static mod2::BAZ @@ regular_modules-mod2[Internal]
static BAZ: u64 = 0;
mod mod1 {
//~ MONO_ITEM fn regular_modules::mod2[0]::mod1[0]::foo[0] @@ regular_modules-mod2-mod1[Internal]
//~ MONO_ITEM fn mod2::mod1::foo @@ regular_modules-mod2-mod1[Internal]
fn foo() {}
//~ MONO_ITEM fn regular_modules::mod2[0]::mod1[0]::bar[0] @@ regular_modules-mod2-mod1[Internal]
//~ MONO_ITEM fn mod2::mod1::bar @@ regular_modules-mod2-mod1[Internal]
fn bar() {}
//~ MONO_ITEM static regular_modules::mod2[0]::mod1[0]::BAZ[0] @@ regular_modules-mod2-mod1[Internal]
//~ MONO_ITEM static mod2::mod1::BAZ @@ regular_modules-mod2-mod1[Internal]
static BAZ: u64 = 0;
}
mod mod2 {
//~ MONO_ITEM fn regular_modules::mod2[0]::mod2[0]::foo[0] @@ regular_modules-mod2-mod2[Internal]
//~ MONO_ITEM fn mod2::mod2::foo @@ regular_modules-mod2-mod2[Internal]
fn foo() {}
//~ MONO_ITEM fn regular_modules::mod2[0]::mod2[0]::bar[0] @@ regular_modules-mod2-mod2[Internal]
//~ MONO_ITEM fn mod2::mod2::bar @@ regular_modules-mod2-mod2[Internal]
fn bar() {}
//~ MONO_ITEM static regular_modules::mod2[0]::mod2[0]::BAZ[0] @@ regular_modules-mod2-mod2[Internal]
//~ MONO_ITEM static mod2::mod2::BAZ @@ regular_modules-mod2-mod2[Internal]
static BAZ: u64 = 0;
}
}

View file

@ -9,10 +9,10 @@
// aux-build:shared_generics_aux.rs
extern crate shared_generics_aux;
//~ MONO_ITEM fn shared_generics::foo[0]
//~ MONO_ITEM fn foo
pub fn foo() {
//~ MONO_ITEM fn shared_generics_aux::generic_fn[0]<u16> @@ shared_generics_aux-in-shared_generics.volatile[External]
//~ MONO_ITEM fn shared_generics_aux::generic_fn::<u16> @@ shared_generics_aux-in-shared_generics.volatile[External]
let _ = shared_generics_aux::generic_fn(0u16, 1u16);
// This should not generate a monomorphization because it's already

View file

@ -4,34 +4,34 @@
#![crate_type="rlib"]
//~ MONO_ITEM static statics::FOO[0] @@ statics[Internal]
//~ MONO_ITEM static FOO @@ statics[Internal]
static FOO: u32 = 0;
//~ MONO_ITEM static statics::BAR[0] @@ statics[Internal]
//~ MONO_ITEM static BAR @@ statics[Internal]
static BAR: u32 = 0;
//~ MONO_ITEM fn statics::function[0] @@ statics[External]
//~ MONO_ITEM fn function @@ statics[External]
pub fn function() {
//~ MONO_ITEM static statics::function[0]::FOO[0] @@ statics[Internal]
//~ MONO_ITEM static function::FOO @@ statics[Internal]
static FOO: u32 = 0;
//~ MONO_ITEM static statics::function[0]::BAR[0] @@ statics[Internal]
//~ MONO_ITEM static function::BAR @@ statics[Internal]
static BAR: u32 = 0;
}
pub mod mod1 {
//~ MONO_ITEM static statics::mod1[0]::FOO[0] @@ statics-mod1[Internal]
//~ MONO_ITEM static mod1::FOO @@ statics-mod1[Internal]
static FOO: u32 = 0;
//~ MONO_ITEM static statics::mod1[0]::BAR[0] @@ statics-mod1[Internal]
//~ MONO_ITEM static mod1::BAR @@ statics-mod1[Internal]
static BAR: u32 = 0;
//~ MONO_ITEM fn statics::mod1[0]::function[0] @@ statics-mod1[External]
//~ MONO_ITEM fn mod1::function @@ statics-mod1[External]
pub fn function() {
//~ MONO_ITEM static statics::mod1[0]::function[0]::FOO[0] @@ statics-mod1[Internal]
//~ MONO_ITEM static mod1::function::FOO @@ statics-mod1[Internal]
static FOO: u32 = 0;
//~ MONO_ITEM static statics::mod1[0]::function[0]::BAR[0] @@ statics-mod1[Internal]
//~ MONO_ITEM static mod1::function::BAR @@ statics-mod1[Internal]
static BAR: u32 = 0;
}
}

View file

@ -28,7 +28,7 @@ mod mod1 {
fn do_something_else(&self, x: T) -> T { x }
}
//~ MONO_ITEM fn vtable_through_const::mod1[0]::id[0]<i64> @@ vtable_through_const-mod1.volatile[Internal]
//~ MONO_ITEM fn mod1::id::<i64> @@ vtable_through_const-mod1.volatile[Internal]
fn id<T>(x: T) -> T { x }
// These are referenced, so they produce mono-items (see start())
@ -43,8 +43,8 @@ mod mod1 {
fn do_something_else(&self) {}
}
//~ MONO_ITEM fn vtable_through_const::mod1[0]::Trait2[0]::do_something[0]<u32> @@ vtable_through_const-mod1.volatile[Internal]
//~ MONO_ITEM fn vtable_through_const::mod1[0]::Trait2[0]::do_something_else[0]<u32> @@ vtable_through_const-mod1.volatile[Internal]
//~ MONO_ITEM fn <u32 as mod1::Trait2>::do_something @@ vtable_through_const-mod1.volatile[Internal]
//~ MONO_ITEM fn <u32 as mod1::Trait2>::do_something_else @@ vtable_through_const-mod1.volatile[Internal]
impl Trait2 for u32 {}
pub trait Trait2Gen<T> {
@ -63,30 +63,30 @@ mod mod1 {
pub const ID_I64: fn(i64) -> i64 = id::<i64>;
}
//~ MONO_ITEM fn vtable_through_const::start[0]
//~ MONO_ITEM fn start
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<u32> @@ vtable_through_const[Internal]
//~ MONO_ITEM fn std::intrinsics::drop_in_place::<u32> - shim(None) @@ vtable_through_const[Internal]
// Since Trait1::do_something() is instantiated via its default implementation,
// it is considered a generic and is instantiated here only because it is
// referenced in this module.
//~ MONO_ITEM fn vtable_through_const::mod1[0]::Trait1[0]::do_something_else[0]<u32> @@ vtable_through_const-mod1.volatile[External]
//~ MONO_ITEM fn <u32 as mod1::Trait1>::do_something_else @@ vtable_through_const-mod1.volatile[External]
// Although it is never used, Trait1::do_something_else() has to be
// instantiated locally here too, otherwise the <&u32 as &Trait1> vtable
// could not be fully constructed.
//~ MONO_ITEM fn vtable_through_const::mod1[0]::Trait1[0]::do_something[0]<u32> @@ vtable_through_const-mod1.volatile[External]
//~ MONO_ITEM fn <u32 as mod1::Trait1>::do_something @@ vtable_through_const-mod1.volatile[External]
mod1::TRAIT1_REF.do_something();
// Same as above
//~ MONO_ITEM fn vtable_through_const::mod1[0]::{{impl}}[1]::do_something[0]<u8> @@ vtable_through_const-mod1.volatile[External]
//~ MONO_ITEM fn vtable_through_const::mod1[0]::{{impl}}[1]::do_something_else[0]<u8> @@ vtable_through_const-mod1.volatile[External]
//~ MONO_ITEM fn vtable_through_const::mod1[0]::{{impl}}[3]::do_something[0]<u8> @@ vtable_through_const-mod1.volatile[Internal]
//~ MONO_ITEM fn vtable_through_const::mod1[0]::{{impl}}[3]::do_something_else[0]<u8> @@ vtable_through_const-mod1.volatile[Internal]
//~ MONO_ITEM fn <u32 as mod1::Trait1Gen<u8>>::do_something @@ vtable_through_const-mod1.volatile[External]
//~ MONO_ITEM fn <u32 as mod1::Trait1Gen<u8>>::do_something_else @@ vtable_through_const-mod1.volatile[External]
//~ MONO_ITEM fn <u32 as mod1::Trait2Gen<u8>>::do_something @@ vtable_through_const-mod1.volatile[Internal]
//~ MONO_ITEM fn <u32 as mod1::Trait2Gen<u8>>::do_something_else @@ vtable_through_const-mod1.volatile[Internal]
mod1::TRAIT1_GEN_REF.do_something(0u8);
//~ MONO_ITEM fn vtable_through_const::mod1[0]::id[0]<char> @@ vtable_through_const-mod1.volatile[External]
//~ MONO_ITEM fn mod1::id::<char> @@ vtable_through_const-mod1.volatile[External]
mod1::ID_CHAR('x');
0

View file

@ -1,5 +1,4 @@
// compile-flags:-Zpolymorphize=on -Zprint-mono-items=lazy -Copt-level=1
// ignore-tidy-linelength
#![crate_type = "rlib"]
@ -10,44 +9,44 @@ mod functions {
// Function doesn't have any type parameters to be unused.
pub fn no_parameters() {}
//~ MONO_ITEM fn unused_type_parameters::functions[0]::no_parameters[0]
//~ MONO_ITEM fn functions::no_parameters
// Function has an unused type parameter.
pub fn unused<T>() {
}
//~ MONO_ITEM fn unused_type_parameters::functions[0]::unused[0]<T>
//~ MONO_ITEM fn functions::unused::<T>
// Function uses type parameter in value of a binding.
pub fn used_binding_value<T: Default>() {
let _: T = Default::default();
}
//~ MONO_ITEM fn unused_type_parameters::functions[0]::used_binding_value[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::functions[0]::used_binding_value[0]<u64>
//~ MONO_ITEM fn functions::used_binding_value::<u32>
//~ MONO_ITEM fn functions::used_binding_value::<u64>
// Function uses type parameter in type of a binding.
pub fn used_binding_type<T>() {
let _: Option<T> = None;
}
//~ MONO_ITEM fn unused_type_parameters::functions[0]::used_binding_type[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::functions[0]::used_binding_type[0]<u64>
//~ MONO_ITEM fn functions::used_binding_type::<u32>
//~ MONO_ITEM fn functions::used_binding_type::<u64>
// Function uses type parameter in argument.
pub fn used_argument<T>(_: T) {
}
//~ MONO_ITEM fn unused_type_parameters::functions[0]::used_argument[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::functions[0]::used_argument[0]<u64>
//~ MONO_ITEM fn functions::used_argument::<u32>
//~ MONO_ITEM fn functions::used_argument::<u64>
//
// Function uses type parameter in substitutions to another function.
pub fn used_substs<T>() {
unused::<T>()
}
//~ MONO_ITEM fn unused_type_parameters::functions[0]::used_substs[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::functions[0]::used_substs[0]<u64>
//~ MONO_ITEM fn functions::used_substs::<u32>
//~ MONO_ITEM fn functions::used_substs::<u64>
}
@ -57,7 +56,7 @@ mod closures {
let _ = || {};
}
//~ MONO_ITEM fn unused_type_parameters::closures[0]::no_parameters[0]
//~ MONO_ITEM fn closures::no_parameters
// Function has an unused type parameter in parent and closure.
pub fn unused<T>() -> u32 {
@ -65,8 +64,8 @@ mod closures {
add_one(3)
}
//~ MONO_ITEM fn unused_type_parameters::closures[0]::unused[0]::{{closure}}[0]<T, i8, extern "rust-call" fn((u32)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::unused[0]<T>
//~ MONO_ITEM fn closures::unused::<T>::{{closure}}#0
//~ MONO_ITEM fn closures::unused::<T>
// Function has an unused type parameter in closure, but not in parent.
pub fn used_parent<T: Default>() -> u32 {
@ -75,9 +74,9 @@ mod closures {
add_one(3)
}
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_parent[0]::{{closure}}[0]<T, i8, extern "rust-call" fn((u32)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_parent[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_parent[0]<u64>
//~ MONO_ITEM fn closures::used_parent::<T>::{{closure}}#0
//~ MONO_ITEM fn closures::used_parent::<u32>
//~ MONO_ITEM fn closures::used_parent::<u64>
// Function uses type parameter in value of a binding in closure.
pub fn used_binding_value<T: Default>() -> T {
@ -89,10 +88,10 @@ mod closures {
x()
}
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_binding_value[0]::{{closure}}[0]<u32, i8, extern "rust-call" fn(()) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_binding_value[0]::{{closure}}[0]<u64, i8, extern "rust-call" fn(()) -> u64, ()>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_binding_value[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_binding_value[0]<u64>
//~ MONO_ITEM fn closures::used_binding_value::<u32>::{{closure}}#0
//~ MONO_ITEM fn closures::used_binding_value::<u64>::{{closure}}#0
//~ MONO_ITEM fn closures::used_binding_value::<u32>
//~ MONO_ITEM fn closures::used_binding_value::<u64>
// Function uses type parameter in type of a binding in closure.
pub fn used_binding_type<T>() -> Option<T> {
@ -104,10 +103,10 @@ mod closures {
x()
}
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_binding_type[0]::{{closure}}[0]<u32, i8, extern "rust-call" fn(()) -> core::option[0]::Option[0]<u32>, ()>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_binding_type[0]::{{closure}}[0]<u64, i8, extern "rust-call" fn(()) -> core::option[0]::Option[0]<u64>, ()>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_binding_type[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_binding_type[0]<u64>
//~ MONO_ITEM fn closures::used_binding_type::<u32>::{{closure}}#0
//~ MONO_ITEM fn closures::used_binding_type::<u64>::{{closure}}#0
//~ MONO_ITEM fn closures::used_binding_type::<u32>
//~ MONO_ITEM fn closures::used_binding_type::<u64>
// Function and closure uses type parameter in argument.
pub fn used_argument<T>(t: T) -> u32 {
@ -115,10 +114,10 @@ mod closures {
x(t)
}
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_argument[0]::{{closure}}[0]<u32, i8, extern "rust-call" fn((u32)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_argument[0]::{{closure}}[0]<u64, i8, extern "rust-call" fn((u64)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_argument[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_argument[0]<u64>
//~ MONO_ITEM fn closures::used_argument::<u32>::{{closure}}#0
//~ MONO_ITEM fn closures::used_argument::<u64>::{{closure}}#0
//~ MONO_ITEM fn closures::used_argument::<u32>
//~ MONO_ITEM fn closures::used_argument::<u64>
// Closure uses type parameter in argument.
pub fn used_argument_closure<T: Default>() -> u32 {
@ -127,10 +126,10 @@ mod closures {
x(t)
}
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_argument_closure[0]::{{closure}}[0]<u32, i8, extern "rust-call" fn((u32)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_argument_closure[0]::{{closure}}[0]<u64, i8, extern "rust-call" fn((u64)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_argument_closure[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_argument_closure[0]<u64>
//~ MONO_ITEM fn closures::used_argument_closure::<u32>::{{closure}}#0
//~ MONO_ITEM fn closures::used_argument_closure::<u64>::{{closure}}#0
//~ MONO_ITEM fn closures::used_argument_closure::<u32>
//~ MONO_ITEM fn closures::used_argument_closure::<u64>
// Closure uses type parameter as upvar.
pub fn used_upvar<T: Default>() -> T {
@ -139,10 +138,10 @@ mod closures {
y()
}
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_upvar[0]::{{closure}}[0]<u32, i32, extern "rust-call" fn(()) -> u32, (u32)>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_upvar[0]::{{closure}}[0]<u64, i32, extern "rust-call" fn(()) -> u64, (u64)>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_upvar[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_upvar[0]<u64>
//~ MONO_ITEM fn closures::used_upvar::<u32>::{{closure}}#0
//~ MONO_ITEM fn closures::used_upvar::<u64>::{{closure}}#0
//~ MONO_ITEM fn closures::used_upvar::<u32>
//~ MONO_ITEM fn closures::used_upvar::<u64>
// Closure uses type parameter in substitutions to another function.
pub fn used_substs<T>() {
@ -150,10 +149,10 @@ mod closures {
x()
}
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_substs[0]::{{closure}}[0]<u32, i8, extern "rust-call" fn(()), ()>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_substs[0]::{{closure}}[0]<u64, i8, extern "rust-call" fn(()), ()>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_substs[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::closures[0]::used_substs[0]<u64>
//~ MONO_ITEM fn closures::used_substs::<u32>::{{closure}}#0
//~ MONO_ITEM fn closures::used_substs::<u64>::{{closure}}#0
//~ MONO_ITEM fn closures::used_substs::<u32>
//~ MONO_ITEM fn closures::used_substs::<u64>
}
mod methods {
@ -164,29 +163,29 @@ mod methods {
pub fn unused_impl() {
}
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::unused_impl[0]<F>
//~ MONO_ITEM fn methods::Foo::<F>::unused_impl
// Function has an unused type parameter from impl and fn.
pub fn unused_both<G: Default>() {
}
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::unused_both[0]<F, G>
//~ MONO_ITEM fn methods::Foo::<F>::unused_both::<G>
// Function uses type parameter from impl.
pub fn used_impl() {
let _: F = Default::default();
}
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::used_impl[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::used_impl[0]<u64>
//~ MONO_ITEM fn methods::Foo::<u32>::used_impl
//~ MONO_ITEM fn methods::Foo::<u64>::used_impl
// Function uses type parameter from impl.
pub fn used_fn<G: Default>() {
let _: G = Default::default();
}
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::used_fn[0]<F, u32>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::used_fn[0]<F, u64>
//~ MONO_ITEM fn methods::Foo::<F>::used_fn::<u32>
//~ MONO_ITEM fn methods::Foo::<F>::used_fn::<u64>
// Function uses type parameter from impl.
pub fn used_both<G: Default>() {
@ -194,16 +193,16 @@ mod methods {
let _: G = Default::default();
}
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::used_both[0]<u32, u32>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::used_both[0]<u64, u64>
//~ MONO_ITEM fn methods::Foo::<u32>::used_both::<u32>
//~ MONO_ITEM fn methods::Foo::<u64>::used_both::<u64>
// Function uses type parameter in substitutions to another function.
pub fn used_substs() {
super::functions::unused::<F>()
}
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::used_substs[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::used_substs[0]<u64>
//~ MONO_ITEM fn methods::Foo::<u32>::used_substs
//~ MONO_ITEM fn methods::Foo::<u64>::used_substs
// Function has an unused type parameter from impl and fn.
pub fn closure_unused_all<G: Default>() -> u32 {
@ -211,8 +210,8 @@ mod methods {
add_one(3)
}
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_unused_all[0]::{{closure}}[0]<F, G, i8, extern "rust-call" fn((u32)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_unused_all[0]<F, G>
//~ MONO_ITEM fn methods::Foo::<F>::closure_unused_all::<G>::{{closure}}#0
//~ MONO_ITEM fn methods::Foo::<F>::closure_unused_all::<G>
// Function uses type parameter from impl and fn in closure.
pub fn closure_used_both<G: Default>() -> u32 {
@ -225,10 +224,10 @@ mod methods {
add_one(3)
}
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_both[0]::{{closure}}[0]<u32, u32, i8, extern "rust-call" fn((u32)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_both[0]::{{closure}}[0]<u64, u64, i8, extern "rust-call" fn((u32)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_both[0]<u32, u32>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_both[0]<u64, u64>
//~ MONO_ITEM fn methods::Foo::<u32>::closure_used_both::<u32>::{{closure}}#0
//~ MONO_ITEM fn methods::Foo::<u64>::closure_used_both::<u64>::{{closure}}#0
//~ MONO_ITEM fn methods::Foo::<u32>::closure_used_both::<u32>
//~ MONO_ITEM fn methods::Foo::<u64>::closure_used_both::<u64>
// Function uses type parameter from fn in closure.
pub fn closure_used_fn<G: Default>() -> u32 {
@ -240,10 +239,10 @@ mod methods {
add_one(3)
}
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_fn[0]::{{closure}}[0]<F, u32, i8, extern "rust-call" fn((u32)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_fn[0]::{{closure}}[0]<F, u64, i8, extern "rust-call" fn((u32)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_fn[0]<F, u32>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_fn[0]<F, u64>
//~ MONO_ITEM fn methods::Foo::<F>::closure_used_fn::<u32>::{{closure}}#0
//~ MONO_ITEM fn methods::Foo::<F>::closure_used_fn::<u64>::{{closure}}#0
//~ MONO_ITEM fn methods::Foo::<F>::closure_used_fn::<u32>
//~ MONO_ITEM fn methods::Foo::<F>::closure_used_fn::<u64>
// Function uses type parameter from impl in closure.
pub fn closure_used_impl<G: Default>() -> u32 {
@ -255,10 +254,10 @@ mod methods {
add_one(3)
}
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_impl[0]::{{closure}}[0]<u32, G, i8, extern "rust-call" fn((u32)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_impl[0]::{{closure}}[0]<u64, G, i8, extern "rust-call" fn((u32)) -> u32, ()>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_impl[0]<u32, G>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_impl[0]<u64, G>
//~ MONO_ITEM fn methods::Foo::<u32>::closure_used_impl::<G>::{{closure}}#0
//~ MONO_ITEM fn methods::Foo::<u64>::closure_used_impl::<G>::{{closure}}#0
//~ MONO_ITEM fn methods::Foo::<u32>::closure_used_impl::<G>
//~ MONO_ITEM fn methods::Foo::<u64>::closure_used_impl::<G>
// Closure uses type parameter in substitutions to another function.
pub fn closure_used_substs() {
@ -266,10 +265,10 @@ mod methods {
x()
}
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_substs[0]::{{closure}}[0]<u32, i8, extern "rust-call" fn(()), ()>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_substs[0]::{{closure}}[0]<u64, i8, extern "rust-call" fn(()), ()>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_substs[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::methods[0]::{{impl}}[0]::closure_used_substs[0]<u64>
//~ MONO_ITEM fn methods::Foo::<u32>::closure_used_substs::{{closure}}#0
//~ MONO_ITEM fn methods::Foo::<u64>::closure_used_substs::{{closure}}#0
//~ MONO_ITEM fn methods::Foo::<u32>::closure_used_substs
//~ MONO_ITEM fn methods::Foo::<u64>::closure_used_substs
}
}
@ -306,8 +305,8 @@ fn dispatch<T: Default>() {
let _ = methods::Foo::<T>::closure_used_substs();
}
//~ MONO_ITEM fn unused_type_parameters::dispatch[0]<u32>
//~ MONO_ITEM fn unused_type_parameters::dispatch[0]<u64>
//~ MONO_ITEM fn dispatch::<u32>
//~ MONO_ITEM fn dispatch::<u64>
pub fn foo() {
// Generate two copies of each function to check that where the type parameter is unused,
@ -316,8 +315,8 @@ pub fn foo() {
dispatch::<u64>();
}
//~ MONO_ITEM fn unused_type_parameters::foo[0] @@ unused_type_parameters-cgu.0[External]
//~ MONO_ITEM fn foo @@ unused_type_parameters-cgu.0[External]
// These are all the items that aren't relevant to the test.
//~ MONO_ITEM fn core::default[0]::{{impl}}[6]::default[0]
//~ MONO_ITEM fn core::default[0]::{{impl}}[7]::default[0]
//~ MONO_ITEM fn <u32 as std::default::Default>::default
//~ MONO_ITEM fn <u64 as std::default::Default>::default