Commit Graph

10089 Commits

Author SHA1 Message Date
Mateusz Mikuła
0ad3da0684 Enable ASLR for windows-gnu 2020-08-31 10:36:50 +02:00
Ralf Jung
97974e3cab only emit error for ManuallyDrop derefs 2020-08-31 10:14:31 +02:00
Ralf Jung
44defaea3a also detect DerefMut in nested union fields 2020-08-31 10:14:30 +02:00
Ralf Jung
ec0924f964 do not apply DerefMut on union field 2020-08-31 10:14:29 +02:00
Dániel Buga
c88b167f15 Additional assumption to elide bounds check 2020-08-31 08:19:15 +02:00
bors
8ed5cb56b5 Auto merge of #76027 - davidtwco:issue-61139-remove-obsolete-pretty-printer, r=eddyb
ty: remove obsolete pretty printer

Fixes #61139.

This PR removes the obsolete printer and replaces all uses of it with `FmtPrinter`. Of the replaced uses, all but one use was in `debug!` logging, two cases were notable:

- `MonoItem::to_string` is used in `-Z print-mono-items` and therefore affects the output of all codegen-units tests (which have been updated).
- `DefPathBasedNames` was used in `librustc_codegen_llvm/type_of.rs` with `LLVMStructCreateNamed` and that'll now get different values, but nothing will break as a result of this.

cc @eddyb (whom I've discussed this with)
2020-08-31 05:32:54 +00:00
bors
e98f0632bb Auto merge of #75082 - Aaron1011:feature/proc-macro-backtrace, r=petrochenkov
Add `-Z proc-macro-backtrace` to allow showing proc-macro panics

Fixes #75050

Previously, we would unconditionally suppress the panic hook during
proc-macro execution. This commit adds a new flag
`-Z proc-macro-backtrace`, which allows running the panic hook for
easier debugging.
2020-08-31 03:19:05 +00:00
Aaron Hill
d9208665b5
Add -Z proc-macro-backtrace to allow showing proc-macro panics
Fixes #75050

Previously, we would unconditionally suppress the panic hook during
proc-macro execution. This commit adds a new flag
-Z proc-macro-backtrace, which allows running the panic hook for
easier debugging.
2020-08-30 22:17:24 -04:00
bors
022e1fe235 Auto merge of #74668 - petrochenkov:noname, r=mark-i-m
cleanup: Remove duplicate library names from `Cargo.toml`s
2020-08-30 23:14:05 +00:00
Aaron Hill
090b16717a
Factor out StmtKind::MacCall fields into MacCallStmt struct
In PR #76130, I add a fourth field, which makes using a tuple variant
somewhat unwieldy.
2020-08-30 18:38:53 -04:00
Esteban Küber
07112ca62d Suggest if let x = y when encountering if x = y
Detect potential cases where `if let` was meant but `let` was left out.

Fix #44990.
2020-08-30 15:01:06 -07:00
Dylan MacKenzie
b015109ba9 Add documentation to the Analysis traits 2020-08-30 14:26:04 -07:00
Dylan MacKenzie
e178a87036 Expand documentation for the lattice module 2020-08-30 13:27:07 -07:00
Sasha
f6d18db402 Use string literal directly when available in format
Previous implementation used the `Parser::parse_expr` function in order
to extract the format expression. If the first comma following the
format expression was mistakenly replaced with a dot, then the next
format expression was eaten by the function, because it looked as a
syntactically valid expression, which resulted in incorrectly spanned
error messages.

The way the format expression is exctracted is changed: we first look at
the first available token in the first argument supplied to the
`format!` macro call. If it is a string literal, then it is promoted as
a format expression immediatly, otherwise we fall back to the original
`parse_expr`-related method.

This allows us to ensure that the parser won't consume too much tokens
when a typo is made.

A test has been created so that it is ensured that the issue is properly
fixed.
2020-08-30 22:09:58 +02:00
Vadim Petrochenkov
7dfbf59f10 cleanup: Remove duplicate library names from Cargo.tomls 2020-08-30 22:57:54 +03:00
Wim Looman
fc8a3ad66c Update for moved function from #74932 2020-08-30 21:51:30 +02:00
kadmin
8894b366fd Remove error message in specific case
In the case that a trait is not implemented for an ADT with type errors, cancel the error.
2020-08-30 19:39:51 +00:00
marmeladema
68500ffacb datastructures: replace once_cell crate with an impl from std 2020-08-30 20:06:14 +01:00
Erik Desjardins
24e0913e37 handle vector layout 2020-08-30 14:58:03 -04:00
Erik Desjardins
68217c9e0f ignore zst offsets instead 2020-08-30 14:58:03 -04:00
Erik Desjardins
e5d85f917b allow reordering of the last field of a MaybeUnsized struct if it's a ZST 2020-08-30 14:58:03 -04:00
Wim Looman
7636de33cf Point to no_mangle/export_name attribute when linting 2020-08-30 20:16:23 +02:00
Wim Looman
9ed3661427 Add note about why no_mangle and export_name are unsafe 2020-08-30 20:16:23 +02:00
Wim Looman
79b0ab5195 Scope no_mangle and export_name warnings to the declarations name 2020-08-30 20:16:23 +02:00
Wim Looman
66b2f9acfc Add checking for export_name to unsafe_code lint 2020-08-30 20:16:22 +02:00
Wim Looman
06a0269c11 Add checking for no_mangle to unsafe_code lint 2020-08-30 20:16:22 +02:00
Dylan MacKenzie
c03eba2d08 Add FIXME for faster cached block transfer functions
I've tried a few ways of implementing this, but each fell short.

Adding an auxiliary `_Idx` associated type to `Analysis` that defaults
to `!` but is overridden in the blanket impl of `Analysis` for `A:
GenKillAnalysis` to `A::Idx` seems promising, but the trait solver is
unable to prove equivalence between `A::Idx` and `A::_Idx` within the
overridden version of `into_engine`. Without full-featured
specialization, removing `into_engine` or splitting it into a different
trait would have a significant ergonomic penalty.

Alternatively, we could erase the index type and store a
`GenKillSet<u32>` as well as a function pointer for transmuting between
`&mut A::Domain` and `&mut BitSet<u32>` in the hopes that LLVM can
devirtualize a simple function pointer better than the boxed closure.
However, this is brittle, requires `unsafe` code, and doesn't work for
index types that aren't the same size as a `u32` (e.g. `usize`) since
`GenKillSet` stores a `HybridBitSet`, which may be a `Vec<I>`. Perhaps
safe transmute could help here?
2020-08-30 11:15:25 -07:00
Dylan MacKenzie
b19b8ea611 Update dataflow analyses to use new interface 2020-08-30 11:15:25 -07:00
Dylan MacKenzie
3233fb18a8 Extend dataflow framework to support arbitrary lattices 2020-08-30 11:15:24 -07:00
Dylan MacKenzie
9e45e90596 Allow access to the underlying Results from a ResultsCursor 2020-08-30 11:15:24 -07:00
Dylan MacKenzie
a88dc37c54 Add regex dependency to librustc_mir 2020-08-30 11:15:21 -07:00
Dylan MacKenzie
149307efb7 Improve BitSet APIs
A few small cleanups to `BitSet` and friends:

- Overload `clone_from` for `BitSet`.
- Improve `Debug` represenation of `HybridBitSet`.
- Make `HybridBitSet::domain_size` public.
- Don't require `T: Idx` at the type level. The `Idx` bound is still on
  most `BitSet` methods, but like `HashMap`, it doesn't need to be
  satisfied for the type to exist.
2020-08-30 11:13:18 -07:00
Caleb Cartwright
883b1e7592 parser: restore some fn visibility for rustfmt 2020-08-30 13:04:36 -05:00
David Wood
6ff471b1cf
ty: remove obsolete printer
This commit removes the obsolete printer and replaces all uses of it
with `FmtPrinter`. Of the replaced uses, all but one use was in `debug!`
logging, two cases were notable:

- `MonoItem::to_string` is used in `-Z print-mono-items` and therefore
  affects the output of all codegen-units tests.
- `DefPathBasedNames` was used in `librustc_codegen_llvm/type_of.rs`
  with `LLVMStructCreateNamed` and that'll now get different values, but
  this should result in no functional change.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-30 18:59:07 +01:00
David Wood
0f2bd56b29
lint/ty: move fns to avoid abstraction violation
This commit moves `transparent_newtype_field` and `is_zst` to
`LateContext` where they are used, rather than being on the `VariantDef`
and `TyS` types.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-30 18:57:46 +01:00
Aleksey Kladov
518cac9190 Remove unused function 2020-08-30 19:54:45 +02:00
Aleksey Kladov
ccffea5b6b Move lexer unit tests to rustc_lexer
StringReader is an intornal abstraction which at the moment changes a
lot, so these unit tests cause quite a bit of friction.

Moving them to rustc_lexer and more ingerated-testing style should
make them much less annoying, hopefully without decreasing their
usefulness much.

Note that coloncolon tests are removed (it's unclear what those are
testing).

\r\n tests are removed as well, as we normalize line endings even
before lexing.
2020-08-30 19:53:36 +02:00
Aaron Hill
a97dcfa375
Run cfg-stripping on generic parameters before invoking derive macros
Fixes #75930

This changes the tokens seen by a proc-macro. However, ising a `#[cfg]` attribute
on a generic paramter is unusual, and combining it with a proc-macro
derive is probably even more unusual. I don't expect this to cause any
breakage.
2020-08-30 13:46:19 -04:00
mark
9e5f7d5631 mv compiler to compiler/ 2020-08-30 18:45:07 +03:00