Commit graph

46991 commits

Author SHA1 Message Date
Felix S. Klock II
e1aba75a97 review comment: point out that the dropck analysis is now trivial. 2015-10-09 14:08:06 +02:00
Felix S. Klock II
b6a4f0393b revise cfail test, removing ugeh attribute that was erroneously cut-and-pasted into it. 2015-10-09 13:30:08 +02:00
Felix S. Klock II
61f8def63a placate check-pretty via comment rearrangement. 2015-10-08 23:02:42 +02:00
Felix S. Klock II
9ed5faa9d5 Document the new more conservative dropck rule and the escape hatch. 2015-10-08 15:34:54 +02:00
Felix S. Klock II
73f35cfb24 Added tests illustrating when and when not to use the UGEH attribute w.r.t. types in negative position. 2015-10-08 14:43:45 +02:00
Felix S. Klock II
7eda5b508f Added tests illustrating when and when not to use the UGEH attribute w.r.t. a lifetime param. 2015-10-08 14:43:45 +02:00
Felix S. Klock II
e2e261f376 Added tests illustrating when and when not to use the UGEH attribute w.r.t. a trait bound. 2015-10-08 14:43:44 +02:00
Felix S. Klock II
92da3f9464 review comment: reduce the is_adt_dtorck method to just a check for the attribute. 2015-10-08 14:43:07 +02:00
Felix S. Klock II
7a4743fab0 review comment: use RFC example for compile-fail/issue28498-reject-ex1.rs
(It is not *exactly* the text from the RFC, but the only thing it adds
is a call to a no-op function that is just an attempt to make it clear
where the potential for impl specialization comes from.)
2015-10-06 16:54:10 +02:00
Felix S. Klock II
5708f44b36 shorten URLs to placate make tidy. 2015-10-06 16:51:20 +02:00
Felix S. Klock II
83077bee93 compile-fail tests.
One just checks that we are feature-gating the UGEH attribute (as
usual for attributes associated with unstable features).

The other is adapted from the RFC 1238 text, except that it has been
extended somewhat to actually *illustrate* the scenario that we are
trying to prevent, namely observing the state of data, from safe code,
after the destructor for that data has been executed.
2015-10-06 14:16:50 +02:00
Felix S. Klock II
eea299beaa run-pass tests for RFC 1238.
Illustrates cases that worked before and must continue to work, and a
case that shows how to use the `unsafe_destructor_blind_to_params`
attribute (aka "the UGEH attribute") to work around
cannot-assume-parametricity.
2015-10-06 14:16:49 +02:00
Felix S. Klock II
d778e57bf6 Add RFC 1238's unsafe_destructor_blind_to_params (UGEH) where needed.
I needed it in `RawVec`, `Vec`, and `TypedArena` for `rustc` to
bootstrap; but of course that alone was not sufficient for `make
check`.

Later I added `unsafe_destructor_blind_to_params` to collections, in
particular `LinkedList` and `RawTable` (the backing representation for
`HashMap` and `HashSet`), to get the regression tests exercising
cyclic structure from PR #27185 building.

----

Note that the feature is `dropck_parametricity` (which is not the same
as the attribute's name). We will almost certainly vary our strategy
here in the future, so it makes some sense to have a not-as-ugly name
for the feature gate. (The attribute name was deliberately selected to
be ugly looking.)
2015-10-06 14:16:49 +02:00
Felix S. Klock II
9868df2fd5 Non-parametric dropck; instead trust an unsafe attribute (RFC 1238).
Implement cannot-assume-parametricity (CAP) from RFC 1238, and add the
UGEH attribute.

----

Note that we check for the attribute attached to the dtor method, not
the Drop impl.

(This is just to match the specification of RFC and the tests; I am
not wedded to this approach.)
2015-10-06 14:16:20 +02:00
bors
c298efdb1f Auto merge of #28748 - nikomatsakis:universal-mir, r=pnkfelix
I had to fix a few things. Notable changes:

1. I removed the MIR support for constants, instead falling back to the existing `ConstVal`. I still think we ought to reform how we handle constants, but it's not clear to me that the approach I was taking is correct, and anyway I think we ought to do it separately.
2. I adjusted how we handle bindings in matches: we now *declare* all the bindings up front, rather than doing it as we encounter them. This is not only simpler, since we don't have to check if a binding has already been declared, it avoids ICEs if any of the arms turn out to be unreachable.
3. I do MIR construction *after* `check_match`, because it detects various broken cases. I'd like for `check_match` to be subsumed by MIR construction, but we can do that as a separate PR (if indeed it makes sense).

I did a crater run and found no regressions in the wild: https://gist.github.com/nikomatsakis/0038f90e10c8ad00f2f8
2015-10-05 03:06:33 +00:00
Niko Matsakis
7e1e830a6f change PartialEq impl for ConstVal so that two constants are ==
if they represent the same constant; otherwise the match algorithm
goes into infinite recursion when a pattern contains `NaN`
2015-10-04 21:19:45 -04:00
Niko Matsakis
0197f982b2 change how we declare bindings so that unreachable arms don't
cause panics
2015-10-04 21:19:33 -04:00
Niko Matsakis
96a3cd0679 rather than just passing the block around, track the candidate's index,
and track which arms are reached (though in fact we don't make use of
this right now -- we might later if we absorb the checking of patterns
into MIR, as I would like)
2015-10-04 21:19:32 -04:00
bors
0db2bc63ba Auto merge of #28840 - rust-lang:brson-patch-1, r=steveklabnik
Add the Tock paper.
2015-10-05 01:16:34 +00:00
Niko Matsakis
1f4acfa691 switch to using constvals for constants, instead of having constant
trees in MIR
2015-10-04 21:08:32 -04:00
Niko Matsakis
dedde0bb5a do MIR construction after pattern evaluation for now to sidestep
various annoying edge cases
2015-10-04 21:08:32 -04:00
Niko Matsakis
0d207cb483 always build MIR 2015-10-04 21:08:32 -04:00
bors
11a612795a Auto merge of #28573 - ruud-v-a:rustdoc-license, r=brson
The output of rustdoc includes resources licensed under the SIL Open
Font License, the MIT license, and the Apache License 2.0. All of these
licenses permit redistribution provided that the license text is also
redistributed. Previously this was not the case, making rustdoc output
unsuitable for distribution by default. This resolves that problem by
including the license texts in rustdoc output.

See also: https://users.rust-lang.org/t/licensing-rustdoc-output/2880
2015-10-04 23:30:40 +00:00
Brian Anderson
12c68c977f Update bibliography.md 2015-10-04 15:55:19 -07:00
bors
380d767244 Auto merge of #28825 - iwillspeak:master, r=alexcrichton
`--explain` support for E0163 and E0164.

Part of rust-lang/rust#24407
2015-10-04 21:43:36 +00:00
bors
7f4665c3e6 Auto merge of #28806 - wthrowe:bare-outfile-fix, r=alexcrichton
The reason this was not failing is fascinating.  The variable $(rustc)
is empty, so the make recipe was expanded as " -o foo foo.rs".  make
interpreted this as an instruction to run the command "o foo foo.rs"
and ignore any failure that occurred, because it uses a leading '-' on
a command to signal that behavior.
2015-10-04 19:50:50 +00:00
bors
5ff4442a3f Auto merge of #28831 - Seeker14491:patch-1, r=steveklabnik 2015-10-04 17:36:49 +00:00
bors
1dcbd35710 Auto merge of #28832 - sarcas:docs-uneeded-done-in-library-example, r=steveklabnik
"Rust Inside Other Languages" in the Rust book includes a library example. The reference specifies printing "done!" when the code finishes running, and the language examples (Ruby, Python, JS) all do this in their code. 

However, the Rust library example code *also* does this, so that the examples as written would output "done!" twice.

This commit removes the "done!" from the Rust example code to tidy up the output to match expectations.
2015-10-04 14:18:28 +00:00
James Bell
2b535a1622 Docs: Removes duplicate output from FFI example
The "Rust Inside Other Languages" page includes a library example. The
reference specifies printing "done!" when the code finishes running, and
the language examples (Ruby, Python, JS) all do this in their code.
However, the Rust library example code *also* does this, so that the
examples as written would output "done!" twice.

This removes the "done!" from the Rust example code to clarify the docs.
2015-10-04 10:44:00 +01:00
Seeker14491
a0284f4181 fix another typo 2015-10-04 00:34:21 -05:00
Seeker14491
f66170258f fix a few typos 2015-10-03 18:01:42 -05:00
bors
130851e030 Auto merge of #28669 - arielb1:well-formed-methods, r=nikomatsakis
By RFC1214:
>    Before calling a fn, we check that its argument and return types are WF.
    
The previous code only checked the trait-ref, which was not enough
in several cases.
    
As this is a soundness fix, it is a [breaking-change]. Some new annotations are needed, which I think are because of #18653 and the imperfection of `projection_must_outlive` (that can probably be worked around by moving the wf obligation later).
    
Fixes #28609

r? @nikomatsakis
2015-10-03 22:07:37 +00:00
William Throwe
e3df519225 Fix run-make/bare-outfile test
The reason this was not failing is fascinating.  The variable $(rustc)
is empty, so the make recipe was expanded as " -o foo foo.rs".  make
interpreted this as an instruction to run the command "o foo foo.rs"
and ignore any failure that occurred, because it uses a leading '-' on
a command to signal that behavior.
2015-10-03 17:20:45 -04:00
bors
6d11a81c71 Auto merge of #28829 - GuillaumeGomez:patch-1, r=steveklabnik
r? @steveklabnik
2015-10-03 20:18:38 +00:00
Guillaume Gomez
aeb94a1948 Add missing dot 2015-10-03 20:21:39 +02:00
bors
3e06daac83 Auto merge of #28521 - arielb1:metadiet, r=eddyb
libcore.rlib reduced from 19121 kiB to 15934 kiB - 20% win.

The librustc encoded AST is 9013500 bytes long - for the record, librustc consists of about 2254126 characters. Might be worth looking at.

r? @eddyb
2015-10-03 17:33:10 +00:00
Will Speak
799656311c Add Error Explanations for E0163 & E0164
Addds `--explain` support for E0163 and E0164.
2015-10-03 15:51:40 +01:00
bors
0369304feb Auto merge of #28821 - dagnir:formatting-fix, r=steveklabnik 2015-10-03 09:37:49 +00:00
Ariel Ben-Yehuda
2f23e171cb use the correct subtyping order in a test
also, ensure that callers are checked.
2015-10-03 12:03:48 +03:00
bors
4665aaebfd Auto merge of #28815 - matklad:contrib-doc, r=steveklabnik
This adds a paragraph on how to generate documentation without sloooow `make doc`. I'm not a native English speaker, so there might be some language related bugs (I wish English was as hard to get wrong, as Rust)

This also includes whitespace cleanup of contributing.md in a separate commit. Whiltespace is not significant in github flavored markdown, and my Emacs just cleans ws automatically :)

r? @steveklabnik
2015-10-03 07:50:47 +00:00
bors
f492ec4bf4 Auto merge of #28818 - Stebalien:fix-iter-chain-order, r=alexcrichton
part of #28810
2015-10-03 06:03:50 +00:00
bors
d2047bc97d Auto merge of #28813 - arielb1:well-formed-variables, r=nikomatsakis
it doesn't seem to be necessary and is potentially harmful.

r? @nikomatsakis
2015-10-03 04:16:52 +00:00
bors
16331f1a42 Auto merge of #28820 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #28736, #28805, #28812, #28814, #28819
- Failed merges:
2015-10-03 02:23:03 +00:00
Aleksey Kladov
c3753ce074 docs: add rustdoc example to CONTRIBUTING.md 2015-10-03 03:42:28 +03:00
Steve Klabnik
92cff9f0d9 Rollup merge of #28819 - steveklabnik:doc_hr, r=brson
It's not really clear here, since the example is rendered, where it
starts and ends. So let's use <hr>s to split it up.
2015-10-02 20:38:23 -04:00
Steve Klabnik
323037d7e7 Rollup merge of #28814 - matklad:fix-md, r=alexcrichton
The list was grabled.

r? @steveklabnik
2015-10-02 20:38:23 -04:00
Steve Klabnik
c3c5de1b98 Rollup merge of #28812 - steveklabnik:improve_str_from_utf8_docs, r=brson
Our docs were very basic for the various versions of from_utf8, so
this commit beefs them up.

It also improves docs for the &str variant's error, Utf8Error.
2015-10-02 20:38:23 -04:00
Steve Klabnik
9c5837e0ce Rollup merge of #28805 - wthrowe:compile-stdin, r=alexcrichton 2015-10-02 20:38:22 -04:00
Steve Klabnik
f368a18059 Rollup merge of #28736 - nagisa:rustdocjsfix, r=alexcrichton 2015-10-02 20:38:22 -04:00
bors
98df45830a Auto merge of #28672 - sanxiyn:const-eval-span, r=alexcrichton
Fix #28402.
2015-10-03 00:36:50 +00:00