Commit Graph

99054 Commits

Author SHA1 Message Date
Dylan MacKenzie
19bf0f4c90 Fix typo 2019-09-18 07:32:57 -07:00
Dylan MacKenzie
a526e4faa6 Use an associated const for name 2019-09-18 07:32:42 -07:00
Dylan MacKenzie
cbaaf05b94 Fix Analysis example 2019-09-18 07:32:15 -07:00
Dylan MacKenzie
d583fefa59 Add ignore reason to placate tidy 2019-09-17 17:53:36 -07:00
Dylan MacKenzie
288603709e Temporarily add #[allow(unused)] for CI
This can be removed once dataflow-based const validation is merged.
2019-09-17 17:52:50 -07:00
Dylan MacKenzie
5496a1fbbe Document new dataflow analysis 2019-09-17 17:52:47 -07:00
Dylan MacKenzie
ceb72e4ad1 Add generic dataflow impl 2019-09-17 16:52:13 -07:00
bors
a44881d892 Auto merge of #64510 - Centril:rollup-m03zsq8, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #63955 (Make sure interned constants are immutable)
 - #64028 (Stabilize `Vec::new` and `String::new` as `const fn`s)
 - #64119 (ci: ensure all tool maintainers are assignable on issues)
 - #64444 (fix building libstd without backtrace feature)
 - #64446 (Fix build script sanitizer check.)
 - #64451 (when Miri tests are not passing, do not add Miri component)
 - #64467 (Hide diagnostics emitted during --cfg parsing)
 - #64497 (Don't print the "total" `-Ztime-passes` output if `--prints=...` is also given)
 - #64499 (Use `Symbol` in two more functions.)
 - #64504 (use println!() instead of println!(""))

Failed merges:

r? @ghost
2019-09-16 15:35:48 +00:00
Mazdak Farrokhzad
f4ff4189ae
Rollup merge of #64504 - guanqun:use-println-without-empty-str, r=jonas-schievink
use println!() instead of println!("")

The empty string is unnecessary.
2019-09-16 17:09:46 +02:00
Mazdak Farrokhzad
d8ecf45da8
Rollup merge of #64499 - nnethercote:use-Symbol-in-two-more-functions, r=petrochenkov
Use `Symbol` in two more functions.

r? @petrochenkov
2019-09-16 17:09:44 +02:00
Mazdak Farrokhzad
acbbcda399
Rollup merge of #64497 - nnethercote:fix-64339, r=petrochenkov
Don't print the "total" `-Ztime-passes` output if `--prints=...` is also given

Fixes #64339.
2019-09-16 17:09:43 +02:00
Mazdak Farrokhzad
75db5711a4
Rollup merge of #64467 - Mark-Simulacrum:hide-cfg-failures, r=estebank
Hide diagnostics emitted during --cfg parsing

The early error is more than sufficient for fixing the problem.

Fixes https://github.com/rust-lang/rust/issues/31496.
2019-09-16 17:09:41 +02:00
Mazdak Farrokhzad
7975973e2b
Rollup merge of #64451 - RalfJung:miri-manifest, r=pietroalbini
when Miri tests are not passing, do not add Miri component

This makes build-manifest query the toolstate repo at https://github.com/rust-lang-nursery/rust-toolstate to figure out if the tests of the Miri component are passing. If they are not, we remove the component from the manifest, to avoid shipping a broken Miri.

I tested this locally by running build-manifest and making sure that it correctly detects the toolstate of 02785dabad as broken.

r? @pietroalbini
Cc @kennytm @alexcrichton

Fixes https://github.com/rust-lang/rust/issues/60301
2019-09-16 17:09:40 +02:00
Mazdak Farrokhzad
f0320e54c7
Rollup merge of #64446 - ehuss:fix-sanitizer-build, r=alexcrichton
Fix build script sanitizer check.

#64166 changed the way the sanitizer build scripts work. However, they were changed so that they switch between new-style to old-style cargo fingerprints. This trips up on https://github.com/rust-lang/cargo/issues/6779.

It also causes rustbuild to panic.  If you build stage1 std (with sanitizers off), and then enable sanitizers, it panics.  (This is because the build scripts don't declare that they need to re-run.)

This PR will trip https://github.com/rust-lang/cargo/issues/6779 again, unfortunately. I've been having way too many unexplained rebuilds in rust-lang/rust recently, but at least I'll know why this time.

This doesn't fix all problems with the build scripts, but arguably they should be fixed in cargo. For example, the build scripts change which rerun-if statements they declare between runs which triggers https://github.com/rust-lang/cargo/issues/7362.

The test for this is:
1. Turn off sanitizers (which is the default)
2. `./x.py build --stage=1 src/libstd`
3. `./x.py build --stage=1 src/libstd` again should be a null build.
4. Enable sanitizers.
5. `./x.py build --stage=1 src/libstd` should rebuild with sanitizers enabled.
6. `./x.py build --stage=1 src/libstd` again should be a null build. This actually rebuilds due to https://github.com/rust-lang/cargo/issues/7362 because the rerun-if directives changed between step 3 and 5. A 3rd attempt should be a null build.
2019-09-16 17:09:38 +02:00
Mazdak Farrokhzad
2a6a342aaf
Rollup merge of #64444 - RalfJung:no-backtrace, r=alexcrichton
fix building libstd without backtrace feature

Fixes https://github.com/rust-lang/rust/issues/64410

r? @alexcrichton
2019-09-16 17:09:37 +02:00
Mazdak Farrokhzad
63bc6aeb7d
Rollup merge of #64119 - pietroalbini:validate-toolstate-maintainers, r=kennytm
ci: ensure all tool maintainers are assignable on issues

GitHub only allows people explicitly listed as collaborators on the repository or who commented on the issue/PR to be assignees, failing to create the issue if non-assignable people are assigned.

This adds an extra check on CI to make sure all the people listed as tool maintainers can be assigned to toolstate issues. The check won't be executed on PR builds due to the lack of a valid token.

r? @kennytm
2019-09-16 17:09:35 +02:00
Mazdak Farrokhzad
be327a8f69
Rollup merge of #64028 - Centril:stabilize-alloc-new-2, r=alexcrichton
Stabilize `Vec::new` and `String::new` as `const fn`s

Closes https://github.com/rust-lang/rust/issues/64022.

r? @oli-obk
2019-09-16 17:09:34 +02:00
Mazdak Farrokhzad
f432d5030e
Rollup merge of #63955 - RalfJung:intern, r=oli-obk
Make sure interned constants are immutable

This makes sure that interning for constants (not statics) creates only immutable allocations.

Previously, the "main" allocation of `const FOO: Cell<i32> = Cell::new(0);` was marked as mutable, but I don't think we want that. It can be only copied, not written to.

Also, "leftover" allocations (behind raw pointers etc) were left mutable. I don't think we want to support that. I tried asserting that these are all already immutable (to double-check our static checks), but that failed in this one:
```rust
const NON_NULL_PTR2: NonNull<u8> = unsafe { mem::transmute(&0) };
```
Seems like maybe we want more precise mutability annotation inside Miri for locals (like `&0` here) so that this would actually become immutable to begin with?

I also factored `intern_shallow` out of the visitor so that we don't have to construct a visitor when we do not plan to visit anything. That confused me at first.
2019-09-16 17:09:33 +02:00
Mazdak Farrokhzad
9b3e11f635 Const-stabilize String::new. 2019-09-16 16:45:16 +02:00
Mazdak Farrokhzad
d5fe5831ec Const-stabilize Vec::new. 2019-09-16 16:45:16 +02:00
Ralf Jung
49854c4f71 avoid #[cfg] in favor of cfg! 2019-09-16 16:37:44 +02:00
Pietro Albini
ce451b9b26
ci: remove projektir from toolstate notifications
They don't contribute to rust-by-example anymore.
2019-09-16 16:31:52 +02:00
Pietro Albini
f2576c821d
ci: convert maintainer list in publish_toolstate to a set 2019-09-16 16:31:50 +02:00
Pietro Albini
f968c1a4f5
ci: address publish_toolstate review comments 2019-09-16 16:30:50 +02:00
Pietro Albini
eb97b1bfde
ci: rename Gankro to Gankra in toolstate 2019-09-16 16:30:48 +02:00
Pietro Albini
d3d7b58c37
ci: ensure all tool maintainers are assignable on issues
GitHub only allows people explicitly listed as collaborators on the
repository or who commented on the issue/PR to be assignees, failing to
create the issue if non-assignable people are assigned.

This adds an extra check on CI to make sure all the people listed as
tool maintainers can be assigned to toolstate issues. The check won't be
executed on PR builds due to the lack of a valid token.
2019-09-16 16:30:46 +02:00
bors
16c4011673 Auto merge of #64381 - mati865:rand, r=alexcrichton
Upgrade parking_lot and tempfile rustc dependencies

This should be last piece to unbreak `rustc` in https://github.com/rust-lang/rust/issues/63848
2019-09-16 11:47:11 +00:00
bors
b6269f27d9 Auto merge of #64383 - pcpthm:btreeset-size-hint, r=dtolnay
Improve BTreeSet::Intersection::size_hint

A comment on `IntersectionInner` mentions `small_iter` should be smaller than `other_iter` but this condition is broken while iterating because those two iterators can be consumed at a different rate. I added a test to demonstrate this situation.
<del>I made `small_iter.len() < other_iter.len()` always true by swapping two iterators when that condition became false. This change affects the return value of `size_hint`. The previous result was also correct but this new version always returns smaller upper bound than the previous version.</del>
I changed `size_hint` to taking minimum of both lengths of iterators and renamed fields to `a` and `b` to match `Union` iterator.
2019-09-16 05:16:19 +00:00
Nicholas Nethercote
163892cf50 Use Symbol in two more functions. 2019-09-16 15:00:28 +10:00
pcpthm
4333b86972 Improve BTreeSet::Intersection::size_hint
The commented invariant that an iterator is smaller than other iterator
was violated after next is called and two iterators are consumed at
different rates.
2019-09-16 04:37:52 +00:00
Nicholas Nethercote
bb229865fa Don't print the "total" -Ztime-passes output if --prints=... is also given.
Fixes #64339.
2019-09-16 13:27:38 +10:00
bors
3e3e06dfdd Auto merge of #64487 - Xanewok:update-rls, r=jonas-schievink
Update RLS

Fixes the toolstate.

Closes #64480

r? @jonas-schievink
2019-09-16 00:15:45 +00:00
Mark Rousskov
a678e31911 Hide diagnostics emitted during --cfg parsing
The early error is more than sufficient for fixing the problem.
2019-09-15 17:39:38 -04:00
bors
06c94ee79b Auto merge of #64491 - Centril:rollup-21wkl69, r=Centril
Rollup of 3 pull requests

Successful merges:

 - #63872 (Document platform-specific behavior of the iterator returned by std::fs::read_dir)
 - #64250 (save-analysis: Nest typeck tables when processing functions/methods)
 - #64472 (Don't mark expression with attributes as not needing parentheses)

Failed merges:

r? @ghost
2019-09-15 20:06:49 +00:00
Mazdak Farrokhzad
0592d13757
Rollup merge of #64472 - Mark-Simulacrum:unused-parens-attr, r=varkor
Don't mark expression with attributes as not needing parentheses

This is not perfectly correct as `#[attr] (5)` will still not lint, but it does seem good enough, in particular as the parentheses in that case are not unambiguously incorrect; I might personally prefer to see them for clarity.

Fixes https://github.com/rust-lang/rust/issues/43279.
2019-09-15 19:36:01 +02:00
Mazdak Farrokhzad
2e11e81f1e
Rollup merge of #64250 - Xanewok:save-analysis-assoc-nested, r=varkor
save-analysis: Nest typeck tables when processing functions/methods

Fixes an issue where we did not nest tables correctly when resolving
associated types in formal argument/return type positions.

This was the minimized reproduction case that I tested the fix on:
```rust
pub trait Trait {
    type Assoc;
}

pub struct A;

pub fn func() {
    fn _inner1<U: Trait>(_: U::Assoc) {}
    fn _inner2<U: Trait>() -> U::Assoc { unimplemented!() }

    impl A {
        fn _inner1<U: Trait>(self, _: U::Assoc) {}
        fn _inner2<U: Trait>(self) -> U::Assoc { unimplemented!() }
    }
}
```
using `debug_assertions`-enabled rustc and by additionally passing `-Zsave-analysis`.

Unfortunately the original assertion fired is a *debug* one and from what I can tell we don't run the tests with these on, so I'm not adding a test here. If I missed it and there is a way to run tests with these on, I'd love to add a test case for this.

Closes #63663
Closes #50328
Closes #43982
2019-09-15 19:35:59 +02:00
Mazdak Farrokhzad
0a2e07ec1d
Rollup merge of #63872 - marmistrz:readdir, r=jonas-schievink
Document platform-specific behavior of the iterator returned by std::fs::read_dir
2019-09-15 19:35:58 +02:00
bors
96d07e0ac9 Auto merge of #64474 - Mark-Simulacrum:permit-err-overlap, r=matthewjasper
Permit impls referencing errors to overlap

Fixes #43400; previously this would emit an overlapping impls error, but no longer does.
2019-09-15 16:21:34 +00:00
Guanqun Lu
5355a16150 use println!() 2019-09-15 23:15:06 +08:00
Igor Matuszewski
f90f7ac46a Update RLS 2019-09-15 16:00:01 +02:00
Mark Rousskov
959c710e85 Permit impls referencing errors to overlap 2019-09-15 08:33:00 -04:00
Ralf Jung
5462ecb4b1 update intern classification comment 2019-09-15 14:25:30 +02:00
Ralf Jung
224e2e5e9e explain ty == None 2019-09-15 14:25:30 +02:00
Ralf Jung
3424811852 assert that nobody asks for mutable constants 2019-09-15 14:25:30 +02:00
Ralf Jung
14e3506738 note a FIXME 2019-09-15 14:25:30 +02:00
Ralf Jung
b1d4d2bfea relocations -> allocations 2019-09-15 14:25:29 +02:00
bors
60895fd1f9 Auto merge of #64483 - petrochenkov:expectattr2, r=Centril
resolve: Tweak some "cannot find" wording for macros
2019-09-15 12:24:32 +00:00
Ralf Jung
75c82b4dd8 drop redundant ParamEnv, and avoid constructing InternVisitor without visiting 2019-09-15 14:23:14 +02:00
Ralf Jung
7b8693eff8 all memory behind a constant must be immutable 2019-09-15 13:57:59 +02:00
Ralf Jung
6137691933 const interning: move mutability computation into intern_shallow, and always intern constants as immutable 2019-09-15 13:57:58 +02:00