Commit Graph

79631 Commits

Author SHA1 Message Date
Zack M. Davis
64365e46f2 driveby status update to 2015 comment about parens in patterns 2018-06-26 07:54:49 -07:00
Zack M. Davis
3fb76f4027 inclusive range syntax lint (.....=)
Our implementation ends up changing the `PatKind::Range` variant in the
AST to take a `Spanned<RangeEnd>` instead of just a `RangeEnd`, because
the alternative would be to try to infer the span of the range operator
from the spans of the start and end subexpressions, which is both
hideous and nontrivial to get right (whereas getting the change to the
AST right was a simple game of type tennis).

This is concerning #51043.
2018-06-26 07:54:49 -07:00
Zack M. Davis
057715557b migrate codebase to ..= inclusive range patterns
These were stabilized in March 2018's #47813, and are the Preferred Way
to Do It going forward (q.v. #51043).
2018-06-26 07:53:30 -07:00
bors
764232cb2a Auto merge of #51805 - pietroalbini:rollup, r=pietroalbini
Rollup of 11 pull requests

Successful merges:

 - #51104 (add `dyn ` to display of dynamic (trait) types)
 - #51153 (Link panic and compile_error docs)
 - #51642 (Fix unknown windows build)
 - #51730 (New safe associated functions for PinMut)
 - #51731 (Fix ICEs when using continue as an array length inside closures (inside loop conditions))
 - #51747 (Add error for using null characters in #[export_name])
 - #51769 (Update broken rustc-guide links)
 - #51786 (Remove unnecessary stat64 pointer casts)
 - #51788 (Fix typo)
 - #51789 (Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`)
 - #51791 (Minify css)

Failed merges:

r? @ghost
2018-06-26 11:20:18 +00:00
Pietro Albini
a539885450
Rollup merge of #51791 - GuillaumeGomez:minify-css, r=estebank
Minify css

Sizes changes:

```
dark.css: 8821 => 7804 (~11%)
light.css: 8587 => 7565 (~11%)
rustdoc.css: 22364 => 17818 (~20%)
settings.css: 1384 => 1236 (~10%)
```

So obviously, the bigger the file, the bigger minification.

r? @QuietMisdreavus
2018-06-26 11:35:45 +02:00
Pietro Albini
f2a099b17f
Rollup merge of #51789 - estebank:issue-50577, r=oli-obk
Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`

Fix #50577. CC #51696.

r? @oli-obk
2018-06-26 11:35:44 +02:00
Pietro Albini
8014713805
Rollup merge of #51788 - berkus:fix-typo, r=varkor
Fix typo
2018-06-26 11:35:43 +02:00
Pietro Albini
2348dc5b3f
Rollup merge of #51786 - cuviper:stat64-pointers, r=Mark-Simulacrum
Remove unnecessary stat64 pointer casts

In effect, these just casted `&mut stat64` to `*mut stat64`, twice.
That's harmless, but it masked a problem when this was copied to new
code calling `fstatat`, which takes a pointer to `struct stat`.  That
will be fixed by #51785, but let's remove the unnecessary casts here
too.
2018-06-26 11:35:41 +02:00
Pietro Albini
932db193c2
Rollup merge of #51769 - alexcameron89:update_rustc_guide_links, r=frewsxcv
Update broken rustc-guide links

Recently, there has been some rearrangement of the content in the Rustc
Guide, and this commit changes the urls the match the updated guide.
2018-06-26 11:35:40 +02:00
Pietro Albini
b2cf26eec1
Rollup merge of #51747 - varkor:export_name-null-character, r=estebank
Add error for using null characters in #[export_name]

Fixes #51741.
2018-06-26 11:35:39 +02:00
Pietro Albini
7262824128
Rollup merge of #51731 - varkor:closure-array-break-length, r=estebank
Fix ICEs when using continue as an array length inside closures (inside loop conditions)

Fixes #51707.
Fixes #51708.

r? @estebank
2018-06-26 11:35:38 +02:00
Pietro Albini
b71f6df5dd
Rollup merge of #51730 - MajorBreakfast:pin-get-mut-unchecked, r=withoutboats
New safe associated functions for PinMut

- Add safe `get_mut` and `map`
- Rename unsafe equivalents to `get_mut_unchecked` and `map_unchecked`

The discussion about this starts [in this comment](https://github.com/rust-lang/rust/issues/49150#issuecomment-399604573) on the tracking issue.
2018-06-26 11:35:37 +02:00
Pietro Albini
1215965a12
Rollup merge of #51642 - GuillaumeGomez:fix-unknown-windows-build, r=oli-obk
Fix unknown windows build

Fixes #51618.
2018-06-26 11:35:35 +02:00
Pietro Albini
756b69492b
Rollup merge of #51153 - ogham:panic-and-compile_error-docs, r=GuillaumeGomez
Link panic and compile_error docs

This adds documentation links between `panic!()` and `compile_error!()` as per #47275, which points out that they’re similar. It also adds a sentence to the `compile_error()` docs I thought could be added.
2018-06-26 11:35:34 +02:00
Pietro Albini
d72a67f3bb
Rollup merge of #51104 - zackmdavis:dynamo, r=nikomatsakis
add `dyn ` to display of dynamic (trait) types

~~I'm not sure we want the `dyn` in the E0277 "trait bound [...] is not satisfied" messages ("bound" sounds like a different thing in contrast to the names of specific trait-object types like `Box<dyn Trait>`), but I'm finding the code I would need to change that hard to follow—the [display object seems to](f0805a4421/src/librustc/traits/error_reporting.rs (L600)) be a [`Predicate::Trait`](f0805a4421/src/librustc/ty/mod.rs (L962)) variant, whose [`Display` implementation](f0805a4421/src/librustc/util/ppaux.rs (L1309)) calls `.print` on its `PolyTraitPredicate` member, [which is a type alias](f0805a4421/src/librustc/ty/mod.rs (L1112)) for `ty::Binder<TraitPredicate<'tcx>>`, whose [`Display` implementation](f0805a4421/src/librustc/util/ppaux.rs (L975-L985)) ... _&c._— so maybe it's time to pull-request this and see what reviewers think.~~

 Resolves #49277 (?).

r? @nikomatsakis
2018-06-26 11:35:33 +02:00
bors
309fd8a6fb Auto merge of #49469 - Nokel81:allow-irrefutable-let-patterns, r=nikomatsakis
Implementation of RFC 2086 - Allow Irrefutable Let patterns

This is the set of changes for RFC2086. Tracking issue #44495. Rendered [here](https://github.com/rust-lang/rfcs/pull/2086)
2018-06-26 09:20:33 +00:00
bors
773ce53ce7 Auto merge of #51613 - nnethercote:ob-forest-cleanup, r=nikomatsakis
Obligation forest cleanup

While looking at this code I was scratching my head about whether a node could appear in both `parent` and `dependents`. Turns out it can, but it's not useful to do so, so this PR cleans things up so it's no longer possible.
2018-06-26 07:06:18 +00:00
bors
7d2fa4a4d2 Auto merge of #50630 - sharkdp:fix-50619, r=sfackler
Fix possibly endless loop in ReadDir iterator

Certain directories in `/proc` can cause the `ReadDir` iterator to loop indefinitely. We get an error code (22) when calling libc's `readdir_r` on these directories, but `entry_ptr` is `NULL` at the same time, signalling the end of the directory stream.

This change introduces an internal state to the iterator such that the `Some(Err(..))` value will only be returned once when calling `next`. Subsequent calls will return `None`.

fixes #50619
2018-06-26 03:49:37 +00:00
bors
fdd9cdc879 Auto merge of #50966 - leodasvacas:self-in-where-clauses-is-not-object-safe, r=nikomatsakis
`Self` in where clauses may not be object safe

Needs crater, virtually certain to cause regressions.

In #50781 it was discovered that our object safety rules are not sound because we allow `Self` in where clauses without restrain. This PR is a direct fix to the rules so that we disallow methods with unsound where clauses.

This currently uses hard error to measure impact, but we will want to downgrade it to a future compat error.

Part of #50781.

r? @nikomatsakis
2018-06-26 01:42:14 +00:00
Niko Matsakis
91680347a7
make the while let loop terminate 2018-06-25 17:33:49 -04:00
Guillaume Gomez
f7485df05b Minify css 2018-06-25 23:28:20 +02:00
Esteban Küber
7aab3bf863 Don't ICE when performing lower_pattern_unadjusted on a TyError 2018-06-25 13:49:34 -07:00
Berkus Karchebnyy
07479688b2 Fix typo 2018-06-25 23:44:48 +03:00
bors
2a1c4eec40 Auto merge of #51785 - cuviper:fstatat64, r=Mark-Simulacrum
Use fstatat64 where available

None
2018-06-25 19:40:56 +00:00
Josh Stone
490f49fd2a Remove unnecessary stat64 pointer casts
In effect, these just casted `&mut stat64` to `*mut stat64`, twice.
That's harmless, but it masked a problem when this was copied to new
code calling `fstatat`, which takes a pointer to `struct stat`.  That
will be fixed by #51785, but let's remove the unnecessary casts here
too.
2018-06-25 12:34:33 -07:00
Josh Stone
65d31d7269 Use fstatat64 where available 2018-06-25 11:42:27 -07:00
Guillaume Gomez
3c6c18d095 Add missing \[allow(missing_docs)\] 2018-06-25 20:38:29 +02:00
bors
b7c6e8f180 Auto merge of #51728 - bradjc:llvm-tools2, r=kennytm
build: add llvm-tools to manifest

This commit expands on a previous commit to build llvm-tools as a rustup component. It causes the llvm-tools component to be built if the extended step is active. It also adds llvm-tools to the build manifest so rustup can find it.

I tested this as far as I could, but had to hack `build-manifest/src/main.rs` a bit as it is not supported on MacOS. The main change I am not sure about is this line:

```rust
self.package("llvm-tools", &mut manifest.pkg, TARGETS);
```

There are numerous calls to `self.package()`, and I'm not sure if `TARGETS`, `HOSTS`, or `["*"]` is appropriate for llvm-tools.

Otherwise I mostly copied the example set by `rustfmt-preview`.
2018-06-25 17:22:12 +00:00
varkor
c3d6ee9e7b Make find_breakable_scope non-mutable 2018-06-25 15:27:37 +01:00
bors
8acec1f9d0 Auto merge of #51750 - zackmdavis:superstructure, r=oli-obk
three diagnostics upgrades

 * reword `...` expression syntax error to not imply that you should use it in patterns either (#51043) and make it a structured suggestion
 * shorten the top-line message for the trivial-casts lint by tucking the advisory sentence into a help note
 * structured suggestion for pattern-named-the-same-as-variant warning

r? @oli-obk
2018-06-25 13:43:22 +00:00
bors
ecfe37056f Auto merge of #51733 - varkor:ice-match-slice, r=oli-obk
Fix an ICE when matching over const slices

Fixes #51655. I'm not super familiar with this code, so tell me if this is the wrong approach 😅

r? @oli-obk
2018-06-25 11:36:13 +00:00
leonardo.yvens
cc60e01581 Fill in tracking issue for WHERE_CLAUSES_OBJECT_SAFETY future compat lint 2018-06-25 06:57:08 -03:00
leonardo.yvens
a602654a6e Make where clause object safety be a warn-by-default lint 2018-06-25 06:57:08 -03:00
leonardo.yvens
1453b3a67d Self in where clauses may not be object safe
This is virtually certain to cause regressions, needs crater.

In #50781 it was discovered that our object safety rules are not sound because we allow `Self` in where clauses without restrain. This PR is a direct fix to the rules so that we disallow methods with unsound where clauses.

This currently uses hard error to measure impact, but we will want to downgrade it to a future compat error.

Fixes #50781.

r? @nikomatsakis
2018-06-25 06:56:06 -03:00
bors
446aef691e Auto merge of #51335 - mark-i-m:allocator, r=oli-obk
Prohibit `global_allocator` in submodules

Background: #44113 is caused by weird interactions with hygiene. Hygiene is hard. After a lot of playing around, we decided that the best path forward would be to prohibit `global_allocator`s from being in submodules for now. When somebody gets it working, we can re-enable it.

This PR contains the following
- Some hygiene "fixes" -- things I suspect are the correct thing to do that will make life easier in the future. This includes using call_site hygiene for the generated module and passing the correct crate name to the expansion config.
- Comments and minor formatting fixes
- Some debugging code
- Code to prohibit `global_allocator` in submodules
- Test checking that the proper error occurs.

cc #44113 #49320 #51241

r? @alexcrichton
2018-06-25 08:54:16 +00:00
Benjamin Sago
f85ddfbc3f
Add sentence to compile_error!() docs
It now details why using compile_error!() is different from just not having the final macro_rules!() branch.
2018-06-25 10:34:00 +02:00
Benjamin Sago
2d3c369d87
Link the docs of panic!() and compile_error!()
Fixes #47275. These two macros are similar, but different, and could do with documentation links to each other.
2018-06-25 10:33:54 +02:00
bors
5f9c7f9e6d Auto merge of #51688 - spastorino:error-note-field-after-move, r=nikomatsakis
Fix erroneous error note when using field after move

Closes #51512

r? @nikomatsakis
2018-06-25 06:44:08 +00:00
Alex Kitchens
fdc2275609 Update broken rustc-guide links
Recently, there has been some rearrangement of the content in the Rustc
Guide, and this commit changes the urls the match the updated guide.
2018-06-24 22:00:39 -05:00
mark
16d7f87b6c used debug, not info 2018-06-24 16:16:14 -05:00
mark
997655cf87 actually fix test 2018-06-24 16:16:14 -05:00
mark
e3534028eb fix test 2018-06-24 16:16:14 -05:00
Mark Mansi
08479aabd0 enable fold_mac 2018-06-24 16:16:14 -05:00
Mark Mansi
792772a93b Prohibit global_allocator in submodules for now
- we need to figure out hygiene first
- change the test to check that the prohibition works with a good error
  msg
- leaves some comments and debugging code
- leaves some of our supposed fixes
2018-06-24 16:15:13 -05:00
Mark Mansi
5da4ff8180 Attempt to fix hygiene for global_allocator 2018-06-24 16:10:20 -05:00
varkor
f94c075ab4 Add item after attribute 2018-06-24 18:20:25 +01:00
bors
01cc982e93 Auto merge of #51740 - GuillaumeGomez:fix-error-code-numbers, r=cramertj
Fix error code numbers

Fixes issue created by #51580.

r? @cramertj
2018-06-24 15:08:48 +00:00
Zack M. Davis
0b39a82cf4 in which the trivial-casts word to the wise is tucked into a help note
The top level message shouldn't be too long; the
replaced-by-coercion/temporary-variable advice can live in a note. Also,
don't mention type ascription when it's not actually available as a real
thing. (The current state of discussion on the type ascription tracking
issue #23416 makes one rather suspect it will never be a stable thing in
its current form, but that's not for us to adjudicate in this commit.)

While we're here, yank out the differentiating parts of the
numeric/other conditional and only have one codepath emitting the
diagnostic.
2018-06-23 22:57:37 -07:00
Zack M. Davis
a417518173 structured suggestion and rewording for ... expression syntax error
Now that `..=` inclusive ranges are stabilized, people probably
shouldn't be using `...` even in patterns, even if it's still legal
there (see #51043). To avoid drawing attention to `...` being a real
thing, let's reword this message to just say "unexpected token" rather
"cannot be used in expressions".
2018-06-23 22:57:37 -07:00
Zack M. Davis
4650361fb6 use structured suggestion for pattern-named-the-same-as-variant warning 2018-06-23 22:57:37 -07:00