Commit Graph

88678 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
49c74e4c85
Rollup merge of #57350 - folex:master, r=estebank
Better error note on unimplemented Index trait for string

fixes #56740

I've tried to compile suggestion from comments in the issue #56740, but unsure of it. So I'm open to advice :)

Current output will be like this:
```rust
error[E0277]: the type `str` cannot be indexed by `{integer}`
  --> $DIR/str-idx.rs:3:17
   |
LL |     let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}`
   |                 ^^^^ `str` cannot be indexed by `{integer}`
   |
   = help: the trait `std::ops::Index<{integer}>` is not implemented for `str`
   = note: you can use `.chars().nth()` or `.bytes().nth()`
           see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
```

`x.py test src/test/ui` succeeded and I've also tested output manually by compiling the following code:
```rust
fn _f() {
    let s = std::string::String::from("hello");
    let _c = s[0];

    let s = std::string::String::from("hello");
    let mut _c = s[0];

    let s = "hello";
    let _c = s[0];

    let s = "hello";
    let mut _c = &s[0];
}
```

Not sure if some docs should be changed too. I will also fix error message in the [Book :: Indexing into Strings](db53e2e3cd/src/ch08-02-strings.md (indexing-into-strings)) if that PR will get approved :)
2019-01-18 22:56:40 +01:00
Mazdak Farrokhzad
0dd4bfa356
Rollup merge of #57302 - sinkuu:unused_assignments_fp, r=estebank
Fix unused_assignments false positive

Fixes #22630.

In liveness analysis, make `continue` jump to the loop condition's `LiveNode` (`cond` as in comment) instead of the loop's one (`expr`).

069b0c4108/src/librustc/middle/liveness.rs (L1358-L1370)
2019-01-18 22:56:39 +01:00
Mazdak Farrokhzad
bb683b9f3a
Rollup merge of #57212 - phansch:improve_rustc_book_contributing, r=steveklabnik
docs(rustc): Link to the book's source in rustc

This makes the source of [the rustc book](https://doc.rust-lang.org/rustc/what-is-rustc.html) book a bit more discoverable.
2019-01-18 22:56:37 +01:00
Mazdak Farrokhzad
04a2cbd1c8
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
Document that `-C opt-level=0` implies `-C debug-assertions`.

I couldn't find it stated anywhere else (https://doc.rust-lang.org/nightly/rustc/codegen-options/index.html#opt-level).
It was a problem before here: https://github.com/rust-lang/rust/issues/39449, it got lost in the migration to the new documentation I assume.

On a sidenote: I think that `-C opt-level=0` having a sideeffect on another flag should be changed. Having compiler flags affecting others doesn't make much sense to me, they are used to fine tune anyway.
In any case, this plays no role in this PR.
2019-01-18 22:56:35 +01:00
Mazdak Farrokhzad
b9cb5db5e8
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
Add a regression test for mutating a non-mut #[thread_local]

This should close #54901 since the regression has since been fixed.
2019-01-18 22:56:34 +01:00
Who? Me?!
0c4602aaef
Update README.md
Point contributors to the rustc-guide...
2019-01-18 15:28:23 -06:00
bors
c76f3c374f Auto merge of #57737 - Centril:rollup, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #56594 (Remove confusing comment about ideally using `!` for `c_void`)
 - #57340 (Use correct tracking issue for c_variadic)
 - #57357 (Cleanup PartialEq docs.)
 - #57551 (resolve: Add a test for issue #57539)
 - #57636 (Fix sources sidebar not showing up)
 - #57646 (Fixes text becoming invisible when element targetted)
 - #57654 (Add some links in std::fs.)
 - #57683 (Document Unpin in std::prelude documentation)
 - #57685 (Enhance `Pin` impl applicability for `PartialEq` and `PartialOrd`.)
 - #57710 (Fix non-clickable urls)

Failed merges:

r? @ghost
2019-01-18 19:08:20 +00:00
Mazdak Farrokhzad
ff583ac484
Rollup merge of #57710 - GuillaumeGomez:non-clickable, r=QuietMisdreavus
Fix non-clickable urls

Fixes #57695

I didn't find anywhere where this rule was useful. Why did you add it @JohnHeitmann?

r? @QuietMisdreavus
2019-01-18 18:06:40 +01:00
Mazdak Farrokhzad
25ea20dfeb
Rollup merge of #57685 - pthariensflame:enhancement/pin-impl-applicability, r=withoutboats
Enhance `Pin` impl applicability for `PartialEq` and `PartialOrd`.

This allows for comparing for equality or ordering a `Pin<P>` and a `Pin<Q>` as long as `P` and `Q` are correspondingly comparable themselves *even when `P` and `Q` are different types*.
An example might be comparing a `Pin<&mut OsString>` to a `Pin<&mut PathBuf>`, which might arise from pin projections from a pair of larger contexts that aren't `Unpin`.
2019-01-18 18:06:38 +01:00
Mazdak Farrokhzad
b0563fdb44
Rollup merge of #57683 - xfix:patch-15, r=QuietMisdreavus
Document Unpin in std::prelude documentation
2019-01-18 18:06:37 +01:00
Mazdak Farrokhzad
b12397fad1
Rollup merge of #57654 - ehuss:fs-links, r=alexcrichton
Add some links in std::fs.

A few items were referenced, but did not have links.
2019-01-18 18:06:36 +01:00
Mazdak Farrokhzad
b9e940c2e6
Rollup merge of #57646 - GuillaumeGomez:fix-css, r=QuietMisdreavus
Fixes text becoming invisible when element targetted

Fixes #57628.

r? @QuietMisdreavus
2019-01-18 18:06:34 +01:00
Mazdak Farrokhzad
e26498026f
Rollup merge of #57636 - GuillaumeGomez:fix-sources-sidebar, r=QuietMisdreavus
Fix sources sidebar not showing up

Fixes #57601.

The order of imports made it so that the sidebar creation was called before the sidebar sources were created. Like this, when the sources are loaded, they create the sidebar as expected.

r? @QuietMisdreavus
2019-01-18 18:06:33 +01:00
Mazdak Farrokhzad
4091ca0183
Rollup merge of #57551 - petrochenkov:regrtest, r=nikomatsakis
resolve: Add a test for issue #57539

Add a test for the bugfix regression reported in https://github.com/rust-lang/rust/issues/57539

Closes https://github.com/rust-lang/rust/issues/57539
2019-01-18 18:06:32 +01:00
Mazdak Farrokhzad
bca490808f
Rollup merge of #57357 - frewsxcv:frewsxcv-partial-eq, r=QuietMisdreavus
Cleanup PartialEq docs.

- Cleanup the `impl PartialEq<BookFormat> for Book` implementation
- Implement `impl PartialEq<Book> for BookFormat` so it’s symmetric
  - Fixes https://github.com/rust-lang/rust/issues/53844.
- Removes the last example since it appears to be redundant with the
  previous two examples.
2019-01-18 18:06:30 +01:00
Mazdak Farrokhzad
76cdccb2c2
Rollup merge of #57340 - eqrion:doc/c_variadic, r=Mark-Simulacrum
Use correct tracking issue for c_variadic

Fixes #57306
2019-01-18 18:06:29 +01:00
Mazdak Farrokhzad
9e78bc5d4f
Rollup merge of #56594 - sdroege:c_void-is-not-never, r=TimNN
Remove confusing comment about ideally using `!` for `c_void`

Using `!` for `c_void` would have the problem that pointers and
potentially references to an uninhabited type would be created, and at
least for references this is UB.

In addition document that newtype wrappers around `c_void` can be used
safely in place of `extern type` until the latter is stabilized.

----

I'm not 100% sure about the usage for opaque types as the [nomicon](https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs) still recommends using `#[repr(C)] pub struct Foo { _private: [u8; 0] }` but it seems like these two should be equivalent in the end? Also the `#[repr(C)]` (in both cases) should be unneeded because such types never being passed by value, never being dereferenced but only passed around as pointer or reference, so the representation of (*values* of) the type itself should not matter at all?

Also in context of `c_void` and `!` the second unresolved question in the [`extern type`](https://github.com/rust-lang/rust/issues/43467) stabilization ticket seems relevant

> In [std's](164619a8cf/src/libstd/os/raw.rs (L59-L64)) source, it is mentioned that LLVM expects i8* for C's void*.
> We'd need to continue to hack this for the two c_voids in std and libc.
> But perhaps this should be done across-the-board for all extern types?
> Somebody should check what Clang does.

Please correct me if my understanding is wrong and everything's actually fine as is.
2019-01-18 18:06:26 +01:00
bors
f613dc138b Auto merge of #56189 - rep-nop:keep_doc_test_executable, r=QuietMisdreavus
rustdoc: Add option to persist doc test executables

Fixes #37048.

This is the initial version of the code so the doctest executables can be used for stuff like code coverage (specifically https://github.com/xd009642/tarpaulin/issues/13) the folders it goes into were just a first idea, so any better ones are welcome.

Right now it creates a directory structure like:
```
  given_path/
          |_____ <filename>_rs_<linenum>/
          |_____ ...
          |_____ <filename>_rs_<linenum>/
                 |_____ rust_out

```
I couldn't figure out where it actually outputs the file w/ the name, I suspect its somewhere deeper in the compiler.

It also adds the unstable `--persist-doctests` flag to `rustdoc` that enables this behavior.
2019-01-18 16:18:11 +00:00
Philipp Hansch
79ef9718bb
Remove delay_span_bug from qualify_min_const_fn
This is causing issues with a new Clippy lint that will be able to
detect possible const functions.

As per https://github.com/rust-lang/rust-clippy/pull/3648#discussion_r247927450
2019-01-18 16:46:51 +01:00
bors
527b8d4243 Auto merge of #57065 - Zoxc:graph-tweaks, r=michaelwoerister
Optimize try_mark_green and eliminate the lock on dep node colors

Blocked on https://github.com/rust-lang/rust/pull/56614

r? @michaelwoerister
2019-01-18 11:34:11 +00:00
Esteban Küber
2e06d9c91b Point at return type when appropriate 2019-01-18 00:12:09 -08:00
bors
38650b69ca Auto merge of #56996 - clarcharr:spin_loop_hint, r=KodrAus
Move spin_loop_hint to core::hint module

As mentioned in #55002. The new name is kept unstable to decide whether the function should have `_hint` in its name.
2019-01-18 07:36:13 +00:00
Esteban Küber
954769e2ed Fix test after rebase 2019-01-17 22:51:01 -08:00
Esteban Küber
fbb072837d Fix tidy error 2019-01-17 22:33:21 -08:00
Esteban Küber
9b8243ac24 Point at more cases involving return types 2019-01-17 22:33:20 -08:00
Esteban Küber
c4318502bc Avoid pointing at multiple places on return type error 2019-01-17 22:33:20 -08:00
Esteban Küber
19255dc2e6 Point more places where expectation comes from 2019-01-17 22:33:20 -08:00
Esteban Küber
90507295db Do not give incorrect label for return type mismatch 2019-01-17 22:33:20 -08:00
Esteban Küber
ec3c5b0199 Use structured suggestion to surround struct literal with parenthesis 2019-01-17 21:19:30 -08:00
Mark Mansi
db2d243e9e fix compat-mode ui test 2019-01-17 22:04:27 -06:00
Mark Mansi
274d293cab Update tests 2019-01-17 20:39:06 -06:00
Mark Mansi
2f8a77445f better lifetime error message 2019-01-17 20:39:06 -06:00
Eric Huss
7c31d54619 Update cargo 2019-01-17 17:36:34 -08:00
Dan Robertson
e3ba6ed3f5
Fix suggestions given mulitple bad lifetimes
When given multiple lifetimes prior to type parameters in generic
parameters, do not ICE and print the correct suggestion.
2019-01-18 01:10:14 +00:00
Nicholas Nethercote
92fd6f9d30 Inline expand_node.
This requires restructuring things a little so that there is only one
callsite, ensuring that inlinining doesn't cause unnecessary code bloat.

This reduces instruction counts for the `unicode_normalization`
benchmark by up to 4%.
2019-01-18 11:40:43 +11:00
Nicholas Nethercote
55768330a9 Remove unneeded origin arg from iterate_until_fixed_point's closure. 2019-01-18 11:37:22 +11:00
Wesley Norris
f5413cd1e2 Bless test.
Bless test, remove submodule, and fix book entry.

bless test again? maybe it'll work this time...
2019-01-17 17:49:29 -05:00
Wesley Norris
09cad1b8a5 Add book section and fix typo. 2019-01-17 17:26:24 -05:00
Wesley Norris
80ee94c1f8 Minor changes to wording and formatting. 2019-01-17 17:26:24 -05:00
Wesley Norris
22e97da30a Bless test. 2019-01-17 17:26:24 -05:00
Wesley Norris
a3f7f97205 Fix tidy error. 2019-01-17 17:26:00 -05:00
Wesley Norris
1318e53ea8 Persist doc test executables to given path. 2019-01-17 17:26:00 -05:00
Vadim Petrochenkov
d34b3e9bf2 privacy: Account for associated existential types 2019-01-18 01:06:08 +03:00
Guillaume Gomez
25189874fb Fix non-clickable urls 2019-01-17 21:28:23 +01:00
Yuki Okushi
b721c1a885 Fix tests 2019-01-18 05:24:17 +09:00
Yuki Okushi
8bbb63c600 Add token::Err 2019-01-18 05:23:56 +09:00
Yuki Okushi
7e2e61c618 Change from mk_lit! to cx.expr 2019-01-18 05:23:25 +09:00
Yuki Okushi
bde3795d46 Continue cheking 2019-01-18 05:22:00 +09:00
Yuki Okushi
32662c2953 Change from error to invalid 2019-01-18 05:20:27 +09:00
lenoil98
c2863dd1b4
Update bootstrap.py
Add PowerPC64 support on FreeBSD
2019-01-17 13:20:00 -05:00