Skip to content

Commit 6e65cdc

Browse files
committed
Inline tweaks
1 parent 285731b commit 6e65cdc

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
@@ -2003,6 +2003,7 @@ pub mod tls {
20032003
}
20042004

20052005
/// Sets `context` as the new current ImplicitCtxt for the duration of the function `f`
2006+
#[inline]
20062007
pub fn enter_context<'a, 'gcx: 'tcx, 'tcx, F, R>(context: &ImplicitCtxt<'a, 'gcx, 'tcx>,
20072008
f: F) -> R
20082009
where F: FnOnce(&ImplicitCtxt<'a, 'gcx, 'tcx>) -> R
@@ -2072,6 +2073,7 @@ pub mod tls {
20722073
}
20732074

20742075
/// Allows access to the current ImplicitCtxt in a closure if one is available
2076+
#[inline]
20752077
pub fn with_context_opt<F, R>(f: F) -> R
20762078
where F: for<'a, 'gcx, 'tcx> FnOnce(Option<&ImplicitCtxt<'a, 'gcx, 'tcx>>) -> R
20772079
{
@@ -2089,6 +2091,7 @@ pub mod tls {
20892091

20902092
/// Allows access to the current ImplicitCtxt.
20912093
/// Panics if there is no ImplicitCtxt available
2094+
#[inline]
20922095
pub fn with_context<F, R>(f: F) -> R
20932096
where F: for<'a, 'gcx, 'tcx> FnOnce(&ImplicitCtxt<'a, 'gcx, 'tcx>) -> R
20942097
{
@@ -2100,6 +2103,7 @@ pub mod tls {
21002103
/// with the same 'gcx lifetime as the TyCtxt passed in.
21012104
/// This will panic if you pass it a TyCtxt which has a different global interner from
21022105
/// the current ImplicitCtxt's tcx field.
2106+
#[inline]
21032107
pub fn with_related_context<'a, 'gcx, 'tcx1, F, R>(tcx: TyCtxt<'a, 'gcx, 'tcx1>, f: F) -> R
21042108
where F: for<'b, 'tcx2> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx2>) -> R
21052109
{
@@ -2118,6 +2122,7 @@ pub mod tls {
21182122
/// is given an ImplicitCtxt with the same 'tcx and 'gcx lifetimes as the TyCtxt passed in.
21192123
/// This will panic if you pass it a TyCtxt which has a different global interner or
21202124
/// a different local interner from the current ImplicitCtxt's tcx field.
2125+
#[inline]
21212126
pub fn with_fully_related_context<'a, 'gcx, 'tcx, F, R>(tcx: TyCtxt<'a, 'gcx, 'tcx>, f: F) -> R
21222127
where F: for<'b> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx>) -> R
21232128
{
@@ -2135,6 +2140,7 @@ pub mod tls {
21352140

21362141
/// Allows access to the TyCtxt in the current ImplicitCtxt.
21372142
/// Panics if there is no ImplicitCtxt available
2143+
#[inline]
21382144
pub fn with<F, R>(f: F) -> R
21392145
where F: for<'a, 'gcx, 'tcx> FnOnce(TyCtxt<'a, 'gcx, 'tcx>) -> R
21402146
{
@@ -2143,6 +2149,7 @@ pub mod tls {
21432149

21442150
/// Allows access to the TyCtxt in the current ImplicitCtxt.
21452151
/// The closure is passed None if there is no ImplicitCtxt available
2152+
#[inline]
21462153
pub fn with_opt<F, R>(f: F) -> R
21472154
where F: for<'a, 'gcx, 'tcx> FnOnce(Option<TyCtxt<'a, 'gcx, 'tcx>>) -> R
21482155
{

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)