Commit Graph

69903 Commits

Author SHA1 Message Date
Niko Matsakis
8d3219ed5e erase regions in MIR borrowck when checking if type moves by default 2017-11-16 05:57:46 -05:00
Niko Matsakis
ef392bc11b simplify lifetime annotations for MirBorrowckCtxt 2017-11-16 05:57:46 -05:00
Niko Matsakis
51ce1f9493 formalize giving ownership of region vars to region inf. context 2017-11-16 05:57:46 -05:00
Niko Matsakis
109c9a79ed infer: extract total number of region variables from infcx
We are heading towards deeper integration with the region inference
system in infcx; in particular, prior to the creation of the
`RegionInferenceContext`, it will be the "owner" of the set of region
variables.
2017-11-16 05:57:46 -05:00
Niko Matsakis
a87d1bbb93 infer: give access to region variable origins 2017-11-16 05:57:45 -05:00
Niko Matsakis
09b44bbe77 IndexVec: add '_ to make clear where borrowing is happening 2017-11-16 05:57:45 -05:00
Niko Matsakis
72675d82d7 replace RegionIndex with RegionVid (which now impls Idx) 2017-11-16 05:57:45 -05:00
Niko Matsakis
89c1b6009b replace usize with RegionIndex in indices map 2017-11-16 05:57:45 -05:00
Niko Matsakis
ad93b695d1 MIR typeck: refactor to track region constraints 2017-11-16 05:57:45 -05:00
Niko Matsakis
37945fe3e8 MIR typeck: rustfmt 2017-11-16 05:57:44 -05:00
Niko Matsakis
034018cd90 rustfmt lexical_region_resolve 2017-11-16 05:57:44 -05:00
Niko Matsakis
1430a600de add method take_and_reset_region_constraints to InferCtxt 2017-11-16 05:57:44 -05:00
Niko Matsakis
1efcf1a115 split the var_origins from the RegionConstraintData 2017-11-16 05:57:44 -05:00
Niko Matsakis
a8daa37df6 region_constraints: only push givens into undo-log if in a snapshot 2017-11-16 05:57:44 -05:00
Niko Matsakis
524e23ae2e make RegionVid implement Idx and use IndexVec 2017-11-16 05:57:44 -05:00
Niko Matsakis
bea6b94273 fix error messages relating to removing lint for E0276 2017-11-16 05:57:44 -05:00
Niko Matsakis
f6037f2816 separate the Collector from the Data it is collecting 2017-11-16 05:57:43 -05:00
Niko Matsakis
adf1519941 make the region_constraints field an Option
This way, we can `take()` ownership of it when we are going to resolve regions.
2017-11-16 05:57:43 -05:00
Niko Matsakis
326ec52eac rename RegionVarBindings to RegionConstraintCollector 2017-11-16 05:57:43 -05:00
Niko Matsakis
48d8f7210b infer: rename region_vars field to region_constraints 2017-11-16 05:57:43 -05:00
Niko Matsakis
23abd85138 rename region_inference module to region_constraints 2017-11-16 05:57:43 -05:00
Niko Matsakis
cff191d444 move refcells out from RegionVarBindings and up into InferCtxt 2017-11-16 05:57:42 -05:00
Niko Matsakis
63d658d87c extract the tcx out from RegionVarBindings 2017-11-16 05:57:42 -05:00
Niko Matsakis
daceedf314 region_inference: rustfmt 2017-11-16 05:57:42 -05:00
Niko Matsakis
ec48b018d6 extract storage of region values from RegionVarBindings 2017-11-16 05:57:42 -05:00
Niko Matsakis
b76978530c move RegionResolutionError into lexical_region_resolve 2017-11-16 05:57:42 -05:00
Niko Matsakis
8e9e15446f region_inference: extract taint into a sub-module 2017-11-16 05:57:41 -05:00
Niko Matsakis
9d63330b6d region_inference: tighten up pub, stop re-exporting enum variants 2017-11-16 05:57:41 -05:00
Niko Matsakis
ef5de07fc5 fix rename to block_data in type_check.rs 2017-11-16 05:57:34 -05:00
Marc-Antoine Perennou
1930ee8b94 rustbuild: Install rustfmt as part of extended build
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2017-11-16 10:47:26 +01:00
Guillaume Gomez
d57fed893e Rollup merge of #46010 - lnicola:escape-root, r=GuillaumeGomez
rustdoc: Escape doc root URLs

This fixes a small HTML injection issue.
2017-11-16 10:05:07 +01:00
Guillaume Gomez
b09af7064e Rollup merge of #46005 - GuillaumeGomez:short-unstable, r=nrc
Set short-message feature unstable

Fixes #45995.

r? @nrc
2017-11-16 10:05:06 +01:00
Guillaume Gomez
8debe610ee Rollup merge of #45993 - QuietMisdreavus:anti-cow, r=kennytm
examples in Cow::into_owned don't need to wrap result in Cows

This totally confused me until i triple-checked the actual return value and opened the examples in the playground myself.

r? @rust-lang/docs
2017-11-16 10:05:05 +01:00
Guillaume Gomez
ed64b97d61 Rollup merge of #45984 - ExpHP:attr-error-context, r=estebank
Add context to E0084, E0517, E0518

A small diagnostic enhancement to get my feet wet.  Please scrutinize!

This modifies errors E0084, E0517, and E0518 to include both the annotation and the annotated item.  All of these errors already had labels; I moved the label to the other span, and rephrased it as necessary.

Fixes #45886
2017-11-16 10:05:04 +01:00
Guillaume Gomez
3c1ea047da Rollup merge of #45973 - arielb1:fast-path, r=estebank
avoid the pprust infrastructure in macro expansion

This changes macro expansion to format the path of a macro directly
instead of usng the pprust infrastructure. The pprust infrastructure
tries to perform line-breaking in a slow fashion, which is undesired
when formatting the path of a macro.

This should to speed up expansion by a fair amount (I saw 20% on a
profiler on `rustc_mir`, and 50% of the time marked as "expansion" in
the profiler/time-passes is actually spent loading dependencies).

r? @jseyfried
2017-11-16 10:05:03 +01:00
Guillaume Gomez
387fa844bb Rollup merge of #45951 - CrockAgile:master, r=michaelwoerister
incr: Update hash tests to use `except`-style checking

Part of #44924

r? @michaelwoerister
2017-11-16 10:05:02 +01:00
Oliver Schneider
20eb27ed92
Reenable Clippy 2017-11-16 09:35:53 +01:00
bors
edd9dbcdbb Auto merge of #45985 - arielb1:unsafe-dedup, r=eddyb
check_unsafety: fix unused unsafe block duplication

The duplicate error message is later removed by error message
deduplication, but it still appears on beta and is still a bug.

r? @eddyb
2017-11-16 08:31:59 +00:00
bors
1410d56040 Auto merge of #45920 - sunfishcode:trap-on-unreachable, r=Zoxc
Enable TrapUnreachable in LLVM.

This patch enables LLVM's TrapUnreachable flag, which tells it to translate `unreachable` instructions into hardware trap instructions, rather than allowing control flow to "fall through" into whatever code happens to follow it in memory.

This follows up on https://github.com/rust-lang/rust/issues/28728#issuecomment-332581533. For example, for @zackw's testcase [here](https://github.com/rust-lang/rust/issues/42009#issue-228745924), the output function contains a `ud2` instead of no code, so it won't "fall through" into whatever happens to be next in memory.

(I'm also working on the problem of LLVM optimizing away infinite loops, but the patch here is useful independently.)

I tested this patch on a few different codebases, and the code size increase ranged from 0.0% to 0.1%.
2017-11-16 06:10:36 +00:00
bors
8385fc062d Auto merge of #46025 - nrc:rustfmt-fix, r=Mark-Simulacrum
Fix a bug where the rustfmt tarball was not being produced

r? @alexcrichton

This makes rustfmt a dep of 'extended', which seems to be necessary for the rustfmt dist step to actually get run.
2017-11-16 03:49:13 +00:00
Nick Cameron
262029eca9 Fix a bug where the rustfmt tarball was not being produced 2017-11-16 16:02:18 +13:00
bors
42ea30c8b0 Auto merge of #45692 - steveklabnik:ship-cargo-book, r=alexcrichton
Start shipping the Cargo book

Fixes #44910
Fixes #39588

See both of those bugs for more details.
2017-11-16 01:16:58 +00:00
Dan Gohman
ac48348db8 Update the compiler-builtins to latest master. 2017-11-15 16:07:48 -08:00
bors
b8c70b0fdf Auto merge of #45918 - chrisvittal:impl-trait-pr, r=nikomatsakis
Implement `impl Trait` in argument position (RFC1951, Universal quantification)

Implements the remainder of #44721, part of #34511.

**Note**: This PR currently allows argument position `impl Trait` in trait functions. The machinery is there to prevent this if we want to, but it currently does not.

Rename `hir::TyImplTrait` to `hir::TyImplTraitExistential` and add `hir::TyImplTraitUniversal(DefId, TyParamBounds)`. The `DefId` is needed to extract the index of the parameter in `ast_ty_to_ty`.

Introduce an `ImplTraitContext` enum to lowering to keep track of the kind and allowedness of `impl Trait` in that position. This new argument is passed through many places, all ending up in `lower_ty`.

Modify `generics_of` and `explicit_predicates_of` to collect the `impl Trait` args into anonymous synthetic generic parameters and to extend the predicates with the appropriate bounds.

Add a comparison of the 'syntheticness' of type parameters, that is, prevent the following.
```rust
trait Foo {
    fn foo(&self, &impl Debug);
}
impl Foo for Bar {
    fn foo<U: Debug>(&self, x: &U) { ... }
}
```
And vice versa.

Incedentally, supress `unused type parameter` errors if the type being compared is already a `TyError`.

**TODO**: I have tried to annotate open questions with **FIXME**s. The most notable ones that haven't been resolved are the names of the `impl Trait` types and the questions surrounding the new `compare_synthetic_generics` method.
1. For now, the names used for `impl Trait` parameters are `keywords::Invalid.name()`. I would like them to be `impl ...` if possible, but I haven't figured out a way to do that yet.
2. For `compare_synthetic_generics` I have tried to outline the open questions in the [function itself](3fc9e3705f/src/librustc_typeck/check/compare_method.rs (L714-L725))

r? @nikomatsakis
2017-11-15 22:47:54 +00:00
Niko Matsakis
58c77600a5 move region resolution to be a sibling of region_inference
Temporary make various fields public.
2017-11-15 16:58:14 -05:00
Niko Matsakis
467f2ea653 extract lexical region resolution into its own sub-module 2017-11-15 16:50:32 -05:00
Niko Matsakis
efa09dbea5 modify MIR type-checker to process obligations as they are incurred 2017-11-15 16:50:32 -05:00
Niko Matsakis
9e8abd704a apply rustfmt to type_check 2017-11-15 16:50:30 -05:00
Niko Matsakis
6d672961fb thread location info through mir typeck (but do not use) 2017-11-15 16:49:23 -05:00
Niko Matsakis
15a2dfa324 move the OutlivesEnvironment into infer so that nll can use it
Unquestionably there is more cleanup to be done, but I'm not sure what
it should look like yet, so leaving it roughly as is.
2017-11-15 16:49:22 -05:00