107609 Commits

Author SHA1 Message Date
Aaron Hill
516459870c
Add additional comment 2020-02-15 15:51:40 -05:00
Aaron Hill
51a16e574a
Record proc macro harness order for use during metadata deserialization
Fixes #68690

When we generate the proc macro harness, we now explicitly recorder the
order in which we generate entries. We then use this ordering data to
deserialize the correct proc-macro-data from the crate metadata.
2020-02-15 15:48:36 -05:00
Ralf Jung
b6aaacd991 fix codegen tests 2020-02-15 21:37:53 +01:00
Mazdak Farrokhzad
5abedd81e0 visit: unify extern & assoc item visiting 2020-02-15 20:57:12 +01:00
Mazdak Farrokhzad
cf87edfdc5 pprust: unify extern & associated item printing 2020-02-15 20:57:12 +01:00
Mazdak Farrokhzad
0e0c0286a2 fuse extern & associated item parsing up to defaultness 2020-02-15 20:57:12 +01:00
Mazdak Farrokhzad
91110fda27 ast: make ForeignItemKind an alias of AssocItemKind 2020-02-15 20:57:12 +01:00
Mazdak Farrokhzad
35884fe168 parse extern consts 2020-02-15 20:57:12 +01:00
Mazdak Farrokhzad
f8d2264463 parse associated statics. 2020-02-15 20:57:12 +01:00
Mazdak Farrokhzad
1c2906ead3 ast/parser: fuse static & const grammars in all contexts. 2020-02-15 20:57:12 +01:00
Mazdak Farrokhzad
f3e9763543 ast: make = <expr>; optional in free statics/consts. 2020-02-15 20:57:12 +01:00
Yuki Okushi
2f39ec24b2 Add FIXME note 2020-02-16 04:36:44 +09:00
Ralf Jung
94047f18c2 remove no-longer-needed test 2020-02-15 19:40:33 +01:00
Yuki Okushi
9478503315 Add test for issue-68653 2020-02-16 03:22:00 +09:00
Yuki Okushi
426dcf0da0 Add test for issue-63952 2020-02-16 03:22:00 +09:00
Yuki Okushi
ecb8bf069e Add test for issue-62894 2020-02-16 03:22:00 +09:00
Ralf Jung
3134df2214 adjust run-fail tests 2020-02-15 19:02:36 +01:00
Yuki Okushi
f32447d541 Add test for issue-51798 2020-02-16 02:54:16 +09:00
Yuki Okushi
6351bfd182 Add test for issue-39618 2020-02-16 02:53:58 +09:00
John Kåre Alsaker
8a37811e2c Panic when hashing node IDs 2020-02-15 18:07:17 +01:00
Mazdak Farrokhzad
95dc9b9a73 ast: normalize ForeignItemKind::Ty & AssocItemKind::TyAlias. 2020-02-15 18:00:01 +01:00
Mazdak Farrokhzad
e2ae717265 ast: tweak comments of Foreign/AssocItemKind 2020-02-15 18:00:01 +01:00
Mazdak Farrokhzad
f06df1629e ast: colocate AssocItem with ForeignItem 2020-02-15 18:00:01 +01:00
Mazdak Farrokhzad
2fd15442f2 ast: move Generics into AssocItemKinds 2020-02-15 18:00:01 +01:00
John Kåre Alsaker
a7db5051d1 Treat NodeIs as pure values for incremental compilation 2020-02-15 17:50:11 +01:00
Guillaume Gomez
cadf9efad1 Clean up E0309 explanation 2020-02-15 16:41:21 +01:00
Ralf Jung
0c8c800f21
Tighter type bounds for messages
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-02-15 15:42:13 +01:00
Matthew Jasper
f2980e71d9 Add fast path for is_freeze 2020-02-15 14:41:34 +00:00
Matthew Jasper
0663f25375 Always qualify literals by type 2020-02-15 14:41:34 +00:00
Ralf Jung
c4a6f84b80 fix compile-fail 2020-02-15 14:57:13 +01:00
bors
61d9231ff2 Auto merge of #69168 - brainlock:test-textrel-regression, r=Mark-Simulacrum,tmandry
add regression test for issue #68794

This is a minimal regression test for the issue #68794: "TEXTREL in
i686", which was fixed with e86019c4a0968a1e393cdd0731649168624a88b8.

The test links a minimal rust static library into a shared library, and
checks that the linker didn't have to add the TEXTREL flag.
2020-02-15 13:48:53 +00:00
Amos Onn
40ca167944 Improve #Safety in various methods in core::ptr
For all methods which read a value of type T, `read`, `read_unaligned`,
`read_volatile` and `replace`, added missing
constraint:
The value they point to must be properly initialized
2020-02-15 14:00:21 +01:00
Amos Onn
351782d30a Improve #Safety of core::ptr::replace
Added missing condition:
`dst` must be readable
2020-02-15 14:00:10 +01:00
Amos Onn
302b9e4b54 Improve #Safety in various methods in core::ptr
s/for reads and writes/for both ...
2020-02-15 13:58:54 +01:00
Vadim Petrochenkov
dcad07af8a parser: macro_rules is a weak keyword 2020-02-15 15:49:17 +03:00
Vadim Petrochenkov
1bd6b98220 Emit some additional unused_doc_comments lints outside of the main pass 2020-02-15 15:29:45 +03:00
Ralf Jung
25870a0b77 fix another test 2020-02-15 13:15:15 +01:00
Ralf Jung
415218fc8d expand assoc-const test a bit, just to be sure 2020-02-15 11:47:11 +01:00
Ralf Jung
2107e73d2f fix exceeding_bitshift lint and test 2020-02-15 11:43:54 +01:00
bors
dbef35309d Auto merge of #69182 - Dylan-DPC:rollup-ifsa9fx, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #64069 (Added From<Vec<NonZeroU8>> for CString)
 - #66721 (implement LowerExp and UpperExp for integers)
 - #69106 (Fix std::fs::copy on WASI target)
 - #69154 (Avoid calling `fn_sig` on closures)
 - #69166 (Check `has_typeck_tables` before calling `typeck_tables_of`)
 - #69180 (Suggest a comma if a struct initializer field fails to parse)

Failed merges:

r? @ghost
2020-02-15 10:20:05 +00:00
Ralf Jung
4b8c784968 add test for issue 69020 2020-02-15 11:00:14 +01:00
Ralf Jung
9c7639492f more revisions and use them for another test 2020-02-15 10:52:49 +01:00
Ralf Jung
bd48522314 fix tests, and use variants to test debug and release builds together 2020-02-15 10:47:27 +01:00
Vadim Petrochenkov
bcd7e2b38b rustc_lint: Move unused_doc_comments from pre-expansion to early lints 2020-02-15 12:38:34 +03:00
Dylan DPC
e9db0613ac
Rollup merge of #69180 - Aaron1011:feature/comma-struct-init, r=petrochenkov
Suggest a comma if a struct initializer field fails to parse

Currently, we emit a "try adding a comma" suggestion if a comma is
missing in a struct definition. However, we emit no such suggestion if a
comma is missing in a struct initializer.

This commit adds a "try adding a comma" suggestion when we don't find a
comma during the parsing of a struct initializer field.

The change to `src/test/ui/parser/removed-syntax-with-1.stderr` isn't
great, but I don't see a good way of avoiding it.
2020-02-15 09:45:49 +01:00
Dylan DPC
09d6a657b1
Rollup merge of #69166 - JohnTitor:ice-const-enum, r=matthewjasper
Check `has_typeck_tables` before calling `typeck_tables_of`

Fixes #68684

r? @matthewjasper
2020-02-15 09:45:48 +01:00
Dylan DPC
c115ad927a
Rollup merge of #69154 - JohnTitor:fix-macro-ices, r=petrochenkov
Avoid calling `fn_sig` on closures

Fixes #68060

r? @petrochenkov
2020-02-15 09:45:46 +01:00
Dylan DPC
728be34ebc
Rollup merge of #69106 - RReverser:wasi-fs-copy, r=KodrAus
Fix std::fs::copy on WASI target

Previously `std::fs::copy` on wasm32-wasi would reuse code from the `sys_common` module and would successfully copy contents of the file just to fail right before closing it.

This was happening because `sys_common::copy` tries to copy permissions of the file, but permissions are not a thing in WASI (at least yet) and `set_permissions` is implemented as an unconditional runtime error.

This change instead adds a custom working implementation of `std::fs::copy` (like Rust already has on some other targets) that doesn't try to call `set_permissions` and is essentially a thin wrapper around `std::io::copy`.

Fixes #68560.
2020-02-15 09:45:45 +01:00
Dylan DPC
afea30dc27
Rollup merge of #66721 - maxbla:exp-format-integers, r=KodrAus
implement LowerExp and UpperExp for integers

Addresses https://github.com/rust-lang/rust/issues/39479

This implementation is heavily based on the preexisting `macro_rules! impl_Display` in the same file. I don't like the liberal use of unsafe in that macro and would like to modify it so `unsafe` is only present where necessary. What is Rust's policy on doing such modifications?

Also, I couldn't figure out where to put tests, can I have some help with that?
2020-02-15 09:45:43 +01:00
Dylan DPC
d28b35812f
Rollup merge of #64069 - danielhenrymantilla:feature/cstring_from_vec_of_nonzerou8, r=KodrAus
Added From<Vec<NonZeroU8>> for CString

Added a `From<Vec<NonZeroU8>>` `impl` for `CString`

# Rationale

  - `CString::from_vec_unchecked` is a subtle function, that makes `unsafe` code harder to audit when the generated `Vec`'s creation is non-trivial. This `impl` allows to write safer `unsafe` code thanks to the very explicit semantics of the `Vec<NonZeroU8>` type.

  - One such situation is when trying to `.read()` a `CString`, see issue #59229.

      - this lead to a PR: #59314, that was closed for being too specific / narrow (it only targetted being able to `.read()` a `CString`, when this pattern could have been generalized).

     - the issue suggested another route, based on `From<Vec<NonZeroU8>>`, which is indeed a less general and more concise code pattern.

  - quoting @shnatsel:

      - >  For me the main thing about making this safe is simplifying auditing - people have spent like an hour looking at just this one unsafe block in libflate because it's not clear what exactly is unchecked, so you have to look it up when auditing anyway. This has distracted us from much more serious memory safety issues the library had.
Having this trivial impl in stdlib would turn this into safe code with compiler more or less guaranteeing that it's fine, and save anyone auditing the code a whole lot of time.
2020-02-15 09:45:38 +01:00