about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2017-05-11do not fetch variance for items when equatingNiko Matsakis-0/+43
Fixes #41849. Problem was that evaluating the constant expression required evaluating a trait, which would equate types, which would request variance information, which it would then discard. However, computing the variance information would require determining the type of a field, which would evaluate the constant expression. (This problem will potentially arise *later* as we move to more sophisticated constants, however, where we need to check subtyping. We can tackle that when we come to it.)
2017-05-11Rollup merge of #41873 - michaelwoerister:fix-filemap-hash-lookup, ↵Corey Farwell-0/+44
r=nikomatsakis ICH: Handle case of removed FileMaps. This PR fixes a bug introduced in #41709 where removing a source file between compilation sessions would cause an ICE: https://travis-ci.org/rust-icci/crossbeam/jobs/230582234#L633 r? @nikomatsakis
2017-05-11Rollup merge of #41192 - zackw:eprintln, r=alexcrichtonCorey Farwell-0/+40
Add `eprint!` and `eprintln!` macros to the prelude. These are exactly the same as `print!` and `println!` except that they write to stderr instead of stdout. Issues #39228 and #40528; previous PR #39229; accepted RFC rust-lang/rfcs#1869; proposed revision to The Book rust-lang/book#615. I have _not_ revised this any since the original submission; I will do that later this week. I wanted to get this PR in place since it's been quite a while since the RFC was merged. Known outstanding review comments: * [x] @steveklabnik requested a new chapter for the unstable version of The Book -- please see if the proposed revisions to the second edition cover it. * [x] @nodakai asked if it were possible to merge the internal methods `_print` and `_eprint` - not completely, since they both refer to different internal globals which we don't want to expose, but I will see if some duplication can be factored out. Please let me know if I missed anything.
2017-05-10Skip print-stdout-eprint-stderr test on emscriptenZack Weinberg-0/+2
2017-05-10Fix up stability annotations per feedback.Zack Weinberg-2/+0
2017-05-10Add `eprint!` and `eprintln!` macros to the prelude.Zack Weinberg-0/+40
These are exactly the same as `print!` and `println!` except that they write to stderr instead of stdout. Issue #39228.
2017-05-10ICH: Handle case of removed FileMaps.Michael Woerister-0/+44
2017-05-09Improve E0477 error messageGuillaume Gomez-0/+26
2017-05-09Auto merge of #41709 - michaelwoerister:close-metadata-ich-holes, r=nikomatsakisbors-0/+66
incr.comp.: Hash more pieces of crate metadata to detect changes there. This PR adds incr. comp. hashes for non-`Entry` pieces of data in crate metadata. The first part of it I like: `EntryBuilder` is refactored into the more generally applicable `IsolatedEncoder` which provides means of encoding something into metadata while also feeding the encoded data into an incr. comp. hash. We already did this for `Entry`, now we are doing it for various other pieces of data too, like the set of exported symbols and so on. The hashes generated there are persisted together with the per-`Entry` hashes and are also used for dep-graph dirtying the same way. The second part of the PR I'm not entirely happy with: In order to make sure that we don't forget registering a read to the new `DepNodes` introduced here, I added the `Tracked<T>` struct. This struct wraps a value and requires a `DepNode` when accessing the wrapped value. This makes it harder to overlook adding read edges in the right places and works just fine. However, crate metadata is already used in places where there is no `tcx` yet or even in places where no `cnum` has been assigned -- this makes it harder to apply this feature consistently or implement it ergonomically. The result is not too bad but there's a bit more code churn and a bit more opportunity to get something wrong than I would have liked. On the other hand, wrapping things in `Tracked<T>` already has revealed some bugs, so there's definitely some value in it. This is still a work in progress: - [x] I need to write some test cases. - [x] Accessing the CodeMap should really be dependency tracked too, especially with the new path-remapping feature. cc @nikomatsakis
2017-05-09Auto merge of #41777 - nikomatsakis:issue-41697-mir-dump-cycle, r=arielb1bors-0/+50
dump-mir was causing cycles by invoking item-path-str at bad times Workaround for now, but probably a better fix is to opt **in** to using the types for impls (if we do that at all; maybe filename/line is better). Fixes #41697
2017-05-08Rollup merge of #41838 - z1mvader:fix_fn_args_coerce_closure, r=nikomatsakisCorey Farwell-8/+54
Fixed argument inference for closures when coercing into 'fn' This fixes https://github.com/rust-lang/rust/issues/41755. The tests `compile-fail/closure-no-fn.rs` and `compile-fail/issue-40000.rs` were modified. A new test `run-pass/closure_to_fn_coercion-expected-types.rs` was added r? @nikomatsakis
2017-05-08Rollup merge of #41828 - arielb1:lvalue-ops, r=eddybCorey Farwell-0/+78
try to fix lvalue ops for real Hopefully this is the last PR needed. Fixes #41726. Fixes #41742. Fixes #41774.
2017-05-08Rollup merge of #41827 - qnighy:allow-bare-cr-in-nondoc-comment, r=estebankCorey Farwell-0/+24
Allow bare CR in ////-style comment. Fixes #40624 in a way that bare CR is allowed in all non-doc comments.
2017-05-08Rollup merge of #41520 - estebank:trace-macro, r=nikomatsakisCorey Farwell-11/+11
Use diagnostics for trace_macro instead of println When using `trace_macro`, use `span_label`s instead of `println`: ```rust note: trace_macro --> $DIR/trace-macro.rs:14:5 | 14 | println!("Hello, World!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: expands to `println! { "Hello, World!" }` = note: expands to `print! { concat ! ( "Hello, World!" , "\n" ) }` ``` Fix #22597.
2017-05-08Rollup merge of #41293 - est31:floating_literal_match, r=nikomatsakisCorey Farwell-0/+56
Implement the illegal_floating_point_literal_pattern compat lint Adds a future-compatibility lint for the [breaking-change] introduced by issue #41620 . cc issue #41255 .
2017-05-08Auto merge of #41515 - eddyb:non-static-assoc-const, r=nikomatsakisbors-0/+9
rustc: treat const bodies like fn bodies in middle::region. Allows `T::ASSOC_CONST` to be used without a `T: 'static` bound. cc @rust-lang/compiler @rust-lang/lang
2017-05-08massive refactorChristian Poveda-1/+0
2017-05-08added testChristian Poveda-0/+18
2017-05-08first part of issue-40000.rs is now passingChristian Poveda-2/+1
2017-05-08dividied closure-no-fn.rs into three different testsChristian Poveda-6/+36
2017-05-08dump-mir was causing cycles by invoking item-path-str at bad timesNiko Matsakis-0/+50
Workaround for now, but probably a better fix is to opt **in** to using the types for impls (if we do that at all; maybe filename/line is better).
2017-05-08try to fix lvalue ops for realAriel Ben-Yehuda-0/+78
Hopefully this is the last PR needed. Fixes #41726. Fixes #41742. Fixes #41774.
2017-05-08Allow bare CR in ////-style comment.Masaki Hara-0/+24
2017-05-08incr.comp.: Hash more pieces of crate metadata to detect changes there.Michael Woerister-0/+66
2017-05-07Auto merge of #40857 - estebank:recursive, r=arielb1bors-6/+81
Point at fields that make the type recursive On recursive types of infinite size, point at all the fields that make the type recursive. ```rust struct Foo { bar: Bar, } struct Bar { foo: Foo, } ``` outputs ``` error[E0072]: recursive type `Foo` has infinite size --> file.rs:1:1 1 | struct Foo { | ^^^^^^^^^^ recursive type has infinite size 2 | bar: Bar, | -------- recursive here | = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable error[E0072]: recursive type `Bar` has infinite size --> file.rs:5:1 | 5 | struct Bar { | ^^^^^^^^^^ recursive type has infinite size 6 | foo: Foo, | -------- recursive here | = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable ```
2017-05-07Auto merge of #41785 - Mark-Simulacrum:issue-41783, r=GuillaumeGomezbors-0/+25
Allow # to appear in rustdoc code output. "##" at the start of a trimmed rustdoc line is now cut to "#" and then shown. If the user wanted to show "##", they can type "###". I'm somewhat concerned about the potential implications for users, since this does make a potentially backwards-incompatible change. Previously, `##` had no special handling, and now we do change it. However, I'm not really sure what we can do here to improve this, and I can't think of any cases where `##` would likely be correct in a code block, though of course I could be wrong. Fixes #41783.
2017-05-07Auto merge of #41668 - kennytm:fix-issue-41652, r=jonathandturnerbors-0/+54
Fix issue #41652 Fix issue #41652. Don't print anything in `render_source_line()` if no source code is given. (cc @jonathandturner #34789)
2017-05-06Allow # to appear in rustdoc code output.Mark Simulacrum-0/+25
"##" at the start of a trimmed rustdoc line is now cut to "#" and then shown. If the user wanted to show "##", they can type "###".
2017-05-06Update the .stderr file for the "an" changesacdenisSK-1/+1
2017-05-06rustc: treat const bodies like fn bodies in middle::region.Eduard-Mihai Burtescu-0/+9
2017-05-06Group "macro expansion" notes per call spanEsteban Küber-10/+7
2017-05-05Move logic to `is_representable` instead of climbing HIREsteban Küber-27/+35
2017-05-05Use diagnostics for trace_macro instead of printlnEsteban Küber-11/+14
2017-05-05Rollup merge of #41761 - euclio:24106-test, r=estebankCorey Farwell-0/+40
Add regression test for issue #24106 Fixes #24106.
2017-05-05Rollup merge of #41734 - nikomatsakis:incr-comp-refactor-variance, r=pnkfelixCorey Farwell-14/+46
Refactor variance and remove last `[pub]` map This PR refactors variance to work in a more red-green friendly way. Because red-green doesn't exist yet, it has to be a bit hacky. The basic idea is this: - We compute a big map with the variance for all items in the crate; when you request variances for a particular item, we read it from the crate - We now hard-code that traits are invariant (which they are, for deep reasons, not gonna' change) - When building constraints, we compute the transitive closure of all things within the crate that depend on what using `TransitiveRelation` - this lets us gin up the correct dependencies when requesting variance of a single item Ah damn, just remembered, one TODO: - [x] Update the variance README -- ah, I guess the README updates I did are sufficient r? @michaelwoerister
2017-05-05Rollup merge of #41722 - F001:warnTilde, r=petrochenkovCorey Farwell-0/+23
Suggest `!` for bitwise negation when encountering a `~` Fix #41679 Here is a program ```rust fn main() { let x = ~1; } ``` It's output: ``` error: `~` can not be used as an unary operator --> /home/fcc/temp/test.rs:4:13 | 4 | let x = ~1; | ^^ | = help: use `!` instead of `~` if you meant to bitwise negation ``` cc @bstrie
2017-05-05Rollup merge of #41582 - jonhoo:reread-nameservers-on-lookup-fail, ↵Corey Farwell-0/+1
r=alexcrichton Reload nameserver information on lookup failure As discussed in #41570, UNIX systems often cache the contents of `/etc/resolv.conf`, which can cause lookup failures to persist even after a network connection becomes available. This patch modifies lookup_host to force a reload of the nameserver entries following a lookup failure. This is in line with what many C programs already do (see #41570 for details). On systems with nscd, this should not be necessary, but not all systems run nscd. Fixes #41570. Depends on rust-lang/libc#585. r? @alexcrichton
2017-05-05Suggest `!` for bitwise negation when encountering a `~`F001-0/+23
2017-05-04Reload nameserver information on lookup failureJon Gjengset-0/+1
As discussed in #41570, UNIX systems often cache the contents of /etc/resolv.conf, which can cause lookup failures to persist even after a network connection becomes available. This patch modifies lookup_host to force a reload of the nameserver entries following a lookup failure. This is in line with what many C programs already do (see #41570 for details). On systems with nscd, this should not be necessary, but not all systems run nscd. Introduces an std linkage dependency on libresolv on macOS/iOS (which also makes it necessary to update run-make/tools.mk). Fixes #41570. Depends on rust-lang/libc#585.
2017-05-04Only point at the fields that cause infinite sizeEsteban Küber-10/+10
* clean up code * point only fields that cause the type to be of infinite size * fix unittests
2017-05-04Point at fields that make the type recursiveEsteban Küber-0/+67
On recursive types of infinite size, point at all the fields that make the type recursive. ```rust struct Foo { bar: Bar, } struct Bar { foo: Foo, } ``` outputs ``` error[E0072]: recursive type `Foo` has infinite size --> file.rs:1:1 1 | struct Foo { | _^ starting here... 2 | | bar: Bar, | | -------- recursive here 3 | | } | |_^ ...ending here: recursive type has infinite size | = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable error[E0072]: recursive type `Bar` has infinite size --> file.rs:5:1 | 5 | struct Bar { | _^ starting here... 6 | | foo: Foo, | | -------- recursive here 7 | | } | |_^ ...ending here: recursive type has infinite size | = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable ```
2017-05-04add regression test for issue #24106Andy Russell-0/+40
Fixes #24106.
2017-05-03correct the new graphs resulting from various testsNiko Matsakis-5/+13
(Now that variances are not part of signature.)
2017-05-03add back variance testing mechanismNiko Matsakis-9/+1
make it work for traits etc uniformly
2017-05-03factor variances into a proper queryNiko Matsakis-0/+32
There are now two queries: crate and item. The crate one computes the variance of all items in the crate; it is sort of an implementation detail, and not meant to be used. The item one reads from the crate one, synthesizing correct deps in lieu of the red-green algorithm. At the same time, remove the `variance_computed` flag, which was a horrible hack used to force invariance early on (e.g. when type-checking constants). This is only needed because of trait applications, and traits are always invariant anyway. Therefore, we now change to take advantage of the query system: - When asked to compute variances for a trait, just return a vector saying 'all invariant'. - Remove the corresponding "inferreds" from traits, and tweak the constraint generation code to understand that traits are always inferred.
2017-05-03Add test for an inference failure.Charlie Sheridan-0/+21
2017-05-03Auto merge of #41711 - sirideain:add-static-methods-test, r=aturonbors-0/+23
Add test for Inherent static methods Fixes #28848
2017-05-03Fix issue #41652.kennytm-0/+54
Don't print the source code in emit_message_default() and render_source_line() if the source code is None.
2017-05-03Auto merge of #41717 - frewsxcv:rollup, r=frewsxcvbors-9/+12
Rollup of 7 pull requests - Successful merges: #41217, #41625, #41640, #41653, #41656, #41657, #41705 - Failed merges:
2017-05-02Rollup merge of #41640 - gaurikholkar:master, r=nikomatsakisCorey Farwell-1/+4
Consider changing to & for let bindings #40402 This is a fix for #40402 For the example ``` fn main() { let v = vec![String::from("oh no")]; let e = v[0]; } ``` It gives ``` error[E0507]: cannot move out of indexed content --> ex1.rs:4:13 | 4 | let e = v[0]; | ^^^^ cannot move out of indexed content | = help: consider changing to `&v[0]` error: aborting due to previous error ``` Another alternative is ``` error[E0507]: cannot move out of indexed content --> ex1.rs:4:13 | 4 | let e = v[0]; | ^^^^ consider changing to `&v[0]` error: aborting due to previous error ``` Also refer to #41564 for more details. r? @nikomatsakis