Skip to content

Commit ef66da3

Browse files
committed
remove unused pub fn
1 parent c225c45 commit ef66da3

File tree

14 files changed

+5
-198
lines changed

14 files changed

+5
-198
lines changed

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,6 @@ extern "C" {
900900
pub fn LLVMGlobalSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
901901
pub fn LLVMRustGlobalAddMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
902902
pub fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
903-
pub fn LLVMIsAFunction(Val: &Value) -> Option<&Value>;
904903
pub fn LLVMRustIsNonGVFunctionPointerTy(Val: &Value) -> bool;
905904

906905
// Operations on constants of any type
@@ -972,7 +971,6 @@ extern "C" {
972971
pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
973972
pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
974973
pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
975-
pub fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
976974
pub fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>;
977975

978976
// Operations on global variables, functions, and aliases (globals)
@@ -2320,11 +2318,6 @@ extern "C" {
23202318
len: usize,
23212319
Identifier: *const c_char,
23222320
) -> Option<&Module>;
2323-
pub fn LLVMRustGetBitcodeSliceFromObjectData(
2324-
Data: *const u8,
2325-
len: usize,
2326-
out_len: &mut usize,
2327-
) -> *const u8;
23282321
pub fn LLVMRustGetSliceFromObjectDataByName(
23292322
data: *const u8,
23302323
len: usize,

compiler/rustc_codegen_llvm/src/type_.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,6 @@ impl<'ll, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
227227
}
228228

229229
impl Type {
230-
pub fn i8_llcx(llcx: &llvm::Context) -> &Type {
231-
unsafe { llvm::LLVMInt8TypeInContext(llcx) }
232-
}
233-
234230
/// Creates an integer type with the given number of bits, e.g., i24
235231
pub fn ix_llcx(llcx: &llvm::Context, num_bits: u64) -> &Type {
236232
unsafe { llvm::LLVMIntTypeInContext(llcx, num_bits as c_uint) }

compiler/rustc_const_eval/src/interpret/projection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,13 @@ where
256256
}
257257

258258
/// Iterates over all fields of an array. Much more efficient than doing the
259-
/// same by repeatedly calling `operand_index`.
259+
/// same by repeatedly calling `project_index`.
260260
pub fn project_array_fields<'a, P: Projectable<'tcx, M::Provenance>>(
261261
&self,
262262
base: &'a P,
263263
) -> InterpResult<'tcx, ArrayIterator<'tcx, 'a, M::Provenance, P>> {
264264
let abi::FieldsShape::Array { stride, .. } = base.layout().fields else {
265-
span_bug!(self.cur_span(), "operand_array_fields: expected an array layout");
265+
span_bug!(self.cur_span(), "project_array_fields: expected an array layout");
266266
};
267267
let len = base.len(self)?;
268268
let field_layout = base.layout().field(self, 0);

compiler/rustc_graphviz/src/lib.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -522,33 +522,6 @@ impl<'a> LabelText<'a> {
522522
HtmlStr(ref s) => format!("<{s}>"),
523523
}
524524
}
525-
526-
/// Decomposes content into string suitable for making EscStr that
527-
/// yields same content as self. The result obeys the law
528-
/// render(`lt`) == render(`EscStr(lt.pre_escaped_content())`) for
529-
/// all `lt: LabelText`.
530-
fn pre_escaped_content(self) -> Cow<'a, str> {
531-
match self {
532-
EscStr(s) => s,
533-
LabelStr(s) => {
534-
if s.contains('\\') {
535-
s.escape_default().to_string().into()
536-
} else {
537-
s
538-
}
539-
}
540-
HtmlStr(s) => s,
541-
}
542-
}
543-
544-
/// Puts `suffix` on a line below this label, with a blank line separator.
545-
pub fn suffix_line(self, suffix: LabelText<'_>) -> LabelText<'static> {
546-
let mut prefix = self.pre_escaped_content().into_owned();
547-
let suffix = suffix.pre_escaped_content();
548-
prefix.push_str(r"\n\n");
549-
prefix.push_str(&suffix);
550-
EscStr(prefix.into())
551-
}
552525
}
553526

554527
pub type Nodes<'a, N> = Cow<'a, [N]>;

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
615615
return false;
616616
}
617617
let pin_did = self.tcx.lang_items().pin_type();
618+
// FIXME: replace mk_box with?
618619
// This guards the `unwrap` and `mk_box` below.
619620
if pin_did.is_none() || self.tcx.lang_items().owned_box().is_none() {
620621
return false;

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use rustc_middle::ty::error::{ExpectedFound, TypeError};
3232
use rustc_middle::ty::fold::BoundVarReplacerDelegate;
3333
use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
3434
use rustc_middle::ty::relate::RelateResult;
35-
use rustc_middle::ty::visit::{TypeVisitable, TypeVisitableExt};
35+
use rustc_middle::ty::visit::TypeVisitableExt;
3636
pub use rustc_middle::ty::IntVarValue;
3737
use rustc_middle::ty::{self, GenericParamDefKind, InferConst, InferTy, Ty, TyCtxt};
3838
use rustc_middle::ty::{ConstVid, EffectVid, FloatVid, IntVid, TyVid};
@@ -1401,17 +1401,6 @@ impl<'tcx> InferCtxt<'tcx> {
14011401
value.fold_with(&mut r)
14021402
}
14031403

1404-
/// Returns the first unresolved type or const variable contained in `T`.
1405-
pub fn first_unresolved_const_or_ty_var<T>(
1406-
&self,
1407-
value: &T,
1408-
) -> Option<(ty::Term<'tcx>, Option<Span>)>
1409-
where
1410-
T: TypeVisitable<TyCtxt<'tcx>>,
1411-
{
1412-
value.visit_with(&mut resolve::UnresolvedTypeOrConstFinder::new(self)).break_value()
1413-
}
1414-
14151404
pub fn probe_const_var(&self, vid: ty::ConstVid) -> Result<ty::Const<'tcx>, ty::UniverseIndex> {
14161405
match self.inner.borrow_mut().const_unification_table().probe_value(vid).val {
14171406
ConstVariableValue::Known { value } => Ok(value),

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,32 +1562,6 @@ LLVMRustParseBitcodeForLTO(LLVMContextRef Context,
15621562
return wrap(std::move(*SrcOrError).release());
15631563
}
15641564

1565-
// Find the bitcode section in the object file data and return it as a slice.
1566-
// Fail if the bitcode section is present but empty.
1567-
//
1568-
// On success, the return value is the pointer to the start of the slice and
1569-
// `out_len` is filled with the (non-zero) length. On failure, the return value
1570-
// is `nullptr` and `out_len` is set to zero.
1571-
extern "C" const char*
1572-
LLVMRustGetBitcodeSliceFromObjectData(const char *data,
1573-
size_t len,
1574-
size_t *out_len) {
1575-
*out_len = 0;
1576-
1577-
StringRef Data(data, len);
1578-
MemoryBufferRef Buffer(Data, ""); // The id is unused.
1579-
1580-
Expected<MemoryBufferRef> BitcodeOrError =
1581-
object::IRObjectFile::findBitcodeInMemBuffer(Buffer);
1582-
if (!BitcodeOrError) {
1583-
LLVMRustSetLastError(toString(BitcodeOrError.takeError()).c_str());
1584-
return nullptr;
1585-
}
1586-
1587-
*out_len = BitcodeOrError->getBufferSize();
1588-
return BitcodeOrError->getBufferStart();
1589-
}
1590-
15911565
// Find a section of an object file by name. Fail if the section is missing or
15921566
// empty.
15931567
extern "C" const char *LLVMRustGetSliceFromObjectDataByName(const char *data,

compiler/rustc_middle/src/mir/query.rs

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -42,64 +42,6 @@ pub enum UnsafetyViolationDetails {
4242
CallToFunctionWith,
4343
}
4444

45-
impl UnsafetyViolationDetails {
46-
pub fn description_and_note(&self) -> (&'static str, &'static str) {
47-
use UnsafetyViolationDetails::*;
48-
match self {
49-
CallToUnsafeFunction => (
50-
"call to unsafe function",
51-
"consult the function's documentation for information on how to avoid undefined \
52-
behavior",
53-
),
54-
UseOfInlineAssembly => (
55-
"use of inline assembly",
56-
"inline assembly is entirely unchecked and can cause undefined behavior",
57-
),
58-
InitializingTypeWith => (
59-
"initializing type with `rustc_layout_scalar_valid_range` attr",
60-
"initializing a layout restricted type's field with a value outside the valid \
61-
range is undefined behavior",
62-
),
63-
CastOfPointerToInt => {
64-
("cast of pointer to int", "casting pointers to integers in constants")
65-
}
66-
UseOfMutableStatic => (
67-
"use of mutable static",
68-
"mutable statics can be mutated by multiple threads: aliasing violations or data \
69-
races will cause undefined behavior",
70-
),
71-
UseOfExternStatic => (
72-
"use of extern static",
73-
"extern statics are not controlled by the Rust type system: invalid data, \
74-
aliasing violations or data races will cause undefined behavior",
75-
),
76-
DerefOfRawPointer => (
77-
"dereference of raw pointer",
78-
"raw pointers may be null, dangling or unaligned; they can violate aliasing rules \
79-
and cause data races: all of these are undefined behavior",
80-
),
81-
AccessToUnionField => (
82-
"access to union field",
83-
"the field may not be properly initialized: using uninitialized data will cause \
84-
undefined behavior",
85-
),
86-
MutationOfLayoutConstrainedField => (
87-
"mutation of layout constrained field",
88-
"mutating layout constrained fields cannot statically be checked for valid values",
89-
),
90-
BorrowOfLayoutConstrainedField => (
91-
"borrow of layout constrained field with interior mutability",
92-
"references to fields of layout constrained fields lose the constraints. Coupled \
93-
with interior mutability, the field can be changed to invalid values",
94-
),
95-
CallToFunctionWith => (
96-
"call to function with `#[target_feature]`",
97-
"can only be called if the required target features are available",
98-
),
99-
}
100-
}
101-
}
102-
10345
#[derive(Copy, Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)]
10446
pub struct UnsafetyViolation {
10547
pub source_info: SourceInfo,

compiler/rustc_middle/src/traits/query.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,6 @@ impl<'tcx> DropckOutlivesResult<'tcx> {
108108
tcx.sess.emit_err(DropCheckOverflow { span, ty, overflow_ty: *overflow_ty });
109109
}
110110
}
111-
112-
pub fn into_kinds_reporting_overflows(
113-
self,
114-
tcx: TyCtxt<'tcx>,
115-
span: Span,
116-
ty: Ty<'tcx>,
117-
) -> Vec<GenericArg<'tcx>> {
118-
self.report_overflows(tcx, span, ty);
119-
let DropckOutlivesResult { kinds, overflows: _ } = self;
120-
kinds
121-
}
122111
}
123112

124113
/// A set of constraints that need to be satisfied in order for

compiler/rustc_middle/src/ty/generic_args.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -604,13 +604,6 @@ impl<T> EarlyBinder<Option<T>> {
604604
}
605605
}
606606

607-
impl<T, U> EarlyBinder<(T, U)> {
608-
pub fn transpose_tuple2(self) -> (EarlyBinder<T>, EarlyBinder<U>) {
609-
let EarlyBinder { value: (lhs, rhs) } = self;
610-
(EarlyBinder { value: lhs }, EarlyBinder { value: rhs })
611-
}
612-
}
613-
614607
impl<'tcx, 's, I: IntoIterator> EarlyBinder<I>
615608
where
616609
I::Item: TypeFoldable<TyCtxt<'tcx>>,

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,26 +1305,6 @@ impl<'tcx> Predicate<'tcx> {
13051305
}
13061306
}
13071307

1308-
pub fn to_opt_type_outlives(self) -> Option<PolyTypeOutlivesPredicate<'tcx>> {
1309-
let predicate = self.kind();
1310-
match predicate.skip_binder() {
1311-
PredicateKind::Clause(ClauseKind::TypeOutlives(data)) => Some(predicate.rebind(data)),
1312-
PredicateKind::Clause(ClauseKind::Trait(..))
1313-
| PredicateKind::Clause(ClauseKind::ConstArgHasType(..))
1314-
| PredicateKind::Clause(ClauseKind::Projection(..))
1315-
| PredicateKind::AliasRelate(..)
1316-
| PredicateKind::Subtype(..)
1317-
| PredicateKind::Coerce(..)
1318-
| PredicateKind::Clause(ClauseKind::RegionOutlives(..))
1319-
| PredicateKind::Clause(ClauseKind::WellFormed(..))
1320-
| PredicateKind::ObjectSafe(..)
1321-
| PredicateKind::ClosureKind(..)
1322-
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
1323-
| PredicateKind::ConstEquate(..)
1324-
| PredicateKind::Ambiguous => None,
1325-
}
1326-
}
1327-
13281308
/// Matches a `PredicateKind::Clause` and turns it into a `Clause`, otherwise returns `None`.
13291309
pub fn as_clause(self) -> Option<Clause<'tcx>> {
13301310
match self.kind().skip_binder() {

compiler/rustc_middle/src/ty/util.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -699,22 +699,6 @@ impl<'tcx> TyCtxt<'tcx> {
699699
.map(|decl| ty::EarlyBinder::bind(decl.ty))
700700
}
701701

702-
/// Normalizes all opaque types in the given value, replacing them
703-
/// with their underlying types.
704-
pub fn expand_opaque_types(self, val: Ty<'tcx>) -> Ty<'tcx> {
705-
let mut visitor = OpaqueTypeExpander {
706-
seen_opaque_tys: FxHashSet::default(),
707-
expanded_cache: FxHashMap::default(),
708-
primary_def_id: None,
709-
found_recursion: false,
710-
found_any_recursion: false,
711-
check_recursion: false,
712-
expand_coroutines: false,
713-
tcx: self,
714-
};
715-
val.fold_with(&mut visitor)
716-
}
717-
718702
/// Expands the given impl trait type, stopping if the type is recursive.
719703
#[instrument(skip(self), level = "debug", ret)]
720704
pub fn try_expand_impl_trait_type(

compiler/rustc_span/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,6 @@ pub fn set_session_globals_then<R>(session_globals: &SessionGlobals, f: impl FnO
139139
SESSION_GLOBALS.set(session_globals, f)
140140
}
141141

142-
pub fn create_default_session_if_not_set_then<R, F>(f: F) -> R
143-
where
144-
F: FnOnce(&SessionGlobals) -> R,
145-
{
146-
create_session_if_not_set_then(edition::DEFAULT_EDITION, f)
147-
}
148-
149142
pub fn create_session_if_not_set_then<R, F>(edition: Edition, f: F) -> R
150143
where
151144
F: FnOnce(&SessionGlobals) -> R,

compiler/rustc_trait_selection/src/traits/coherence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ impl<'a, 'tcx> ProofTreeVisitor<'tcx> for AmbiguityCausesVisitor<'a> {
998998

999999
let Goal { param_env, predicate } = goal.goal();
10001000

1001-
// For bound predicates we simply call `infcx.replace_bound_vars_with_placeholders`
1001+
// For bound predicates we simply call `infcx.instantiate_binder_with_placeholders`
10021002
// and then prove the resulting predicate as a nested goal.
10031003
let trait_ref = match predicate.kind().no_bound_vars() {
10041004
Some(ty::PredicateKind::Clause(ty::ClauseKind::Trait(tr))) => tr.trait_ref,

0 commit comments

Comments
 (0)