Skip to content

Master update 28 05 2020 #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10,000 commits into from
May 29, 2020
Merged

Master update 28 05 2020 #31

merged 10,000 commits into from
May 29, 2020

Conversation

MabezDev
Copy link
Member

No description provided.

nbdd0121 and others added 30 commits May 21, 2020 01:10
…akis

Use `T`'s discriminant type in `mem::Discriminant<T>` instead of `u64`.

fixes rust-lang#70509

Adds the lang-item `discriminant_kind`.
Updates the function signature of `intrinsics::discriminant_value`.
Adds the *probably permanently unstable* trait `DiscriminantKind`.
`mem::Discriminant` should now be smaller in some cases.

r? @ghost
Dumb NRVO

This is a very simple version of an NRVO pass, which scans backwards from the `return` terminator to see if there is an an assignment like `_0 = _1`. If a basic block with two or more predecessors is encountered during this scan without first seeing an assignment to the return place, we bail out. This avoids running a full "reaching definitions" dataflow analysis.

I wanted to see how much `rustc` would benefit from even a very limited version of this optimization. We should be able to use this as a point of comparison for more advanced versions that are based on live ranges.

r? @ghost
…ts, r=Amanieu

Make `std::char` functions and constants associated to `char`.

First step to fix rust-lang#71763.
…h-search-behaviour, r=kinnison

Fix going back in history to a search result page on firefox

This bug was actually firefox not re-running JS script when you go back in history. To trigger it on the current docs:

 * Make a search
 * Pick an element (which isn't on the same page as the current element!)
 * Go back in history

Instead of having the search results, you'll see the normal doc page. You can find a small explanation about it [here](http://web.archive.org/web/20100428053932/http://www.firefoxanswer.com/firefox/672-firefoxanswer.html).

r? @kinnison

cc @ollie27
…ochenkov

Suggest installing VS Build Tools in more situations

When MSVC's `link.exe` wasn't found but another `link.exe` was, the error message given can be [impenetrable](https://pastebin.com/MRMCr7HM) to many users. The usual suspect is GNU's `link` tool. In this case, inform the user that they may need to install VS build tools.

This only applies when Microsoft's link tool is expected.
…r=ecstatic-morse

Remove unused `StableHashingContext::node_to_hir_id` method

cc rust-lang#50928
…eklabnik

FIX - Char documentation for unexperienced users

This is my first PR on rust and even if I've read [CONTRIBUTING.md](https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#pull-requests) I'm ensure everything is perfect. Sorry if I didn't follow the exact procedure.

**What it does:**
- Add an example in the char documentation

**Explanation**
Unexperienced users might not know that punctuation is `Case_Ignorable` and not `Uppercase` and `Lowercase` which mean that when checking if a string is uppercase one might be tempted to write:
```rust
my_string.chars().all(char::is_uppercase)
```

However this will return false for `"HELLO WORLD"` which is not intuitive. Since the function `is_case_ignorable` doesn't exists I believe the correct way to check is:
```rust
!my_string.chars().any(char::is_lowercase)
```

The aim of this example is to prevent unexperienced users to make an error which punctuation chars.
llvm: Expose tiny code model to users

This model is relevant to embedded AArch64 targets and was added to LLVM relatively recently (https://reviews.llvm.org/D49673, mid 2018), so rustc frontend didn't provide access to it with `-C code-model`. The gcc analogue is [`-mcmodel=tiny`](https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html).
(This is one of the options that are passed directly to LLVM without being interpreted by rustc.)

Follow up to rust-lang#72248.
Rollup of 7 pull requests

Successful merges:

 - rust-lang#71854 (Make `std::char` functions and constants associated to `char`.)
 - rust-lang#72111 (rustc-book: Document `-Z strip=val` option)
 - rust-lang#72272 (Fix going back in history to a search result page on firefox)
 - rust-lang#72296 (Suggest installing VS Build Tools in more situations)
 - rust-lang#72365 (Remove unused `StableHashingContext::node_to_hir_id` method)
 - rust-lang#72371 (FIX - Char documentation for unexperienced users)
 - rust-lang#72397 (llvm: Expose tiny code model to users)

Failed merges:

r? @ghost
Experimentally add `ffi_const` and `ffi_pure` extern fn attributes

Add FFI function attributes corresponding to clang/gcc/... `const` and `pure`.

Rebased version of rust-lang#58327 by @gnzlbg with the following changes:

- Switched back from the `c_ffi_const` and `c_ffi_pure` naming to `ffi_const` and `ffi_pure`, as I agree with rust-lang#58327 (comment) and this nicely aligns with `ffi_returns_twice`
- (Hopefully) took care of all of @hanna-kruppe's change requests in the original PR

r? @hanna-kruppe
This is to provide a more explicit statement against a code pattern that
many people end up coming with, since the reason of it being unsound
comes from the badly known single-allocation validity rule.

Providing that very pattern as a counter-example could help mitigate that.

Co-authored-by: Ralf Jung <post@ralfj.de>
…, r=varkor

De-abuse TyKind::Error in exhaustiveness checking

Replaces rust-lang#71074. Context: rust-lang#70866.

In order to remove the use of `TyKind::Error`, I had to make sure we skip over those fields whose inhabitedness should not be observed. This is potentially error-prone however, since we must be careful not to mix filtered and unfiltered lists of patterns. I managed to hide away most of the filtering behind a new `Fields` struct, that I used everywhere relevant. I quite like the result; I think the twin concepts of `Constructor` and `Fields` make a good mental model.

As usual, I tried to separate commits that shuffle code around from commits that require more thought to review.

cc @varkor @Centril
Intern predicates

Implements the first step of rust-lang/compiler-team#285

Renames `ty::Predicate` to `ty::PredicateKind`, which is now interned.
To ease the transition, `ty::Predicate` is now a struct containing a reference
to `ty::PredicateKind`.

r? @ghost
Don't `type_of` on trait assoc ty without default

Fix rust-lang#72076.
bors and others added 7 commits May 27, 2020 14:48
Update transitive dependencies to remove some deps

Similar to rust-lang#71919, this removes some (duplicate) dependencies.
perf: Revert accidental inclusion of a part of rust-lang#69218

This was accidentally included in rust-lang#69464 after a rebase and given
how much `inflate` and `keccak` stresses the obligation forest seems
like a likely culprit to the regression in those benchmarks.

(It is necessary in rust-lang#69218 as obligation forest needs to accurately
track the root variables or unifications will get lost)
Pass more `Copy` types by value.

There are a lot of locations where we pass `&T where T: Copy` by reference,
which should both be slightly less performant and less readable IMO.

This PR currently consists of three fairly self contained commits:

- passes `ty::Predicate` by value and stops depending on `AsRef<ty::Predicate>`.
- changes `<&List<_>>::into_iter` to iterate over the elements by value. This would break `List`s
  of non copy types. But as the only list constructor requires `T` to be copy anyways, I think
  the improved readability is worth this potential future restriction.
- passes `mir::PlaceElem` by value. Mir currently has quite a few copy types which are passed by reference, e.g. `Local`. As I don't have a lot of experience working with MIR, I mostly did this to get some feedback from people who use MIR more frequently
- tries to reuse `ty::Predicate` in case it did not change in some places, which should hopefully
  fix the regression caused by rust-lang#72055

r? @nikomatsakis for the first commit, which continues the work of rust-lang#72055 and makes adding `PredicateKind::ForAll` slightly more pleasant. Feel free to reassign though
@mtorromeo
Copy link

This branch (or xtensa-target since the merge) fails to compile for me with these errors:

   Compiling rustbook v0.1.0 (/build/rust-xtensa-git/src/rust-xtensa/src/tools/rustbook)
error[E0308]: mismatched types
  --> src/tools/rustbook/src/main.rs:95:77
   |
95 |     let target_files = mdbook_linkcheck::load_files_into_memory(&book.book, &mut files);
   |                                                                             ^^^^^^^^^^ expected struct `codespan::file::Files`, found a different struct `codespan::file::Files`
   |
   = note: expected mutable reference `&mut codespan::file::Files<std::string::String>`
              found mutable reference `&mut codespan::file::Files`
   = note: perhaps two different versions of crate `codespan` are being used?

error[E0308]: mismatched types
  --> src/tools/rustbook/src/main.rs:98:77
   |
98 |     let (links, incomplete) = mdbook_linkcheck::extract_links(target_files, &files);
   |                                                                             ^^^^^^ expected struct `codespan::file::Files`, found a different struct `codespan::file::Files`
   |
   = note: expected reference `&codespan::file::Files<std::string::String>`
              found reference `&codespan::file::Files`
   = note: perhaps two different versions of crate `codespan` are being used?

error[E0308]: mismatched types
   --> src/tools/rustbook/src/main.rs:101:75
    |
101 |         mdbook_linkcheck::validate(&links, &linkck_cfg, &src_dir, &cache, &files, incomplete)?;
    |                                                                           ^^^^^^ expected struct `codespan::file::Files`, found a different struct `codespan::file::Files`
    |
    = note: expected reference `&codespan::file::Files<std::string::String>`
               found reference `&codespan::file::Files`
    = note: perhaps two different versions of crate `codespan` are being used?

error[E0599]: no method named `is_server_error` found for reference `&reqwest::error::Error` in the current scope
   --> src/tools/rustbook/src/main.rs:122:31
    |
122 |                 } else if err.is_server_error() {
    |                               ^^^^^^^^^^^^^^^ method not found in `&reqwest::error::Error`

error[E0599]: no method named `is_http` found for reference `&reqwest::error::Error` in the current scope
   --> src/tools/rustbook/src/main.rs:124:32
    |
124 |                 } else if !err.is_http() {
    |                                ^^^^^^^ method not found in `&reqwest::error::Error`

error[E0308]: mismatched types
   --> src/tools/rustbook/src/main.rs:134:42
    |
134 |         Ok((outcome.generate_diagnostics(&files, linkck_cfg.warning_policy), files))
    |                                          ^^^^^^ expected struct `codespan::file::Files`, found a different struct `codespan::file::Files`
    |
    = note: expected reference `&codespan::file::Files<std::string::String>`
               found reference `&codespan::file::Files`
    = note: perhaps two different versions of crate `codespan` are being used?

error[E0308]: mismatched types
   --> src/tools/rustbook/src/main.rs:134:13
    |
134 |         Ok((outcome.generate_diagnostics(&files, linkck_cfg.warning_policy), files))
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `codespan_reporting::diagnostic::Diagnostic`, found a different struct `codespan_reporting::diagnostic::Diagnostic`
    |
    = note: expected struct `std::vec::Vec<codespan_reporting::diagnostic::Diagnostic>`
               found struct `std::vec::Vec<codespan_reporting::diagnostic::Diagnostic<codespan::file::FileId>>`
    = note: perhaps two different versions of crate `codespan_reporting` are being used?

error: aborting due to 7 previous errors

Some errors have detailed explanations: E0308, E0599.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `rustbook`.

To learn more, run the command again with --verbose.
command did not execute successfully: "/build/rust-xtensa-git/src/rust-xtensa/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--frozen" "--manifest-path" "/build/rust-xtensa-git/src/rust-xtensa/src/tools/rustbook/Cargo.toml" "--features" "linkcheck" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
failed to run: /build/rust-xtensa-git/src/rust-xtensa/build/bootstrap/debug/bootstrap install
Build completed unsuccessfully in 0:12:51

I was compiling successfully before.

Thanks for your efforts!

@MabezDev
Copy link
Member Author

I cant seem to reproduce your issue, perhaps a fresh clone and build?

@mtorromeo
Copy link

I just tried again, still the same error. Tried multiple times deleting the whole project directory, tried building it in a clean chroot with just the base dependencies installed. I always get the same exact error.

To double-check I just checked out again commit 25ae59a and recompiled it and it's working correctly without even cleaning the build directory.

I am not sure what to try next. I guess I could try bisecting the repo to find the first commit with the issue but I am not sure that every commit is supposed to build correctly and there are a lot...

@jessebraham
Copy link
Member

jessebraham commented May 29, 2020

I'm experiencing the same problem. I can confirm that the build was succeeding yesterday, but upon a fresh clone of the repo today this error has emerged.

Edit: I can confirm that checking out 25ae59a and building works correctly.

@arjanmels
Copy link

It works for me. However need to update llvm manually to later version to support all needed asm commands.
I did the following:

git clone git@github.com:MabezDev/rust-xtensa.git
cd rust-xtensa
git submodule update --init --recursive
cd src/llvm-project
git remote rename origin mabezdev
git remote add origin git@github.com:espressif/llvm-project.git 
git fetch origin
# get latest working version of llvm for xtensa
git checkout a5a002fc33cc86b42693c57fc818c71689b3cebc
# get small edits to llvm needed to support use as rust submodule
git cherry-pick 0951ae090a6febf4ae798a5d6912d02691b7688f
git commit -m "latest working llvm"
cd ../..
git add llvm_project
git commit -m "latest working llvm"
./configure --experimental-targets=Xtensa
./x.py build

@matevarga
Copy link

I can also confirm that I cannot compile a freshly cloned xtensa-target branch (exactly the same output as the OP).

@MabezDev
Copy link
Member Author

I'm still struggling to reproduce this issue, I've done multiple clean builds with the following steps:

  1. git clone https://github.com/MabezDev/rust-xtensa
  2. ./configure --experimental-targets=Xtensa
  3. ./x.py build

All of which of compiled successfully on my system. Could you provide some more info on your build environment?

@lexxvir
Copy link

lexxvir commented May 31, 2020

Works for me too:

  • fetch new commits from this repo then merge them
  • git submodule update --init --recursive
  • ./configure --experimental-targets=Xtensa
  • ./x.py build

@mtorromeo
Copy link

mtorromeo commented May 31, 2020

Alright, I got what we are doing differently.

I am trying to package the project for Arch Linux with a custom PKGBUILD (basically, it's just a bash script). This doesn't really matter because the errors can be reproduced without running the packaging script.

The steps I was using are a little different, but I tried with many variations. Initially, I was using a separately packaged llvm build (with --llvm-root="/opt/llvm-xtensa") but to make things simple I changed it to just ./configure --experimental-targets=Xtensa --prefix=/some/dir/ as it doesn't really make any difference.

The thing is that ./x.py build works fine but ./x.py dist or ./x.py install doesn't, and I needed to run those commands to copy the built files into the destination directory for the package.

This used to work. Maybe that's also what @matevarga and @jessebraham are trying to do.

@matevarga
Copy link

Thanks - correct, build works fine, install doesn't.

@jessebraham
Copy link
Member

jessebraham commented May 31, 2020

I think @mtorromeo is on the right path. I'm going from memory here but I am fairly confident it was ./x.py install that caused the error for me as well (I forgot to save the logs 😞). I know it was very late in the process at the very least.

I'm building a Dockerfile but this is essentially what is being run:

$ git clone https://github.com/MabezDev/rust-xtensa.git
$ cd ./rust-xtensa
$ ./configure --experimental-targets="Xtensa" --prefix="$RUST_BUILD"
$ python x.py build
$ python x.py install

I realize I did say 'build' in my previous post so apologies for not being more clear about that.

@MabezDev
Copy link
Member Author

MabezDev commented Jun 1, 2020

Ah okay, thanks for the clarification, I should be able to reproduce now.

@MabezDev
Copy link
Member Author

MabezDev commented Jun 1, 2020

I think I've found it. mdbook-linkcheck bumped the codespan version, which meant there were two different versions.

Could you try #35?

@jessebraham
Copy link
Member

I have checked out f87a95f and successfully built and installed, so that seems to have done the trick. Thanks!

@mtorromeo
Copy link

I confirm it's working fine now. Thanks!

@MabezDev
Copy link
Member Author

MabezDev commented Jun 2, 2020

Glad to hear it :). When you have it packaged up, would you mind PR'ing a link to it in the readme? I'm sure arch users would appreciate it!

@mtorromeo
Copy link

Sure thing! I am still ironing out a few things. Note that there's already a package on AUR [1] but I am working on a cleaner implementation.

I know that by nature of this project it's maybe not an easy thing to do but it would be cool to have some tagged commits for stable/semi-stable builds so that I can prepare a package that follows those "releases".

[1] https://aur.archlinux.org/packages/rust-xtensa-git/

@MabezDev
Copy link
Member Author

MabezDev commented Jun 3, 2020

That might be quite difficult, but I could try and loosely follow the rust update cycle (every 6 weeks)? If that works for you I could try and do that for the next Rust release?

@mtorromeo
Copy link

The idea is a new release should represent a suggested version to use because you either think that it should work better than any other random commit and/or that the user should really update from an older commit because there are important changes in the new version.

6 weeks update cycles should be fine but I think the fixed release windows are something that is more useful to the developers to organize the work into releases and plan features ahead of time. You can use whatever timeline you are comfortable with IMO.

If you think that pulling changes at every push you make to the default branch has the same stability "guarantees" than the releases you would tag, then I don't think you should make your life any harder by worrying about the releases.

I'll leave it up to you, whatever you can do is really appreciated anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.