Skip to content

Commit 7846dbe

Browse files
committed
Auto merge of #40826 - frewsxcv:rollup, r=frewsxcv
Rollup of 7 pull requests - Successful merges: #40642, #40734, #40740, #40771, #40807, #40820, #40821 - Failed merges:
2 parents bcfd5c4 + dc52625 commit 7846dbe

File tree

26 files changed

+240
-146
lines changed

26 files changed

+240
-146
lines changed

src/doc/unstable-book/src/inclusive-range-syntax.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,15 @@ The tracking issue for this feature is: [#28237]
66

77
------------------------
88

9+
To get a range that goes from 0 to 10 and includes the value 10, you
10+
can write `0...10`:
911

12+
```rust
13+
#![feature(inclusive_range_syntax)]
1014

15+
fn main() {
16+
for i in 0...10 {
17+
println!("{}", i);
18+
}
19+
}
20+
```

src/libcore/num/dec2flt/algorithm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub fn fast_path<T: RawFloat>(integral: &[u8], fractional: &[u8], e: i64) -> Opt
141141
///
142142
/// It rounds ``f`` to a float with 64 bit significand and multiplies it by the best approximation
143143
/// of `10^e` (in the same floating point format). This is often enough to get the correct result.
144-
/// However, when the result is close to halfway between two adjecent (ordinary) floats, the
144+
/// However, when the result is close to halfway between two adjacent (ordinary) floats, the
145145
/// compound rounding error from multiplying two approximation means the result may be off by a
146146
/// few bits. When this happens, the iterative Algorithm R fixes things up.
147147
///
@@ -392,7 +392,7 @@ fn underflow<T: RawFloat>(x: Big, v: Big, rem: Big) -> T {
392392
//
393393
// Therefore, when the rounded-off bits are != 0.5 ULP, they decide the rounding
394394
// on their own. When they are equal and the remainder is non-zero, the value still
395-
// needs to be rounded up. Only when the rounded off bits are 1/2 and the remainer
395+
// needs to be rounded up. Only when the rounded off bits are 1/2 and the remainder
396396
// is zero, we have a half-to-even situation.
397397
let bits = x.bit_length();
398398
let lsb = bits - T::sig_bits() as usize;

src/libcore/slice/sort.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ fn partial_insertion_sort<T, F>(v: &mut [T], is_less: &mut F) -> bool
152152
fn insertion_sort<T, F>(v: &mut [T], is_less: &mut F)
153153
where F: FnMut(&T, &T) -> bool
154154
{
155-
for i in 2..v.len()+1 {
156-
shift_tail(&mut v[..i], is_less);
155+
for i in 1..v.len() {
156+
shift_tail(&mut v[..i+1], is_less);
157157
}
158158
}
159159

src/librustc/dep_graph/dep_node.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use hir::def_id::CrateNum;
1112
use std::fmt::Debug;
1213
use std::sync::Arc;
1314

@@ -81,7 +82,7 @@ pub enum DepNode<D: Clone + Debug> {
8182
TypeckItemType(D),
8283
UnusedTraitCheck,
8384
CheckConst(D),
84-
Privacy,
85+
PrivacyAccessLevels(CrateNum),
8586
IntrinsicCheck(D),
8687
MatchCheck(D),
8788

@@ -230,7 +231,7 @@ impl<D: Clone + Debug> DepNode<D> {
230231
CheckEntryFn => Some(CheckEntryFn),
231232
Variance => Some(Variance),
232233
UnusedTraitCheck => Some(UnusedTraitCheck),
233-
Privacy => Some(Privacy),
234+
PrivacyAccessLevels(k) => Some(PrivacyAccessLevels(k)),
234235
Reachability => Some(Reachability),
235236
DeadCheck => Some(DeadCheck),
236237
LateLintCheck => Some(LateLintCheck),

src/librustc/dep_graph/edges.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,15 @@ impl<D: Clone + Debug + Eq + Hash> DepGraphEdges<D> {
101101
}
102102

103103
/// Indicates that the current task `C` reads `v` by adding an
104-
/// edge from `v` to `C`. If there is no current task, panics. If
105-
/// you want to suppress this edge, use `ignore`.
104+
/// edge from `v` to `C`. If there is no current task, has no
105+
/// effect. Note that *reading* from tracked state is harmless if
106+
/// you are not in a task; what is bad is *writing* to tracked
107+
/// state (and leaking data that you read into a tracked task).
106108
pub fn read(&mut self, v: DepNode<D>) {
107-
let source = self.make_node(v);
108-
self.add_edge_from_current_node(|current| (source, current))
109+
if self.current_node().is_some() {
110+
let source = self.make_node(v);
111+
self.add_edge_from_current_node(|current| (source, current))
112+
}
109113
}
110114

111115
/// Indicates that the current task `C` writes `v` by adding an

src/librustc/dep_graph/shadow.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,13 @@ impl ShadowGraph {
8080

8181
let mut stack = self.stack.borrow_mut();
8282
match *message {
83-
DepMessage::Read(ref n) => self.check_edge(Some(Some(n)), top(&stack)),
83+
// It is ok to READ shared state outside of a
84+
// task. That can't do any harm (at least, the only
85+
// way it can do harm is by leaking that data into a
86+
// query or task, which would be a problem
87+
// anyway). What would be bad is WRITING to that
88+
// state.
89+
DepMessage::Read(_) => { }
8490
DepMessage::Write(ref n) => self.check_edge(top(&stack), Some(Some(n))),
8591
DepMessage::PushTask(ref n) => stack.push(Some(n.clone())),
8692
DepMessage::PushIgnore => stack.push(None),
@@ -116,7 +122,7 @@ impl ShadowGraph {
116122
(None, None) => unreachable!(),
117123

118124
// nothing on top of the stack
119-
(None, Some(n)) | (Some(n), None) => bug!("read/write of {:?} but no current task", n),
125+
(None, Some(n)) | (Some(n), None) => bug!("write of {:?} but no current task", n),
120126

121127
// this corresponds to an Ignore being top of the stack
122128
(Some(None), _) | (_, Some(None)) => (),

src/librustc/hir/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ impl Lifetime {
159159
pub fn is_elided(&self) -> bool {
160160
self.name == keywords::Invalid.name()
161161
}
162+
163+
pub fn is_static(&self) -> bool {
164+
self.name == keywords::StaticLifetime.name()
165+
}
162166
}
163167

164168
/// A lifetime definition, eg `'a: 'b+'c+'d`

src/librustc/lint/context.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ use std::ops::Deref;
4444
use syntax::attr;
4545
use syntax::ast;
4646
use syntax::symbol::Symbol;
47-
use syntax_pos::{MultiSpan, Span};
47+
use syntax_pos::{DUMMY_SP, MultiSpan, Span};
4848
use errors::{self, Diagnostic, DiagnosticBuilder};
4949
use hir;
50+
use hir::def_id::LOCAL_CRATE;
5051
use hir::intravisit as hir_visit;
5152
use syntax::visit as ast_visit;
5253

@@ -1231,10 +1232,11 @@ fn check_lint_name_cmdline(sess: &Session, lint_cx: &LintStore,
12311232
/// Perform lint checking on a crate.
12321233
///
12331234
/// Consumes the `lint_store` field of the `Session`.
1234-
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1235-
access_levels: &AccessLevels) {
1235+
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
12361236
let _task = tcx.dep_graph.in_task(DepNode::LateLintCheck);
12371237

1238+
let access_levels = &ty::queries::privacy_access_levels::get(tcx, DUMMY_SP, LOCAL_CRATE);
1239+
12381240
let krate = tcx.hir.krate();
12391241

12401242
// We want to own the lint store, so move it out of the session.

src/librustc/middle/cstore.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ pub trait CrateStore {
255255
fn used_crates(&self, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)>;
256256
fn used_crate_source(&self, cnum: CrateNum) -> CrateSource;
257257
fn extern_mod_stmt_cnum(&self, emod_id: ast::NodeId) -> Option<CrateNum>;
258-
fn encode_metadata<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
259-
reexports: &def::ExportMap,
258+
fn encode_metadata<'a, 'tcx>(&self,
259+
tcx: TyCtxt<'a, 'tcx, 'tcx>,
260260
link_meta: &LinkMeta,
261261
reachable: &NodeSet) -> Vec<u8>;
262262
fn metadata_encoding_version(&self) -> &[u8];
@@ -412,10 +412,10 @@ impl CrateStore for DummyCrateStore {
412412
{ vec![] }
413413
fn used_crate_source(&self, cnum: CrateNum) -> CrateSource { bug!("used_crate_source") }
414414
fn extern_mod_stmt_cnum(&self, emod_id: ast::NodeId) -> Option<CrateNum> { None }
415-
fn encode_metadata<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
416-
reexports: &def::ExportMap,
417-
link_meta: &LinkMeta,
418-
reachable: &NodeSet) -> Vec<u8> { vec![] }
415+
fn encode_metadata<'a, 'tcx>(&self,
416+
tcx: TyCtxt<'a, 'tcx, 'tcx>,
417+
link_meta: &LinkMeta,
418+
reachable: &NodeSet) -> Vec<u8> { vec![] }
419419
fn metadata_encoding_version(&self) -> &[u8] { bug!("metadata_encoding_version") }
420420
}
421421

src/librustc/middle/dead.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ use hir::itemlikevisit::ItemLikeVisitor;
2121
use middle::privacy;
2222
use ty::{self, TyCtxt};
2323
use hir::def::Def;
24-
use hir::def_id::{DefId};
24+
use hir::def_id::{DefId, LOCAL_CRATE};
2525
use lint;
2626
use util::nodemap::FxHashSet;
2727

2828
use syntax::{ast, codemap};
2929
use syntax::attr;
30+
use syntax::codemap::DUMMY_SP;
3031
use syntax_pos;
3132

3233
// Any local node that may call something in its body block should be
@@ -592,9 +593,9 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> {
592593
}
593594
}
594595

595-
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
596-
access_levels: &privacy::AccessLevels) {
596+
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
597597
let _task = tcx.dep_graph.in_task(DepNode::DeadCheck);
598+
let access_levels = &ty::queries::privacy_access_levels::get(tcx, DUMMY_SP, LOCAL_CRATE);
598599
let krate = tcx.hir.krate();
599600
let live_symbols = find_live(tcx, access_levels, krate);
600601
let mut visitor = DeadVisitor { tcx: tcx, live_symbols: live_symbols };

0 commit comments

Comments
 (0)