Commit graph

1340 commits

Author SHA1 Message Date
bjorn3
8748e37d35 Remove LibSource
The information is stored in used_crate_source too anyway
2021-07-05 10:49:07 +02:00
bors
44860d13fa Auto merge of #86867 - JohnTitor:convert-to-actual-assert, r=jackh726
Convert `debug_assert!` to `assert!` in `Binder::dummy`

This is needed for #85350 not to be passed.
r? `@jackh726`
2021-07-05 02:05:04 +00:00
bors
23c652dfe3 Auto merge of #86866 - nikomatsakis:issue-84841, r=oli-obk
Hack: Ignore inference variables in certain queries

Fixes #84841
Fixes #86753

Some queries are not built to accept types with inference variables, which can lead to ICEs. These queries probably ought to be converted to canonical form, but as a quick workaround, we can return conservative results in the case that inference variables are found.

We should file a follow-up issue (and update the FIXMEs...) to do the proper refactoring.

cc `@arora-aman`

r? `@oli-obk`
2021-07-04 17:39:37 +00:00
Niko Matsakis
63fbefd359 tag issues with FIXME 2021-07-04 12:50:28 -04:00
Niko Matsakis
86a5a6520d
Update compiler/rustc_middle/src/ty/normalize_erasing_regions.rs
Co-authored-by: Rémy Rakic <remy.rakic+github@gmail.com>
2021-07-04 12:37:25 -04:00
Yuki Okushi
93882e4396
Convert debug_assert! to assert! in Binder::dummy
This is needed for #85350 not to be passed.
2021-07-05 01:22:33 +09:00
Niko Matsakis
75c172246c be conservative in has_significant_drop 2021-07-04 11:41:40 -04:00
Niko Matsakis
40ee019c17 allow inference vars in type_implements_trait 2021-07-04 11:28:20 -04:00
bors
39e20f1ae5 Auto merge of #86255 - Smittyvb:mir-alloc-oom, r=RalfJung,oli-obk
Support allocation failures when interpreting MIR

This closes #79601 by handling the case where memory allocation fails during MIR interpretation, and translates that failure into an `InterpError`. The error message is "tried to allocate more memory than available to compiler" to make it clear that the memory shortage is happening at compile-time by the compiler itself, and that it is not a runtime issue.

Now that memory allocation can fail, it would be neat if Miri could simulate low-memory devices to make it easy to see how much memory a Rust program needs.

Note that this breaks Miri because it assumes that allocation can never fail.
2021-07-04 09:15:36 +00:00
Niko Matsakis
6f4b539a62 introduce helper function 2021-07-03 22:15:32 -04:00
Smitty
b201b2f65f Make vtable_allocation always succeed 2021-07-03 11:14:19 -04:00
Smitty
e9d69d9f8e Allocation failure in constprop panics right away 2021-07-02 16:06:12 -04:00
Yuki Okushi
884053a4b4
Remove ty::Binder::bind()
Co-authored-by: Noah Lev <camelidcamel@gmail.com>
2021-07-03 01:12:32 +09:00
Yuki Okushi
13e116f1f7
Use BoundVarsCollector for now 2021-07-03 01:12:31 +09:00
bors
7100b311df Auto merge of #86749 - bjorn3:link_info_refactor_part1, r=petrochenkov
Rename all_crate_nums query to crates and remove useless wrapper

Split out of https://github.com/rust-lang/rust/pull/86105

r? `@petrochenkov`
2021-07-01 19:00:08 +00:00
bjorn3
c7d2099de0 Rename all_crate_nums query to crates and remove useless wrapper 2021-07-01 16:51:11 +02:00
bors
f8ac8fdacf Auto merge of #86190 - asquared31415:extern-main-86110-fix, r=varkor
Fix ICE when `main` is declared in an `extern` block

Changes in #84401 to implement `imported_main` changed how the crate entry point is found, and a declared `main` in an `extern` block was detected erroneously.  This was causing the ICE described in #86110.

This PR adds a check for this case and emits an error instead.  Previously a `main` declaration in an `extern` block was not detected as an entry point at all, so emitting an error shouldn't break anything that worked previously.  In 1.52.1 stable this is demonstrated, with a `` `main` function not found`` error.

Fixes #86110
2021-07-01 06:39:37 +00:00
bors
1034282bca Auto merge of #86617 - joshtriplett:prune-dependencies, r=Mark-Simulacrum
Remove unused dependencies from compiler crates

Various compiler crates have dependencies that they don't appear to use. I used some scripting to detect such dependencies, filtered them based on some manual review, and removed those that do indeed appear to be entirely unused.
2021-07-01 03:49:47 +00:00
Smitty
3e20129a18 Delay ICE on evaluation fail 2021-06-30 15:38:31 -04:00
Smittyvb
12a8d106f6
Note that even ConstProp follows the rules
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-06-30 12:42:04 -04:00
Smitty
9f227945f1 Simplify memory failure checking 2021-06-30 11:24:52 -04:00
bors
868c702d0c Auto merge of #86695 - sexxi-goose:closure_size, r=nikomatsakis
Introduce -Zprofile-closures to evaluate the impact of 2229

This creates a CSV with name "closure_profile_XXXXX.csv", where the
variable part is the process id of the compiler.

To profile a cargo project you can run one of the following depending on
if you're compiling a library or a binary:

```
cargo +nightly rustc --lib -- -Zprofile-closures
cargo +nightly rustc --bin {binary_name} -- -Zprofile-closures
```

r? `@nikomatsakis`
2021-06-30 13:42:50 +00:00
Smitty
ba542eebc0 Rename is_spurious -> is_volatile 2021-06-30 09:27:30 -04:00
Smittyvb
55379bb7ea
simplify explanation comment
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-06-30 09:07:47 -04:00
Smitty
d04da1125d Properly handle const prop failures 2021-06-29 20:22:32 -04:00
Smitty
ab66c3fbd4 Add comment with reasoning for non-determinism 2021-06-29 19:08:30 -04:00
Smitty
43b55cf893 Simplify allocation creation 2021-06-29 19:08:29 -04:00
Smitty
dc1c6c3a25 Make memory exhaustion a hard error 2021-06-29 19:08:29 -04:00
Smitty
524e575bb4 Support allocation failures when interperting MIR
Note that this breaks Miri.

Closes #79601
2021-06-29 19:08:26 -04:00
bors
e98897e5dc Auto merge of #86475 - crlf0710:miri_vtable_refactor, r=bjorn3
Change vtable memory representation to use tcx allocated allocations.

This fixes https://github.com/rust-lang/rust/issues/86324. However i suspect there's more to change before it can land.

r? `@bjorn3`
cc `@rust-lang/miri`
2021-06-29 15:52:21 +00:00
bors
8971fff984 Auto merge of #86009 - cjgillot:fwarn, r=davidtwco
Make ForceWarn a lint level.

Follow-up to #85788
cc `@rylev`
2021-06-29 13:11:16 +00:00
bors
47b2f15bba Auto merge of #86670 - Aaron1011:copy-variance-diag, r=davidtwco
Derive `Copy` for `VarianceDiagInfo`
2021-06-29 05:15:34 +00:00
Yuki Okushi
14f333597e
Rollup merge of #86671 - m-ou-se:non-fmt-panic-future-incompatible, r=nikomatsakis
Turn non_fmt_panic into a future_incompatible edition lint.

This turns the `non_fmt_panic` lint into a future_incompatible edition lint, so it becomes part of the `rust_2021_compatibility` group. See https://github.com/rust-lang/rust/issues/85894.

This lint produces both warnings about semantical changes (e.g. `panic!("{{")`) and things that will become hard errors (e.g. `panic!("{")`). So I added a `explain_reason: false` that supresses the default "this will become a hard error" or "the semantics will change" message, and instead added a note depending on the situation. (cc `@rylev)`

r? `@nikomatsakis`
2021-06-29 08:46:14 +09:00
Aman Arora
fc273e9bf2 Introduce -Zprofile-closures to evaluate the impact of 2229
This creates a CSV with name "closure_profile_XXXXX.csv", where the
variable part is the process id of the compiler.

To profile a cargo project you can run one of the following depending on
if you're compiling a library or a binary:

```
cargo +stage1 rustc --lib -- -Zprofile-closures
cargo +stage1 rustc --bin -- -Zprofile-closures
```
2021-06-28 14:21:55 -04:00
Charles Lew
d3ff497bec Update other codegens to use tcx managed vtable allocations. 2021-06-28 19:39:48 +08:00
bors
345530412f Auto merge of #85909 - cjgillot:alloc-kind-query, r=Aaron1011
Make allocator_kind a query.

Part of #85153

r? `@Aaron1011`
2021-06-28 01:20:01 +00:00
Mara Bos
7f4e343893 Add explain_reason: false in future_incompatible.
This allows supressing the default warning message for future
incompatible ints, for lints that already provide a more detailed
warning.
2021-06-27 14:47:21 +00:00
Aaron Hill
4be38d2658
Derive Copy for VarianceDiagInfo 2021-06-27 09:30:13 -05:00
Camille GILLOT
e42271db0d Make ForceWarn a lint level. 2021-06-26 12:41:19 +02:00
bors
481971978f Auto merge of #86586 - Smittyvb:https-everywhere, r=petrochenkov
Use HTTPS links where possible

While looking at #86583, I wondered how many other (insecure) HTTP links were in `rustc`. This changes most other `http` links to `https`. While most of the links are in comments or documentation, there are a few other HTTP links that are used by CI that are changed to HTTPS.

Notes:
- I didn't change any to or in licences
- Some links don't support HTTPS :(
- Some `http` links were dead, in those cases I upgraded them to their new places (all of which used HTTPS)
2021-06-26 08:24:31 +00:00
Ryan Levick
7b3940f44b Address PR feedback 2021-06-25 14:51:56 +02:00
Ryan Levick
23176f60e7 Change how edition based future compatibility warnings are handled 2021-06-25 14:51:56 +02:00
bors
117799b73c Auto merge of #86505 - JohnTitor:fix-86483, r=jackh726
Do not panic in `return_type_impl_trait`

Fixes #86483
2021-06-25 09:28:17 +00:00
Josh Triplett
20cedd1925 rustc_middle: Remove unused dependency measureme
Unused since commit 4581d16bcb
("Move the query system to rustc_query_impl.").
2021-06-25 01:12:59 -07:00
Yuki Okushi
9323a2824b
Prefer "allow list" structure to check a type 2021-06-24 15:02:50 +09:00
Yuki Okushi
462c74007e
Rename function name in comments 2021-06-24 14:21:50 +09:00
Yuki Okushi
a141d29612
Do not panic in return_type_impl_trait 2021-06-24 14:06:28 +09:00
Yuki Okushi
469329d4f8
Rollup merge of #86296 - LeSeulArtichaut:thir-doc, r=nikomatsakis
Add documentation for various THIR structs

Helps with rust-lang/project-thir-unsafeck#6.
r? `@nikomatsakis`
2021-06-24 13:47:33 +09:00
Smitty
bdfcb88e8b Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
LeSeulArtichaut
30793c1e81 Add documentation for various THIR structs 2021-06-22 17:58:30 +02:00