Commit Graph

102218 Commits

Author SHA1 Message Date
bors
38048763e8 Auto merge of #65728 - ecstatic-morse:promotion-const-proj, r=eddyb
Fix promotion in a `const` when projections are present

Resolves #65727.

This marks the entire local as "needs promotion" when only a projection of that local appears in a promotable context. This should only affect promotion in a `const` or `static`, not in a `fn` or `const fn`, which is handled in `promote_consts.rs`.

r? @eddyb
2019-11-06 18:12:57 +00:00
Esteban Küber
a12a32ab65 review comments 2019-11-06 10:04:23 -08:00
Esteban Küber
f545a50ee4 Suggest missing item from trait in impl 2019-11-06 10:00:59 -08:00
Guillaume Gomez
0282c27781 rename cfg(rustdoc) into cfg(doc) 2019-11-06 18:32:51 +01:00
Pyry Kontio
8568204f4e Try with crate::error::Error 2019-11-07 01:45:46 +09:00
Alice Ryhl
2daf7b9fe3
Fix broken link in README 2019-11-06 16:41:24 +01:00
Nadrieril
098974dadd Split slice-patterns test as suggested by Centril 2019-11-06 15:27:21 +00:00
Dylan MacKenzie
ec5ba54ed2 Add test for promotability in let
The old const-checker conservatively reset qualifs when
`IsNotPromotable` was in the return place. Unfortunately, named
variables have `IsNotPromotable`, so this could cause promotion to fail.
This should work now.
2019-11-06 07:09:16 -08:00
Nadrieril
7514c48917 Factor out constructing a new wildcard pattern 2019-11-06 15:09:03 +00:00
Nadrieril Feneanar
816aee2501 Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-06 15:09:03 +00:00
Dylan MacKenzie
a9b1abe6ea Remove IsNotPromotable and IsNotImplicitlyPromotable
The former was cleared from `qualifs_in_return_place`, and the latter
was never checked. `QUALIF_ERROR_BIT` no longer corresponds to a real
`Qualif`, however.
2019-11-06 07:05:03 -08:00
Dylan MacKenzie
383eb01593 Remove promotion_candidates from Checker
Also removes any code used only to populate `promotion_candidates`
during const checking.
2019-11-06 07:03:56 -08:00
Dylan MacKenzie
328a898d23 Remove valid_promotion_candidates
We no longer compare the results of
`promote_consts::validate_candidates` with
`checker.promotion_candidates`, and `promote_consts` becomes the
canonical source for determining promotability.
2019-11-06 07:03:56 -08:00
Srinivas Reddy Thatiparthy
62167c09e5 using 2.0.log(2.0) in examples does not make it clear which is the base and number. This example makes it clear for programmers who take a glance at the example by following the calculation. It is more intuitive, and eliminates the need for executing the example in the playground. 2019-11-06 19:20:01 +05:30
Lukas Kalbertodt
761ba89ffd
Replace array.into_iter() with iter() in libtest/tests.rs 2019-11-06 14:43:52 +01:00
Lukas Kalbertodt
8fd09d9db6
Add UI test for array.into_iter() lint 2019-11-06 14:43:52 +01:00
Lukas Kalbertodt
b492c97a31
Add future incompatibility lint for array.into_iter()
As we might want to add `IntoIterator` impls for arrays in the future,
and since that introduces a breaking change, this lint warns and
suggests using `iter()` instead (which is shorter and more explicit).
2019-11-06 14:43:28 +01:00
bors
3f0e16473d Auto merge of #65134 - davidtwco:issue-19834-improper-ctypes-in-extern-C-fn, r=rkruppe
improper_ctypes: `extern "C"` fns

cc #19834. Fixes #65867.

This pull request implements the change [described in this comment](https://github.com/rust-lang/rust/issues/19834#issuecomment-466671572).

cc @rkruppe @varkor @shepmaster
2019-11-06 12:45:35 +00:00
Nicholas Nethercote
eea6f23a0e Make doc comments cheaper with AttrKind.
`AttrKind` is a new type with two variants, `Normal` and `DocComment`. It's a
big performance win (over 10% in some cases) because `DocComment` lets doc
comments (which are common) be represented very cheaply.

`Attribute` gets some new helper methods to ease the transition:
- `has_name()`: check if the attribute name matches a single `Symbol`; for
  `DocComment` variants it succeeds if the symbol is `sym::doc`.
- `is_doc_comment()`: check if it has a `DocComment` kind.
- `{get,unwrap}_normal_item()`: extract the item from a `Normal` variant;
  panic otherwise.

Fixes #60935.
2019-11-06 23:05:07 +11:00
Nicholas Nethercote
69bc4aba78 Remove unnecessary Deref impl for Attribute.
This kind of thing just makes the code harder to read.
2019-11-06 23:01:02 +11:00
Mazdak Farrokhzad
bceaba86b9 rollback gating for failing macro matchers 2019-11-06 12:30:08 +01:00
Mazdak Farrokhzad
fe95cd2f4b revamp pre-expansion gating infra 2019-11-06 12:30:08 +01:00
Ralf Jung
f2ed1e661e
Fix markdown link
Co-Authored-By: Oliver Scherer <github35764891676564198441@oli-obk.de>
2019-11-06 11:15:30 +01:00
Mazdak Farrokhzad
574d2b83a1 patterns_in_fns_without_body -> deny 2019-11-06 11:10:37 +01:00
Mazdak Farrokhzad
a12e69d627 ill_formed_attribute_input -> deny 2019-11-06 11:10:37 +01:00
Mazdak Farrokhzad
0cbd06ae1c nested_impl_trait -> error 2019-11-06 11:10:37 +01:00
Mazdak Farrokhzad
8e27c4f312 duplicate_macro_exports -> error 2019-11-06 11:10:37 +01:00
Mazdak Farrokhzad
b54c5781b8 parenthesized_params_in_types_and_modules -> error 2019-11-06 11:10:37 +01:00
Mazdak Farrokhzad
98d2c510dd safe_extern_static -> error 2019-11-06 11:10:36 +01:00
Mazdak Farrokhzad
79b35e90f1 legacy_directory_ownership -> error 2019-11-06 11:08:23 +01:00
Mazdak Farrokhzad
c0056c04f6 legacy_ctor_visibility -> error 2019-11-06 11:08:23 +01:00
Oliver Scherer
e28287b32c The unsafety in iter.rs is already documented wonderfully 2019-11-06 11:04:42 +01:00
Oliver Scherer
34f7fcb862 Rebase fallout 2019-11-06 11:04:42 +01:00
Oliver Scherer
97633f814d Silence a deprecation warning 2019-11-06 11:04:42 +01:00
Oliver Scherer
954fc71962 Halloween... time to get rid of 👻 2019-11-06 11:04:42 +01:00
Oliver Scherer
02f9167f94 Have tidy ensure that we document all unsafe blocks in libcore 2019-11-06 11:04:42 +01:00
bors
61a551b493 Auto merge of #65830 - Quantumplation:master, r=davidtwco,estebank
Use ident.span instead of def_span in dead-code pass

Hello! First time contributor! :)

This should fix #58729.

According to @estebank in the duplicate #63064, def_span scans forward on the line until it finds a {,
and if it can't find one, falls back to the span for the whole item. This
was apparently written before the identifier span was explicitly tracked on
each node.

This means that if an unused function signature spans multiple lines, the
entire function (potentially hundreds of lines) gets flagged as dead code.
This could, for example, cause IDEs to add error squiggly's to the whole
function.

By using the span from the ident instead, we narrow the scope of this in
most cases. In a wider sense, it's probably safe to use ident.span
instead of def_span in most locations throughout the whole code base,
but since this is my first contribution, I kept it small.

Some interesting points that came up while I was working on this:
- I reorganized the tests a bit to bring some of the dead code ones all
into the same location
- A few tests were for things unrelated to dead code (like the
path-lookahead for parens), so I added #![allow(dead_code)] and
cleaned up the stderr file to reduce noise in the future
- The same fix doesn't apply to const and static declarations. I tried
adding these cases to the match expression, but that created a much
wider change to tests and error messages, so I left it off until I
could get some code review to validate the approach.
2019-11-06 09:35:27 +00:00
Guillaume Gomez
f66a331335 When a URL hash refers to a hidden element, it makes the element visible 2019-11-06 10:10:56 +01:00
Ralf Jung
2312a56f5c --bless 2019-11-06 10:06:11 +01:00
Ralf Jung
87edcf095d improve a comment 2019-11-06 10:06:11 +01:00
Ralf Jung
32453ce488 remvoe to_scalar_ptr and use ref_to_mplace everywhere 2019-11-06 10:06:11 +01:00
Ralf Jung
14ee66acec miri cast: avoid unnecessary to_scalar_ptr 2019-11-06 10:05:34 +01:00
3442853561
936349c81b
Update local.rs
Removed parameters not used in the macro
2019-11-06 16:39:48 +08:00
Pyry Kontio
4317263a31 Fix the Error linking. 2019-11-06 16:59:53 +09:00
Mazdak Farrokhzad
1c7595fd0f gate rustc_on_unimplemented under rustc_attrs 2019-11-06 07:34:51 +01:00
bors
e8b190ac4a Auto merge of #66143 - Centril:rollup-qmzuex0, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #65776 (Rename `LocalInternedString` and more)
 - #65973 (caller_location: point to macro invocation sites, like file!/line!, and use in core::panic!.)
 - #66015 (librustc_lexer: Refactor the module)
 - #66062 (Configure LLVM module PIC level)
 - #66086 (bump smallvec to 1.0)
 - #66092 (Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD.)
 - #66103 (Add target thumbv7neon-unknown-linux-musleabihf)
 - #66133 (Update the bundled `wasi-libc` repository)
 - #66139 (use American spelling for `pluralize!`)

Failed merges:

r? @ghost
2019-11-06 06:14:03 +00:00
Mazdak Farrokhzad
4f9651b854
Rollup merge of #66139 - euclio:pluralize, r=nagisa
use American spelling for `pluralize!`
2019-11-06 07:03:14 +01:00
Mazdak Farrokhzad
7f7218fd21
Rollup merge of #66133 - alexcrichton:update-wasi-libc, r=Mark-Simulacrum
Update the bundled `wasi-libc` repository

This updates the libc that the `wasm32-wasi` target links against to the
latest revision, mostly just bringing in minor bug fixes and minor wasm
size improvements.
2019-11-06 07:03:12 +01:00
Mazdak Farrokhzad
40558c329c
Rollup merge of #66103 - smaeul:patch/thumb-musl, r=nagisa
Add target thumbv7neon-unknown-linux-musleabihf

This is a copy of thumbv7neon-unknown-linux-gnueabihf with musl changes
merged from armv7-unknown-linux-musleabihf. This appears to have been
missed when adding the other ARMv7-A thumb targets.
2019-11-06 07:03:11 +01:00
Mazdak Farrokhzad
828a3eef66
Rollup merge of #66092 - niacat:master, r=nagisa
Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD.

This system call is present on all supported NetBSD versions and provides an endless stream of non-blocking random data from the kernel's ChaCha20-based CSPRNG. It doesn't require a file like `/dev/urandom` to be opened.

The system call is documented here (under kern.arandom):
https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-7.0

And defined here:
https://nxr.netbsd.org/xref/src/sys/sys/sysctl.h#273

The semantics are the same as FreeBSD so reading 256 bytes per call is fine.

Similar change for getrandom crate: rust-random/getrandom#115
2019-11-06 07:03:09 +01:00