about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2018-05-04First step towards rustfix compiletest modePascal Hertleif-0/+20
This is the first small step towards testing auto-fixable compiler suggestions using compiletest. Currently, it only checks if next to a UI test there also happens to a `*.rs.fixed` file, and then uses rustfix (added as external crate) on the original file, and asserts that it produces the fixed version. To show that this works, I've included one such test. I picked this test case at random (and because it was simple) -- It is not relevant to the 2018 edition. Indeed, in the near future, we want to be able to restrict rustfix to edition-lints, so this test cast might go away soon. In case you still think this is somewhat feature-complete, here's a quick list of things currently missing that I want to add before telling people they can use this: - [ ] Make this an actual compiletest mode, with `test [fix] …` output and everything - [ ] Assert that fixed files still compile - [ ] Assert that fixed files produce no (or a known set of) diagnostics output - [ ] Update `update-references.sh` to support rustfix - [ ] Use a published version of rustfix (i.e.: publish a new version rustfix that exposes a useful API for this)
2018-05-04Auto merge of #49870 - ↵bors-53/+122
pnkfelix:issue-27282-immut-borrow-all-pat-ids-in-guards, r=nikomatsakis Immutably and implicitly borrow all pattern ids for their guards (NLL only) This is an important piece of rust-lang/rust#27282. It applies only to NLL mode. It is a change to MIR codegen that is currently toggled on only when NLL is turned on. It thus affect MIR-borrowck but not the earlier static analyses (such as the type checker). This change makes it so that any pattern bindings of type T for a match arm will map to a `&T` within the context of the guard expression for that arm, but will continue to map to a `T` in the context of the arm body. To avoid surfacing this type distinction in the user source code (which would be a severe change to the language and would also require far more revision to the compiler internals), any occurrence of such an identifier in the guard expression will automatically get a deref op applied to it. So an input like: ```rust let place = (1, Foo::new()); match place { (1, foo) if inspect(foo) => feed(foo), ... } ``` will be treated as if it were really something like: ```rust let place = (1, Foo::new()); match place { (1, Foo { .. }) if { let tmp1 = &place.1; inspect(*tmp1) } => { let tmp2 = place.1; feed(tmp2) }, ... } ``` And an input like: ```rust let place = (2, Foo::new()); match place { (2, ref mut foo) if inspect(foo) => feed(foo), ... } ``` will be treated as if it were really something like: ```rust let place = (2, Foo::new()); match place { (2, Foo { .. }) if { let tmp1 = & &mut place.1; inspect(*tmp1) } => { let tmp2 = &mut place.1; feed(tmp2) }, ... } ``` In short, any pattern binding will always look like *some* kind of `&T` within the guard at least in terms of how the MIR-borrowck views it, and this will ensure that guard expressions cannot mutate their the match inputs via such bindings. (It also ensures that guard expressions can at most *copy* values from such bindings; non-Copy things cannot be moved via these pattern bindings in guard expressions, since one cannot move out of a `&T`.)
2018-05-04Auto merge of #50435 - cuviper:rm-lookup_host, r=sfacklerbors-4/+2
Remove the deprecated std::net::{lookup_host,LookupHost} These are unstable, and were deprecated by #47510, since Rust 1.25. The internal `sys` implementations are still kept to support the call in the common `resolve_socket_addr`.
2018-05-04Update mir-opt test to reflect change to MIR code-generation.Felix S. Klock II-53/+61
2018-05-04Auto merge of #50409 - KiChjang:issue-50343, r=nikomatsakisbors-0/+34
Skip checking for unused mutable locals that have no name Fixes #50343.
2018-05-03Remove the deprecated std::net::{lookup_host,LookupHost}Josh Stone-4/+2
These are unstable, and were deprecated by #47510, since Rust 1.25. The internal `sys` implementations are still kept to support the call in the common `resolve_socket_addr`.
2018-05-03Auto merge of #50413 - kennytm:rollup, r=kennytmbors-7/+109
Rollup of 12 pull requests Successful merges: - #50302 (Add query search order check) - #50320 (Fix invalid path generation in rustdoc search) - #50349 (Rename "show type declaration" to "show declaration") - #50360 (Clarify wordings of the `unstable_name_collision` lint.) - #50365 (Use two vectors in nearest_common_ancestor.) - #50393 (Allow unaligned reads in constants) - #50401 (Revert "Implement FromStr for PathBuf") - #50406 (Forbid constructing empty identifiers from concat_idents) - #50407 (Always inline simple BytePos and CharPos methods.) - #50416 (check if the token is a lifetime before parsing) - #50417 (Update Cargo) - #50421 (Fix ICE when using a..=b in a closure.) Failed merges:
2018-05-04Rollup merge of #50320 - GuillaumeGomez:fix-search-path-generation, ↵kennytm-4/+6
r=QuietMisdreavus Fix invalid path generation in rustdoc search Fixes #50311.
2018-05-03Fix invalid path generation in rustdoc searchGuillaume Gomez-4/+6
2018-05-04Rollup merge of #50416 - rleungx:non-lifetime, r=estebankkennytm-0/+20
check if the token is a lifetime before parsing Fixes #50381.
2018-05-04Rollup merge of #50406 - ExpHP:concat-nonzero-idents, r=dtolnaykennytm-0/+23
Forbid constructing empty identifiers from concat_idents The empty identifier is a [reserved identifier](https://github.com/rust-lang/rust/blob/8a37c75a3a661385cc607d934c70e86a9eaf5fd7/src/libsyntax_pos/symbol.rs#L300-L305) in rust, apparently used for black magicks like representing the crate root or somesuch... and therefore, being able to construct it is Ungood. Presumably. ...even if the macro that lets you construct it is so useless that you can't actually do any damage with it. (and believe me, I tried) Fixes #50403. **Note:** I noticed that when you try to do something similar with `proc_macro::Term`, the compiler actually catches it and flags the identifier as reserved. Perhaps a better solution would be to somehow have that same check applied here.
2018-05-04Rollup merge of #50421 - ↵kennytm-0/+27
kennytm:fix-50415-ice-when-returning-range-inclusive-from-closure, r=michaelwoerister Fix ICE when using a..=b in a closure. Fix #50415.
2018-05-04Rollup merge of #50393 - oli-obk:packed_const_panic, r=eddybkennytm-0/+28
Allow unaligned reads in constants fixes #50356 introduced in https://github.com/rust-lang/rust/pull/49513
2018-05-04Rollup merge of #50360 - kennytm:fix-50232-clarify-unstable-name-collision, ↵kennytm-2/+2
r=nikomatsakis Clarify wordings of the `unstable_name_collision` lint. Stabilizing an inherent method may cause change in behavior instead of inference error. Updated to use the wording from [varkor's comment]. Closes #50232. [varkor's comment]: https://github.com/rust-lang/rust/issues/50232#issuecomment-384678097
2018-05-03Fix issue #50415.kennytm-0/+27
2018-05-03Unit test for the new implicit borrow and deref within theFelix S. Klock II-0/+61
guard expressions of matches (activated only when using new NLL mode). Review feedback: removed 27282 from filename. (The test still references it in a relevant comment in the file itself so that seemed like a reasonable compromise.)
2018-05-03Auto merge of #50030 - flip1995:rfc2103, r=petrochenkovbors-2/+100
Implement tool_attributes feature (RFC 2103) cc #44690 This is currently just a rebased and compiling (hopefully) version of #47773. Let's see if travis likes this. I will add the implementation for `tool_lints` this week.
2018-05-03check if the token is a lifetime before parsingrleungx-0/+20
2018-05-03Rollup merge of #50302 - GuillaumeGomez:add-query-search-order-check, ↵kennytm-1/+3
r=QuietMisdreavus Add query search order check Fixes #50180. r? @QuietMisdreavus
2018-05-03Auto merge of #50378 - varkor:repr-align-max-29, r=eddybbors-1/+4
Reduce maximum repr(align(N)) to 2^29 The current maximum `repr(align(N))` alignment is larger than the maximum alignment accepted by LLVM, which can cause issues for huge values of `N`, as seen in #49492. Fixes #49492. r? @rkruppe
2018-05-02Skip checking for unused mutable locals that have no nameKeith Yeung-0/+34
2018-05-03add missing output for ui testMichael Lamparski-0/+8
2018-05-02forbid empty identifiers from concat_identsMichael Lamparski-0/+15
2018-05-02Auto merge of #50355 - petrochenkov:50187, r=oli-obkbors-0/+49
Fix an unresolved import issue with enabled `use_extern_macros` This is a kinda ugly special-purpose solution that will break if we suddenly add a fourth namespace, but I hope to come up with something more general if I get to import resolution refactoring this summer. Fixes https://github.com/rust-lang/rust/issues/50187 thus removing a blocker for stabilization of `use_extern_macros`
2018-05-02Auto merge of #50354 - varkor:initial-field-alignment-c-int, r=eddybbors-0/+102
Correct initial field alignment for repr(C)/repr(int) Fixes #50098 following https://github.com/rust-lang/rust/issues/50098#issuecomment-385497333. (I wasn't sure which kind of test was best suited here — I picked run-pass simply because that was convenient, but if codegen is more appropriate, let me know and I'll change it.) r? @eddyb
2018-05-02Allow unaligned reads in constantsOliver Schneider-0/+28
2018-05-02Auto merge of #49943 - pnkfelix:fix-issue-49918, r=nikomatsakisbors-32/+74
Treat generators as if they have an arbitrary destructor Conservatively assume dropping a generator touches its upvars, via locals' destructors. Fix #49918
2018-05-02fix testsflip1995-2/+2
2018-05-02make it compile againflip1995-4/+5
2018-05-02Change Attribute::name to return the last segmentSeiichi Uchida-3/+3
And fix some typos
2018-05-02Add tests for a new feature 'tool_attributes'Seiichi Uchida-0/+97
2018-05-01Auto merge of #49982 - petrochenkov:noreex, r=alexcrichtonbors-548/+237
Remove unstable `macro_reexport` It's subsumed by `feature(use_extern_macros)` and `pub use` cc https://github.com/rust-lang/rust/issues/35896 closes https://github.com/rust-lang/rust/issues/29638 closes https://github.com/rust-lang/rust/issues/38951
2018-05-01Reduce the maximum alignment to repr(align(1 << 29))varkor-1/+4
This brings it into line with LLVM's maximum permitted alignment.
2018-05-01Update ui/generator tests to reflect changes from new generator drop rules.Felix S. Klock II-32/+74
2018-05-01Add a print_types_sizes regression testvarkor-0/+47
2018-05-01Add repr(u8) to the testvarkor-0/+16
2018-05-01Correct initial field alignment for repr(C)/repr(int)varkor-0/+39
2018-05-01Auto merge of #49789 - petrochenkov:prelext, r=nikomatsakisbors-0/+171
Module experiments: Add one more prelude layer for extern crate names passed with `--extern` Implements one item from https://internals.rust-lang.org/t/the-great-module-adventure-continues/6678/183 When some name is looked up in lexical scope (`name`, i.e. not module-relative scope `some_mod::name` or `::name`), it's searched roughly in the next order: - local variables - items in unnamed blocks - items in the current module - :sparkles: NEW! :sparkles: crate names passed with `--extern` ("extern prelude") - standard library prelude (`Vec`, `drop`) - language prelude (built-in types like `u8`, `str`, etc) The last two layers contain a limited set of names controlled by us and not arbitrary user-defined names like upper layers. We want to be able to add new names into these two layers without breaking user code, so "extern prelude" names have higher priority than std prelude and built-in types. This is a one-time breaking change, that's why it would be nice to run this through crater. Practical impact is expected to be minimal though due to stylistic reasons (there are not many `Uppercase` crates) and due to the way how primitive types are resolved (https://github.com/rust-lang/rust/pull/32131).
2018-05-01Fix an error from "unused" lint + Fix rebaseVadim Petrochenkov-82/+74
2018-05-01Give removal reasons to removed featuresVadim Petrochenkov-0/+6
2018-05-01Remove `macro_reexport`Vadim Petrochenkov-547/+238
It's subsumed by `feature(use_extern_macros)` and `pub use`
2018-05-01Auto merge of #50198 - oli-obk:const_prop, r=eddybbors-9/+8
Remove some unused code
2018-05-01Clarify wordings of the `unstable_name_collision` lint.kennytm-2/+2
Stabilizing an inherent method may cause change in behavior instead of inference error. Updated to use the wording from [varkor's comment]. Closes #50232. [varkor's comment]: https://github.com/rust-lang/rust/issues/50232#issuecomment-384678097
2018-05-01Auto merge of #48786 - nagisa:fp, r=nikomatsakisbors-0/+17
Add force-frame-pointer flag to allow control of frame pointer ommision Rebase of #47152 plus some changes suggested by https://github.com/rust-lang/rust/issues/48785. Fixes #11906 r? @nikomatsakis
2018-05-01Force frame pointers for the backtrace testSimonas Kazlauskas-0/+1
2018-05-01Rework force-frame-pointerSimonas Kazlauskas-1/+1
This reworks the force-frame-pointer PR to explicitly only consider the value of the flag if it is provided, and use a target default otherwise. Something that was tried but not kept was renaming the flag to `frame-pointer`, because for flag `frame-pointer=no`, there is no guarante, that LLVM will elide *all* the frame pointers; oposite of what the literal reading of the flag would suggest.
2018-05-01Don't force-enable frame pointers when generating debug infoBjörn Steinbrink-0/+16
We apparently used to generate bad/incomplete debug info causing debuggers not to find symbols of stack allocated variables. This was somehow worked around by having frame pointers. With the current codegen, this seems no longer necessary, so we can remove the code that force-enables frame pointers whenever debug info is requested. Since certain situations, like profiling code profit from having frame pointers, we add a -Cforce-frame-pointers flag to always enable frame pointers. Fixes #11906
2018-05-01Auto merge of #50304 - nox:uninhabited-output, r=eddybbors-6/+16
Mark functions returning uninhabited types as noreturn
2018-05-01Better support for import resolution in 3 namespacesVadim Petrochenkov-0/+49
2018-04-30Auto merge of #48925 - zackmdavis:fn_must_stabilize, r=nikomatsakisbors-239/+104
stabilize `#[must_use]` for functions and must-use comparison operators (RFC 1940) r? @nikomatsakis