Skip to content

Commit fcdb890

Browse files
committed
Inline tweaks
1 parent 0a13050 commit fcdb890

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

src/librustc/dep_graph/graph.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ impl DepGraph {
262262
}
263263

264264
// FIXME: Merge with with_task?
265+
#[inline]
265266
pub fn with_query_task<'a, F, R>(
266267
&self,
267268
tcx: TyCtxt<'a, '_, '_>,
@@ -1142,7 +1143,7 @@ impl CurrentDepGraphAtomic {
11421143
OpenTask::Anon(ref task) => {
11431144
let mut task = task.lock();
11441145
if task.read_set.insert(source) {
1145-
task.reads.push(source);
1146+
task.reads.push_light(source);
11461147
}
11471148
}
11481149
OpenTask::Ignore | OpenTask::EvalAlways { .. } => {
@@ -1165,6 +1166,12 @@ pub fn test1(a: &mut SmallVec<[DepNodeIndex; 8]>) {
11651166
a.push(DepNodeIndex::new(8));
11661167
}
11671168

1169+
// FIXME: Remove
1170+
#[no_mangle]
1171+
pub fn test3(a: &mut SmallVec<[DepNodeIndex; 8]>) {
1172+
a.push_light(DepNodeIndex::new(8));
1173+
}
1174+
11681175
#[no_mangle]
11691176
pub fn test2(a: &mut DepGraph, dep_node_index: DepNodeIndex) {
11701177
a.read_index(dep_node_index)

src/librustc/ty/context.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,7 @@ pub mod tls {
19971997
}
19981998

19991999
/// Sets `context` as the new current ImplicitCtxt for the duration of the function `f`
2000+
#[inline]
20002001
pub fn enter_context<'a, 'gcx: 'tcx, 'tcx, F, R>(context: &ImplicitCtxt<'a, 'gcx, 'tcx>,
20012002
f: F) -> R
20022003
where F: FnOnce(&ImplicitCtxt<'a, 'gcx, 'tcx>) -> R
@@ -2066,6 +2067,7 @@ pub mod tls {
20662067
}
20672068

20682069
/// Allows access to the current ImplicitCtxt in a closure if one is available
2070+
#[inline]
20692071
pub fn with_context_opt<F, R>(f: F) -> R
20702072
where F: for<'a, 'gcx, 'tcx> FnOnce(Option<&ImplicitCtxt<'a, 'gcx, 'tcx>>) -> R
20712073
{
@@ -2083,6 +2085,7 @@ pub mod tls {
20832085

20842086
/// Allows access to the current ImplicitCtxt.
20852087
/// Panics if there is no ImplicitCtxt available
2088+
#[inline]
20862089
pub fn with_context<F, R>(f: F) -> R
20872090
where F: for<'a, 'gcx, 'tcx> FnOnce(&ImplicitCtxt<'a, 'gcx, 'tcx>) -> R
20882091
{
@@ -2094,6 +2097,7 @@ pub mod tls {
20942097
/// with the same 'gcx lifetime as the TyCtxt passed in.
20952098
/// This will panic if you pass it a TyCtxt which has a different global interner from
20962099
/// the current ImplicitCtxt's tcx field.
2100+
#[inline]
20972101
pub fn with_related_context<'a, 'gcx, 'tcx1, F, R>(tcx: TyCtxt<'a, 'gcx, 'tcx1>, f: F) -> R
20982102
where F: for<'b, 'tcx2> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx2>) -> R
20992103
{
@@ -2112,6 +2116,7 @@ pub mod tls {
21122116
/// is given an ImplicitCtxt with the same 'tcx and 'gcx lifetimes as the TyCtxt passed in.
21132117
/// This will panic if you pass it a TyCtxt which has a different global interner or
21142118
/// a different local interner from the current ImplicitCtxt's tcx field.
2119+
#[inline]
21152120
pub fn with_fully_related_context<'a, 'gcx, 'tcx, F, R>(tcx: TyCtxt<'a, 'gcx, 'tcx>, f: F) -> R
21162121
where F: for<'b> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx>) -> R
21172122
{
@@ -2129,6 +2134,7 @@ pub mod tls {
21292134

21302135
/// Allows access to the TyCtxt in the current ImplicitCtxt.
21312136
/// Panics if there is no ImplicitCtxt available
2137+
#[inline]
21322138
pub fn with<F, R>(f: F) -> R
21332139
where F: for<'a, 'gcx, 'tcx> FnOnce(TyCtxt<'a, 'gcx, 'tcx>) -> R
21342140
{
@@ -2137,6 +2143,7 @@ pub mod tls {
21372143

21382144
/// Allows access to the TyCtxt in the current ImplicitCtxt.
21392145
/// The closure is passed None if there is no ImplicitCtxt available
2146+
#[inline]
21402147
pub fn with_opt<F, R>(f: F) -> R
21412148
where F: for<'a, 'gcx, 'tcx> FnOnce(Option<TyCtxt<'a, 'gcx, 'tcx>>) -> R
21422149
{

src/librustc/ty/query/plumbing.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
171171

172172
/// Completes the query by updating the query cache with the `result`,
173173
/// signals the waiter and forgets the JobOwner, so it won't poison the query
174+
#[inline]
174175
pub(super) fn complete(self, result: &Q::Value, dep_node_index: DepNodeIndex) {
175176
// We can move out of `self` here because we `mem::forget` it below
176177
let key = unsafe { ptr::read(&self.key) };
@@ -217,6 +218,7 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
217218
}
218219

219220
impl<'a, 'tcx, Q: QueryDescription<'tcx>> Drop for JobOwner<'a, 'tcx, Q> {
221+
#[inline]
220222
fn drop(&mut self) {
221223
// Poison the query so jobs waiting on it panic
222224
self.cache.borrow_mut().active.insert(self.key.clone(), QueryResult::Poisoned);

src/libserialize/opaque.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ pub struct Decoder<'a> {
172172
}
173173

174174
impl<'a> Decoder<'a> {
175+
#[inline]
175176
pub fn new(data: &'a [u8], position: usize) -> Decoder<'a> {
176177
Decoder {
177178
data,

src/libstd/collections/hash/table.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ impl<K, V> RawTable<K, V> {
740740
}
741741
}
742742

743+
#[inline]
743744
fn new_internal(
744745
capacity: usize,
745746
fallibility: Fallibility,
@@ -755,12 +756,14 @@ impl<K, V> RawTable<K, V> {
755756

756757
/// Tries to create a new raw table from a given capacity. If it cannot allocate,
757758
/// it returns with AllocErr.
759+
#[inline]
758760
pub fn try_new(capacity: usize) -> Result<RawTable<K, V>, CollectionAllocErr> {
759761
Self::new_internal(capacity, Fallible)
760762
}
761763

762764
/// Creates a new raw table from a given capacity. All buckets are
763765
/// initially empty.
766+
#[inline]
764767
pub fn new(capacity: usize) -> RawTable<K, V> {
765768
match Self::new_internal(capacity, Infallible) {
766769
Err(CollectionAllocErr::CapacityOverflow) => panic!("capacity overflow"),

0 commit comments

Comments
 (0)