Skip to content

Commit 49312a4

Browse files
committed
Auto merge of #32495 - Manishearth:rollup, r=<try>
Rollup of 18 pull requests - Successful merges: #32131, #32199, #32257, #32325, #32383, #32387, #32432, #32435, #32440, #32447, #32448, #32456, #32468, #32470, #32476, #32478, #32484, #32492 - Failed merges: #32240, #32469, #32482
2 parents a1e29da + 17ea3e8 commit 49312a4

File tree

302 files changed

+2422
-1588
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+2422
-1588
lines changed

configure

+2-2
Original file line numberDiff line numberDiff line change
@@ -969,11 +969,11 @@ then
969969
LLVM_VERSION=$($LLVM_CONFIG --version)
970970

971971
case $LLVM_VERSION in
972-
(3.[5-8]*)
972+
(3.[6-8]*)
973973
msg "found ok version of LLVM: $LLVM_VERSION"
974974
;;
975975
(*)
976-
err "bad LLVM version: $LLVM_VERSION, need >=3.5"
976+
err "bad LLVM version: $LLVM_VERSION, need >=3.6"
977977
;;
978978
esac
979979
fi

mk/crates.mk

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ TARGET_CRATES := libc std term \
5757
RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_driver \
5858
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
5959
rustc_data_structures rustc_front rustc_platform_intrinsics \
60-
rustc_plugin rustc_metadata rustc_passes
60+
rustc_plugin rustc_metadata rustc_passes rustc_save_analysis
6161
HOST_CRATES := syntax syntax_ext $(RUSTC_CRATES) rustdoc fmt_macros \
6262
flate arena graphviz rbml log serialize
6363
TOOLS := compiletest rustdoc rustc rustbook error_index_generator
@@ -102,7 +102,7 @@ DEPS_rustc_data_structures := std log serialize
102102
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
103103
rustc_typeck rustc_mir rustc_resolve log syntax serialize rustc_llvm \
104104
rustc_trans rustc_privacy rustc_lint rustc_front rustc_plugin \
105-
rustc_metadata syntax_ext rustc_passes
105+
rustc_metadata syntax_ext rustc_passes rustc_save_analysis
106106
DEPS_rustc_front := std syntax log serialize
107107
DEPS_rustc_lint := rustc log syntax
108108
DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
@@ -116,6 +116,7 @@ DEPS_rustc_privacy := rustc rustc_front log syntax
116116
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back rustc_mir \
117117
log syntax serialize rustc_llvm rustc_front rustc_platform_intrinsics \
118118
rustc_const_eval
119+
DEPS_rustc_save_analysis := rustc log syntax rustc_front
119120
DEPS_rustc_typeck := rustc syntax rustc_front rustc_platform_intrinsics rustc_const_eval
120121

121122
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \

src/bootstrap/mk/Makefile.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ standalone-docs:
3838
$(Q)$(BOOTSTRAP) --step doc-standalone
3939
check:
4040
$(Q)$(BOOTSTRAP) --step check
41-
cargotest:
42-
$(Q)$(BOOTSTRAP) --step cargotest
41+
check-cargotest:
42+
$(Q)$(BOOTSTRAP) --step check-cargotest
4343
dist:
4444
$(Q)$(BOOTSTRAP) --step dist
4545

src/doc/book/strings.md

+6
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ let s = "foo\
4444
assert_eq!("foobar", s);
4545
```
4646

47+
Note that you normally cannot access a `str` directly, but only through a `&str`
48+
reference. This is because `str` is an unsized type which requires additional
49+
runtime information to be usable. For more information see the chapter on
50+
[unsized types][ut].
51+
4752
Rust has more than only `&str`s though. A `String` is a heap-allocated string.
4853
This string is growable, and is also guaranteed to be UTF-8. `String`s are
4954
commonly created by converting from a string slice using the `to_string`
@@ -185,5 +190,6 @@ let hello_world = hello + &world;
185190
This is because `&String` can automatically coerce to a `&str`. This is a
186191
feature called ‘[`Deref` coercions][dc]’.
187192

193+
[ut]: unsized-types.html
188194
[dc]: deref-coercions.html
189195
[connect]: ../std/net/struct.TcpStream.html#method.connect

src/doc/reference.md

+3
Original file line numberDiff line numberDiff line change
@@ -3911,6 +3911,9 @@ The _heap_ is a general term that describes boxes. The lifetime of an
39113911
allocation in the heap depends on the lifetime of the box values pointing to
39123912
it. Since box values may themselves be passed in and out of frames, or stored
39133913
in the heap, heap allocations may outlive the frame they are allocated within.
3914+
An allocation in the heap is guaranteed to reside at a single location in the
3915+
heap for the whole lifetime of the allocation - it will never be relocated as
3916+
a result of moving a box value.
39143917

39153918
### Memory ownership
39163919

src/etc/CONFIGS.md

-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,3 @@ These are some links to repos with configs which ease the use of rust.
1010
* [kate-config](https://github.com/rust-lang/kate-config)
1111
* [nano-config](https://github.com/rust-lang/nano-config)
1212
* [zsh-config](https://github.com/rust-lang/zsh-config)
13-
14-
## Community-maintained Configs
15-
16-
* [.editorconfig](https://gist.github.com/derhuerst/c9d1b9309e308d9851fa) ([what is this?](http://editorconfig.org/))

src/libcore/str/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1953,7 +1953,10 @@ impl StrExt for str {
19531953

19541954
#[inline]
19551955
fn is_char_boundary(&self, index: usize) -> bool {
1956-
if index == self.len() { return true; }
1956+
// 0 and len are always ok.
1957+
// Test for 0 explicitly so that it can optimize out the check
1958+
// easily and skip reading string data for that case.
1959+
if index == 0 || index == self.len() { return true; }
19571960
match self.as_bytes().get(index) {
19581961
None => false,
19591962
Some(&b) => b < 128 || b >= 192,
@@ -2026,6 +2029,7 @@ impl StrExt for str {
20262029
self.find(pat)
20272030
}
20282031

2032+
#[inline]
20292033
fn split_at(&self, mid: usize) -> (&str, &str) {
20302034
// is_char_boundary checks that the index is in [0, .len()]
20312035
if self.is_char_boundary(mid) {

src/librustc/middle/cfg/construct.rs src/librustc/cfg/construct.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// except according to those terms.
1010

1111
use rustc_data_structures::graph;
12-
use middle::cfg::*;
12+
use cfg::*;
1313
use middle::def::Def;
1414
use middle::pat_util;
15-
use middle::ty::{self, TyCtxt};
15+
use ty::{self, TyCtxt};
1616
use syntax::ast;
1717
use syntax::ptr::P;
1818

src/librustc/middle/cfg/graphviz.rs src/librustc/cfg/graphviz.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use graphviz::IntoCow;
1818
use syntax::ast;
1919

2020
use front::map as ast_map;
21-
use middle::cfg;
21+
use cfg;
2222

2323
pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode);
2424
pub type Edge<'a> = &'a cfg::CFGEdge;

src/librustc/middle/cfg/mod.rs src/librustc/cfg/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! Uses `Graph` as the underlying representation.
1313
1414
use rustc_data_structures::graph;
15-
use middle::ty::TyCtxt;
15+
use ty::TyCtxt;
1616
use syntax::ast;
1717
use rustc_front::hir;
1818

src/librustc/dep_graph/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use self::thread::{DepGraphThreadData, DepMessage};
1212
use middle::def_id::DefId;
1313
use syntax::ast::NodeId;
14-
use middle::ty::TyCtxt;
14+
use ty::TyCtxt;
1515
use rustc_front::hir;
1616
use rustc_front::intravisit::Visitor;
1717
use std::rc::Rc;

src/librustc/diagnostics.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ compiled:
12611261
fn foo<T: Index<u8>>(x: T){}
12621262
12631263
#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
1264-
trait Index<Idx> { ... }
1264+
trait Index<Idx> { /* ... */ }
12651265
12661266
foo(true); // `bool` does not implement `Index<u8>`
12671267
```
@@ -1291,7 +1291,7 @@ compiled:
12911291
fn foo<T: Index<u8>>(x: T){}
12921292
12931293
#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
1294-
trait Index<Idx> { ... }
1294+
trait Index<Idx> { /* ... */ }
12951295
12961296
foo(true); // `bool` does not implement `Index<u8>`
12971297
```
@@ -1319,7 +1319,7 @@ compiled:
13191319
fn foo<T: Index<u8>>(x: T){}
13201320
13211321
#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
1322-
trait Index<Idx> { ... }
1322+
trait Index<Idx> { /* ... */ }
13231323
13241324
foo(true); // `bool` does not implement `Index<u8>`
13251325
```
File renamed without changes.

src/librustc/middle/infer/bivariate.rs src/librustc/infer/bivariate.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
use super::combine::{self, CombineFields};
2929
use super::type_variable::{BiTo};
3030

31-
use middle::ty::{self, Ty, TyCtxt};
32-
use middle::ty::TyVar;
33-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
31+
use ty::{self, Ty, TyCtxt};
32+
use ty::TyVar;
33+
use ty::relate::{Relate, RelateResult, TypeRelation};
3434

3535
pub struct Bivariate<'a, 'tcx: 'a> {
3636
fields: CombineFields<'a, 'tcx>

src/librustc/middle/infer/combine.rs src/librustc/infer/combine.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ use super::{InferCtxt};
4141
use super::{MiscVariable, TypeTrace};
4242
use super::type_variable::{RelationDir, BiTo, EqTo, SubtypeOf, SupertypeOf};
4343

44-
use middle::ty::{IntType, UintType};
45-
use middle::ty::{self, Ty, TyCtxt};
46-
use middle::ty::error::TypeError;
47-
use middle::ty::fold::{TypeFolder, TypeFoldable};
48-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
44+
use ty::{IntType, UintType};
45+
use ty::{self, Ty, TyCtxt};
46+
use ty::error::TypeError;
47+
use ty::fold::{TypeFolder, TypeFoldable};
48+
use ty::relate::{Relate, RelateResult, TypeRelation};
4949

5050
use syntax::ast;
5151
use syntax::codemap::Span;

src/librustc/middle/infer/equate.rs src/librustc/infer/equate.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use super::higher_ranked::HigherRankedRelations;
1313
use super::{Subtype};
1414
use super::type_variable::{EqTo};
1515

16-
use middle::ty::{self, Ty, TyCtxt};
17-
use middle::ty::TyVar;
18-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
16+
use ty::{self, Ty, TyCtxt};
17+
use ty::TyVar;
18+
use ty::relate::{Relate, RelateResult, TypeRelation};
1919

2020
/// Ensures `a` is made equal to `b`. Returns `a` on success.
2121
pub struct Equate<'a, 'tcx: 'a> {

src/librustc/middle/infer/error_reporting.rs src/librustc/infer/error_reporting.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ use rustc_front::print::pprust;
8080
use middle::cstore::CrateStore;
8181
use middle::def::Def;
8282
use middle::def_id::DefId;
83-
use middle::infer::{self, TypeOrigin};
83+
use infer::{self, TypeOrigin};
8484
use middle::region;
85-
use middle::subst;
86-
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
87-
use middle::ty::{Region, ReFree};
88-
use middle::ty::error::TypeError;
85+
use ty::subst;
86+
use ty::{self, Ty, TyCtxt, TypeFoldable};
87+
use ty::{Region, ReFree};
88+
use ty::error::TypeError;
8989

9090
use std::cell::{Cell, RefCell};
9191
use std::char::from_u32;

src/librustc/middle/infer/freshen.rs src/librustc/infer/freshen.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
//! variable only once, and it does so as soon as it can, so it is reasonable to ask what the type
3131
//! inferencer knows "so far".
3232
33-
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
34-
use middle::ty::fold::TypeFolder;
33+
use ty::{self, Ty, TyCtxt, TypeFoldable};
34+
use ty::fold::TypeFolder;
3535
use std::collections::hash_map::{self, Entry};
3636

3737
use super::InferCtxt;

src/librustc/middle/infer/glb.rs src/librustc/infer/glb.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use super::InferCtxt;
1414
use super::lattice::{self, LatticeDir};
1515
use super::Subtype;
1616

17-
use middle::ty::{self, Ty, TyCtxt};
18-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
17+
use ty::{self, Ty, TyCtxt};
18+
use ty::relate::{Relate, RelateResult, TypeRelation};
1919

2020
/// "Greatest lower bound" (common subtype)
2121
pub struct Glb<'a, 'tcx: 'a> {

src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/infer/higher_ranked/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
use super::{CombinedSnapshot, InferCtxt, HigherRankedType, SkolemizationMap};
1515
use super::combine::CombineFields;
1616

17-
use middle::ty::{self, TyCtxt, Binder, TypeFoldable};
18-
use middle::ty::error::TypeError;
19-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
17+
use ty::{self, TyCtxt, Binder, TypeFoldable};
18+
use ty::error::TypeError;
19+
use ty::relate::{Relate, RelateResult, TypeRelation};
2020
use syntax::codemap::Span;
2121
use util::nodemap::{FnvHashMap, FnvHashSet};
2222

src/librustc/middle/infer/lattice.rs src/librustc/infer/lattice.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
use super::combine;
3333
use super::InferCtxt;
3434

35-
use middle::ty::TyVar;
36-
use middle::ty::{self, Ty};
37-
use middle::ty::relate::{RelateResult, TypeRelation};
35+
use ty::TyVar;
36+
use ty::{self, Ty};
37+
use ty::relate::{RelateResult, TypeRelation};
3838

3939
pub trait LatticeDir<'f,'tcx> : TypeRelation<'f,'tcx> {
4040
fn infcx(&self) -> &'f InferCtxt<'f, 'tcx>;

src/librustc/middle/infer/lub.rs src/librustc/infer/lub.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use super::InferCtxt;
1414
use super::lattice::{self, LatticeDir};
1515
use super::Subtype;
1616

17-
use middle::ty::{self, Ty, TyCtxt};
18-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
17+
use ty::{self, Ty, TyCtxt};
18+
use ty::relate::{Relate, RelateResult, TypeRelation};
1919

2020
/// "Least upper bound" (common supertype)
2121
pub struct Lub<'a, 'tcx: 'a> {

src/librustc/middle/infer/mod.rs src/librustc/infer/mod.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub use self::LateBoundRegionConversionTime::*;
1414
pub use self::RegionVariableOrigin::*;
1515
pub use self::SubregionOrigin::*;
1616
pub use self::ValuePairs::*;
17-
pub use middle::ty::IntVarValue;
17+
pub use ty::IntVarValue;
1818
pub use self::freshen::TypeFreshener;
1919
pub use self::region_inference::{GenericKind, VerifyBound};
2020

@@ -24,16 +24,16 @@ use middle::free_region::FreeRegionMap;
2424
use middle::mem_categorization as mc;
2525
use middle::mem_categorization::McResult;
2626
use middle::region::CodeExtent;
27-
use middle::subst;
28-
use middle::subst::Substs;
29-
use middle::subst::Subst;
30-
use middle::traits::{self, ProjectionMode};
31-
use middle::ty::adjustment;
32-
use middle::ty::{TyVid, IntVid, FloatVid};
33-
use middle::ty::{self, Ty, TyCtxt};
34-
use middle::ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
35-
use middle::ty::fold::{TypeFolder, TypeFoldable};
36-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
27+
use ty::subst;
28+
use ty::subst::Substs;
29+
use ty::subst::Subst;
30+
use traits::{self, ProjectionMode};
31+
use ty::adjustment;
32+
use ty::{TyVid, IntVid, FloatVid};
33+
use ty::{self, Ty, TyCtxt};
34+
use ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
35+
use ty::fold::{TypeFolder, TypeFoldable};
36+
use ty::relate::{Relate, RelateResult, TypeRelation};
3737
use rustc_data_structures::unify::{self, UnificationTable};
3838
use std::cell::{RefCell, Ref};
3939
use std::fmt;
@@ -622,8 +622,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
622622
}
623623

624624
pub fn type_is_unconstrained_numeric(&'a self, ty: Ty) -> UnconstrainedNumeric {
625-
use middle::ty::error::UnconstrainedNumeric::Neither;
626-
use middle::ty::error::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat};
625+
use ty::error::UnconstrainedNumeric::Neither;
626+
use ty::error::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat};
627627
match ty.sty {
628628
ty::TyInfer(ty::IntVar(vid)) => {
629629
if self.int_unification_table.borrow_mut().has_value(vid) {

src/librustc/middle/infer/region_inference/graphviz.rs src/librustc/infer/region_inference/graphviz.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
/// For clarity, rename the graphviz crate locally to dot.
1919
use graphviz as dot;
2020

21-
use middle::ty::{self, TyCtxt};
21+
use ty::{self, TyCtxt};
2222
use middle::region::CodeExtent;
2323
use super::Constraint;
24-
use middle::infer::SubregionOrigin;
25-
use middle::infer::region_inference::RegionVarBindings;
24+
use infer::SubregionOrigin;
25+
use infer::region_inference::RegionVarBindings;
2626
use util::nodemap::{FnvHashMap, FnvHashSet};
2727

2828
use std::borrow::Cow;

src/librustc/middle/infer/region_inference/mod.rs src/librustc/infer/region_inference/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ use super::unify_key;
2323
use rustc_data_structures::graph::{self, Direction, NodeIndex};
2424
use rustc_data_structures::unify::{self, UnificationTable};
2525
use middle::free_region::FreeRegionMap;
26-
use middle::ty::{self, Ty, TyCtxt};
27-
use middle::ty::{BoundRegion, Region, RegionVid};
28-
use middle::ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound};
29-
use middle::ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
26+
use ty::{self, Ty, TyCtxt};
27+
use ty::{BoundRegion, Region, RegionVid};
28+
use ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound};
29+
use ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
3030
use util::common::indenter;
3131
use util::nodemap::{FnvHashMap, FnvHashSet};
3232

src/librustc/middle/infer/resolve.rs src/librustc/infer/resolve.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
use super::{InferCtxt, FixupError, FixupResult};
12-
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
12+
use ty::{self, Ty, TyCtxt, TypeFoldable};
1313

1414
///////////////////////////////////////////////////////////////////////////
1515
// OPPORTUNISTIC TYPE RESOLVER

src/librustc/middle/infer/sub.rs src/librustc/infer/sub.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use super::higher_ranked::HigherRankedRelations;
1313
use super::SubregionOrigin;
1414
use super::type_variable::{SubtypeOf, SupertypeOf};
1515

16-
use middle::ty::{self, Ty, TyCtxt};
17-
use middle::ty::TyVar;
18-
use middle::ty::relate::{Cause, Relate, RelateResult, TypeRelation};
16+
use ty::{self, Ty, TyCtxt};
17+
use ty::TyVar;
18+
use ty::relate::{Cause, Relate, RelateResult, TypeRelation};
1919
use std::mem;
2020

2121
/// Ensures `a` is made a subtype of `b`. Returns `a` on success.

0 commit comments

Comments
 (0)