Commit Graph

79699 Commits

Author SHA1 Message Date
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
Zack M. Davis
4b1808578a add dyn to display of dynamic (trait) type names
The `dyn Trait` syntax was stabilized in 199ee327. Resolves #49277.
2018-06-23 18:10:25 -07:00
bors
3874676dc6 Auto merge of #51726 - petrochenkov:hygclean, r=oli-obk
expansion/hygiene: Some renaming, refactoring and comments

Pure refactoring, no functional changes.
Commits are isolated and self-descriptive.
2018-06-24 01:06:21 +00:00
varkor
82803fd9bd Add backticks to E0558 2018-06-24 00:16:10 +01:00
bors
8fb1180d27 Auto merge of #51739 - Amanieu:update_rustfmt, r=Mark-Simulacrum
Update rustfmt submodule

The version of rustfmt currently shipped with nightly breaks code that uses `break 'label`. This PR updates the submodule to include the fix (https://github.com/rust-lang-nursery/rustfmt/pull/2774).
2018-06-23 22:27:30 +00:00
Brad Campbell
f10da5fdb9
build: llvm-tools: replace compiler.host
Use `target` instead.
2018-06-23 17:32:25 -04:00
varkor
74609bca80 Add error for using null characters in export_name 2018-06-23 22:31:31 +01:00
bors
60efbdead6 Auto merge of #51653 - mglagla:option-unreachable, r=dtolnay
Option::get_or_insert(_with): Replace unreachable! with unreachable_unchecked

Optimize codegen for both functions as the None branch is trivially not reachable.
2018-06-23 20:10:35 +00:00
Guillaume Gomez
8f1ef6e3be Fix error code numbers 2018-06-23 22:08:40 +02:00
Vadim Petrochenkov
20ce91076a hygiene: Merge NameAndSpan into ExpnInfo 2018-06-23 21:53:24 +03:00
Amanieu d'Antras
c44be4c231 Update Cargo.lock 2018-06-23 19:15:34 +01:00
Amanieu d'Antras
794acd7047 Update rustfmt submodule 2018-06-23 18:54:42 +01:00
Vadim Petrochenkov
117cb040f1 hygiene: Make sure transparency of Mark::root() is an implementation detail and cannot be inspected outside of hygiene.rs 2018-06-23 20:42:25 +03:00
Vadim Petrochenkov
c00f5af4d6 hygiene: Do not reset expansion info for quote! 2018-06-23 20:40:25 +03:00
Vadim Petrochenkov
fffe9fbb51 hygiene: More descriptive names for things involved in late hygienic name resolution 2018-06-23 20:09:21 +03:00
Vadim Petrochenkov
296955a6e1 expansion: Add some comments 2018-06-23 20:09:21 +03:00
Vadim Petrochenkov
399da7bc35 expansion: Improve searchability for AstFragments methods 2018-06-23 20:09:21 +03:00
Vadim Petrochenkov
a12726460e expansion: Rename Expansion to AstFragment 2018-06-23 20:09:21 +03:00
Vadim Petrochenkov
869fa27d13 hygiene: Rename MarkKind to Transparency
Move `is_builtin` for `Mark` to a separate flag
2018-06-23 20:09:21 +03:00
Vadim Petrochenkov
b15785b671 hygiene: Make sure expansion info is set at most once for a given Mark 2018-06-23 20:09:21 +03:00
Vadim Petrochenkov
17f20bec22 expansion: Remove unnecessary override from impl Folder for Marker 2018-06-23 20:09:21 +03:00
Vadim Petrochenkov
9b2a89b7f1 hygiene: Give Debug impls to hygiene structures 2018-06-23 20:09:21 +03:00
varkor
ee7e30f14a Fix codegen tests 2018-06-23 18:00:47 +01:00
varkor
dc7d77f88e Add a test for break 2018-06-23 18:00:47 +01:00
varkor
4efd5c75a8 Fix an ICE with continue inside a closure inside a loop condition 2018-06-23 18:00:47 +01:00
varkor
f68ee0b4e1 Fix an ICE with continue as an array length 2018-06-23 18:00:46 +01:00
Brad Campbell
5fc87ebbba
build: llvm_tools tidy 2018-06-23 12:34:18 -04:00
Josef Reinhard Brandl
3bcb85ee65 PinMut: Add safe get_mut and rename unsafe fns to get_mut_unchecked and map_unchecked 2018-06-23 18:29:56 +02:00
bors
4fe88c05cd Auto merge of #51727 - varkor:expragain-to-exprcontinue, r=petrochenkov
Rename hir::ExprAgain to hir::ExprContinue

The current name is confusing and historical.

I also used this PR to clean up the annoying indentation in `check/mod.rs`. If that's viewed as too tangential a change, I'll split it up, but it seemed reasonable to slip it in to reduce @bors's work. It's easy to compare for the two commits individually.

r? @petrochenkov
2018-06-23 14:33:10 +00:00
varkor
e14e48bfaa Fix an ICE when matching over const slices 2018-06-23 14:41:01 +01:00
bors
a51e807136 Auto merge of #51723 - estebank:abolish-ice, r=oli-obk
Accept `TyError` in `analyze_closure` to avoid ICE

Fix #51714.
2018-06-23 11:00:43 +00:00
varkor
621047b2b0 Reindent check/mod.rs 2018-06-23 11:00:02 +01:00
Brad Campbell
739fe4b3c5
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.
2018-06-23 05:57:32 -04:00