summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2018-09-07Validate syntax of `--cfg` command line argumentsVadim Petrochenkov-14/+25
2018-08-26Auto merge of #53425 - oli-obk:validation, r=nikomatsakisbors-16/+2
[beta] Don't sanity check function pointers in vtables cc https://github.com/rust-lang/rust/issues/53401 There's no beta nomination because the full fix (https://github.com/rust-lang/rust/pull/53424) is not backportable
2018-08-25An attempt to fix NLL migration mode so that reports region errors when ↵Felix S. Klock II-1/+8
necessary. Namely, the code here was trying to be clever, and say "lets not report diagnostics when we 'know' NLL will report an error about them in the future." The problem is that in migration mode, when no error was reported here, the NLL error that we "knew" was coming was downgraded to a warning (!). This fixes that by only doing the "clever" skipping of region error reporting when we are not in migration mode. Rather than make a separate test for issue 53026, I just took the test that uncovered this in a first place, and extended it (via our revisions system) to explicitly show all three modes in action: ACT-borrowck, NLL, and NLL migration mode. (Tto be honest I hope not to have to add such revisions to many tests. Instead I hope to adopt some sort of new `compare-mode` for either borrowck=migrate or for the 2018 edition as a whole.)
2018-08-17Don't sanity check function pointers in vtablesOliver Schneider-16/+2
2018-07-31assert no region obligations on entering custom type opNiko Matsakis-0/+13
Fixes #51649
2018-07-30Auto merge of #52830 - matthewjasper:bootstrap-prep, r=matthewjasperbors-3/+3
[NLL] Fix some things for bootstrap Some changes that are required when bootstrapping rustc with NLL enabled. * Remove a bunch of unused `mut`s that aren't needed, but the existing lint doesn't catch. * Rewrite a function call to satisfy NLL borrowck. Note that the borrow is two-phase, but gets activated immediately by an unsizing coercion. cc #51823
2018-07-30Auto merge of #52805 - ljedrz:format_str_literal, r=petrochenkovbors-90/+85
Don't format!() string literals Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
2018-07-29Auto merge of #52738 - ljedrz:push_to_extend, r=eddybbors-26/+17
Replace push loops with extend() where possible Or set the vector capacity where I couldn't do it. According to my [simple benchmark](https://gist.github.com/ljedrz/568e97621b749849684c1da71c27dceb) `extend`ing a vector can be over **10 times** faster than `push`ing to it in a loop: 10 elements (6.1 times faster): ``` test bench_extension ... bench: 75 ns/iter (+/- 23) test bench_push_loop ... bench: 458 ns/iter (+/- 142) ``` 100 elements (11.12 times faster): ``` test bench_extension ... bench: 87 ns/iter (+/- 26) test bench_push_loop ... bench: 968 ns/iter (+/- 3,528) ``` 1000 elements (11.04 times faster): ``` test bench_extension ... bench: 311 ns/iter (+/- 9) test bench_push_loop ... bench: 3,436 ns/iter (+/- 233) ``` Seems like a good idea to use `extend` as much as possible.
2018-07-29Sanity-check all constantsOliver Schneider-6/+22
2018-07-29Remove unused `mut`sMatthew Jasper-3/+3
2018-07-29Replace push loops with collect() and extend() where possibleljedrz-26/+17
2018-07-29Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkovbors-28/+28
Prefer to_string() to format!() Simple benchmarks suggest in some cases it can be faster by even 37%: ``` test converting_f64_long ... bench: 339 ns/iter (+/- 199) test converting_f64_short ... bench: 136 ns/iter (+/- 34) test converting_i32_long ... bench: 87 ns/iter (+/- 16) test converting_i32_short ... bench: 87 ns/iter (+/- 49) test converting_str ... bench: 54 ns/iter (+/- 15) test formatting_f64_long ... bench: 349 ns/iter (+/- 176) test formatting_f64_short ... bench: 145 ns/iter (+/- 14) test formatting_i32_long ... bench: 98 ns/iter (+/- 14) test formatting_i32_short ... bench: 93 ns/iter (+/- 15) test formatting_str ... bench: 86 ns/iter (+/- 23) ```
2018-07-29Auto merge of #52764 - sinkuu:cleanup, r=nikomatsakisbors-10/+11
Misc cleanups
2018-07-28Auto merge of #52355 - pietroalbini:zfeature, r=eddybbors-0/+3
Add the -Zcrate-attr=foo unstable rustc option This PR adds a new unstable option to `rustc`: `-Zcrate-attr=foo`. The option can be used to inject crate-level attributes from the CLI, and it's meant to be used by tools like Crater that needs to add their own attributes to a crate without changing the source code. The exact reason I need this is to implement "edition runs" in Crater: we need to add the preview feature flag to every crate, and editing the crates' source code on the fly might produce unexpected results, while a compiler flag is more reliable. cc https://github.com/rust-lang-nursery/crater/issues/282 @Mark-Simulacrum
2018-07-28Auto merge of #52546 - nikomatsakis:issue-52050, r=pnkfelixbors-22/+79
do not overwrite child def-id in place but rather remove/insert When inserting a node N into the tree of impls, we sometimes find than an existing node C should be replaced with N. We used to overwrite C in place with the new def-id N -- but since the lists of def-ids are separated by simplified type, that could lead to N being inserted in the wrong place. This meant we might miss conflicts. We are now not trying to be so smart -- we remove C and then add N later. Fixes #52050 r? @aturon -- do you still remember this code at all? :)
2018-07-28Don't format!() string literalsljedrz-90/+85
2018-07-28Auto merge of #52711 - eddyb:unsized-manuallydrop, r=nikomatsakisbors-2/+11
Change ManuallyDrop<T> to a lang item. This PR implements the approach @RalfJung proposes in https://internals.rust-lang.org/t/pre-rfc-unions-drop-types-and-manuallydrop/8025 (lang item `struct` instead of `union`). A followup PR can easily solve #47034 as well, by just adding a few `?Sized` to `libcore/mem.rs`. r? @nikomatsakis
2018-07-28Rollup merge of #52781 - ljedrz:avoid_vec_arguments, r=nikomatsakiskennytm-5/+5
Use a slice where a vector is not necessary
2018-07-28Rollup merge of #52765 - sinkuu:remove_nonzeroing_move_opt, r=pnkfelixkennytm-9/+0
Remove unused "-Zenable_nonzeroing_move_hints" flag Removing a dead option which seems to be a remnant of the old drop-flag system.
2018-07-28Rollup merge of #52703 - ljedrz:vec_improvements, r=nikomatsakiskennytm-14/+7
Improve a few vectors - calculate capacity or build from iterators Collecting from iterators improves readability and tailoring vector capacities should be beneficial in terms of performance.
2018-07-27Auto merge of #52336 - ishitatsuyuki:dyn-rollup, r=Mark-Simulacrumbors-2/+0
Rollup of bare_trait_objects PRs All deny attributes were moved into bootstrap so they can be disabled with a line of config. Warnings for external tools are allowed and it's up to the tool's maintainer to keep it warnings free. r? @Mark-Simulacrum cc @ljedrz @kennytm
2018-07-27Add the -Zcrate-attr=foo nightly rustc flag to inject crate attributesPietro Albini-0/+3
2018-07-27Use slices where a vector is not necessaryljedrz-5/+5
2018-07-27Better Option handlingShotaro Yamada-7/+9
2018-07-27Remove unnecessary `.collect()`Shotaro Yamada-1/+1
2018-07-27Use str::repeatShotaro Yamada-2/+1
2018-07-27Auto merge of #52648 - davidtwco:issue-52533, r=nikomatsakisbors-6/+36
[nll] improve the "fully elaborated type" case in region errors Fixes #52533. r? @nikomatsakis
2018-07-27Improved mechanism for naming regions in non-annotated types.David Wood-5/+35
2018-07-27Added fully elaborated type label for inferred arguments.David Wood-1/+1
2018-07-27Prefer to_string() to format!()ljedrz-28/+28
2018-07-27Auto merge of #52681 - pnkfelix:z-borrowck-migrate, r=nikomatsakisbors-11/+74
Add `-Z borrowck=migrate` This adds `-Z borrowck=migrate`, which represents the way we want to migrate to NLL under Rust versions to come. It also hooks this new mode into `--edition 2018`, which means we're officially turning NLL on in the 2018 edition. The basic idea of `-Z borrowck=migrate` that there are cases where NLL is fixing old soundness bugs in the borrow-checker, but in order to avoid just breaking code by immediately rejecting the programs that hit those soundness bugs, we instead use the following strategy: If your code is accepted by NLL, then we accept it. If your code is rejected by both NLL and the old AST-borrowck, then we reject it. If your code is rejected by NLL but accepted by the old AST-borrowck, then we emit the new NLL errors as **warnings**. These warnings will be turned into hard errors in the future, and they say so in these diagnostics. Fix #46908
2018-07-27Remove unused option flagShotaro Yamada-9/+0
2018-07-27Auto merge of #52650 - oli-obk:associated_existential_types, r=nikomatsakisbors-24/+57
Implement associated existential types r? @nikomatsakis no idea if these work with generic traits. I'm going home for the day :rofl:
2018-07-26Improve a few vectors - calculate capacity or build from iteratorsljedrz-14/+7
2018-07-26Auto merge of #52735 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-0/+24
Rollup of 16 pull requests Successful merges: - #52558 (Add tests for ICEs which no longer repro) - #52610 (Clarify what a task is) - #52617 (Don't match on region kinds when reporting NLL errors) - #52635 (Fix #[linkage] propagation though generic functions) - #52647 (Suggest to take and ignore args while closure args count mismatching) - #52649 (Point spans to inner elements of format strings) - #52654 (Format linker args in a way that works for gcc and ld) - #52667 (update the stdsimd submodule) - #52674 (Impl Executor for Box<E: Executor>) - #52690 (ARM: expose `rclass` and `dsp` target features) - #52692 (Improve readability in a few sorts) - #52695 (Hide some lints which are not quite right the way they are reported to the user) - #52718 (State default capacity for BufReader/BufWriter) - #52721 (std::ops::Try impl for std::task::Poll) - #52723 (rustc: Register crates under their real names) - #52734 (sparc ABI issue - structure returning from function is returned in 64bit registers (with tests)) Failed merges: - #52678 ([NLL] Use better spans in some errors) r? @ghost
2018-07-26Auto merge of #52488 - nikomatsakis:nll-issue-48071-universe-and-sub, r=pnkfelixbors-10/+74
introduce universes to NLL type check This branch aims to fix #48071 and also advance chalk integration a bit at the same time. It re-implements the subtyping/type-equating check so that NLL doesn't "piggy back" on the subtyping code of the old type checker. This new code uses the "universe-based" approach to handling higher-ranked lifetimes, which sidesteps some of the limitations of the current "leak-based" scheme. This avoids the ICE in #48071. At the same time, I aim for this to potentially be a kind of optimization. This NLL code is (currently) not cached, but it also generates constraints without doing as much instantiation, substitution, and folding. Right now, though, it still piggy backs on the `relate_tys` trait, which is a bit unfortunate -- it means we are doing more hashing and things than we have to. I want to measure the see the perf. Refactoring that trait is something I'd prefer to leave for follow-up work. r? @pnkfelix -- but I want to measure perf etc first
2018-07-26Rollup merge of #52647 - csmoe:closure_arg_ignore, r=estebankMark Rousskov-0/+24
Suggest to take and ignore args while closure args count mismatching Closes #52473
2018-07-26integrate the edition code.Felix S. Klock II-26/+44
As a driveby change, I made `#![feature(nll)]` *always* take precedence over `-Z borrowck`. The main effect this had is that it means tests with `#![feature(nll)]` will ignore uses of `-Z borrowck=compare`. This affected only one test as far as I can tell, and I think that test used `-Z borrowck=compare` only as a historical accident.
2018-07-26Bug fix: `#![feature(nll)]` takes precedence over `-Z borrowck=migrate`.Felix S. Klock II-1/+16
(Includes test illustrating desired behavior; compare its diagnostic output to that of the file `borrowck-migreate-to-nll.rs`.)
2018-07-26Add `migrate` to list of values for `-Z borrowck=...`Felix S. Klock II-1/+1
2018-07-26Add `-Z borrowck=migrate` flag, use it to link NLL up to AST-borrowck.Felix S. Klock II-0/+22
2018-07-26Add flag indicating whether AST `borrowck` query signalled any error.Felix S. Klock II-0/+8
2018-07-25Change ManuallyDrop from an union to a struct and make it a lang item.Eduard-Mihai Burtescu-2/+11
2018-07-25Add type system canaries for potential future bugsOliver Schneider-1/+5
2018-07-25Remove useless commentOliver Schneider-1/+1
2018-07-25Fix associated existentials for generic traitsOliver Schneider-1/+2
2018-07-25introduce new subtypingNiko Matsakis-2/+53
2018-07-25simplify `NLLRegionVariableOrigin`Niko Matsakis-1/+14
2018-07-25parameterize `BitVector` and `BitMatrix` by their index typesNiko Matsakis-7/+6
2018-07-25Update comment and do suggestcsmoe-8/+9