Commit graph

1301 commits

Author SHA1 Message Date
Ralf Jung
719dafc48b double-check mutability inside Allocation 2021-06-28 09:19:36 +02: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
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
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
bors
80926fc409 Auto merge of #86368 - michaelwoerister:lexing-ice, r=davidtwco
Disambiguate between SourceFiles from different crates even if they have the same path

This PR fixes an ICE that can occur when the compiler encounters a source file that is part of both the local crate and an upstream crate:

1. While importing source files from an upstream crate the compiler creates a `SourceFile` entry for `foo.rs` in the `SourceMap`. Since this is an imported source file its `src` field is `None`.
2. At a later point the parser encounters `foo.rs` again. It tells the `SourceMap` to load the file but because we already have an entry for `foo.rs` the `SourceMap` will return the existing version with `src == None`.
3. The parser proceeds under the assumption that `src.is_some()` and panics when actually trying to use the file's contents.

This PR fixes the issue by adding the source file's associated `CrateNum` to the `SourceMap`'s interning key. As a consequence the two instances of the file will each have a separate entry in the `SourceMap`. They just happen to share the same file path. This approach seemed less problematic to me than trying to mutate the `SourceFile` after it had already been created.

Another, more involved, approach might be to merge the `src` and the `external_src` field.

Fixes #85955
2021-06-22 14:53:58 +00:00
bors
3487be11d5 Auto merge of #86545 - JohnTitor:rollup-7sqdhpa, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #86393 (Add regression test for issue #52025)
 - #86402 (rustdoc: add optional woff2 versions of Source Serif and Source Code)
 - #86451 (Resolve intra-doc links in summary desc)
 - #86501 (Cleanup handling of `crate_name` for doctests)
 - #86517 (Fix `unused_unsafe` around `await`)
 - #86537 (Mark some edition tests as check-pass)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-22 12:11:02 +00:00
Yuki Okushi
8ec4e7dfdd
Rollup merge of #86517 - camsteffen:unused-unsafe-async, r=LeSeulArtichaut
Fix `unused_unsafe` around `await`

Enables `unused_unsafe` lint for `unsafe { future.await }`.

The existing test for this is `unsafe { println!() }`, so I assume that `println!` used to contain compiler-generated unsafe but this is no longer true, and so the existing test is broken. I replaced the test with `unsafe { ...await }`. I believe `await` is currently the only instance of compiler-generated unsafe.

Reverts some parts of #85421, but the issue predates that PR.
2021-06-22 20:01:05 +09:00
bors
75ed34223a Auto merge of #84910 - eopb:stabilize_int_error_matching, r=yaahc
stabilize `int_error_matching`

closes #22639

> It has been over half a year since https://github.com/rust-lang/rust/pull/77640#pullrequestreview-511263516, and the indexing question is rejected in https://github.com/rust-lang/rust/pull/79728#pullrequestreview-633030341, so I guess we can submit another stabilization attempt? 😉

_Originally posted by `@kennytm` in https://github.com/rust-lang/rust/issues/22639#issuecomment-831738266_
2021-06-22 09:30:15 +00:00
Cameron Steffen
b07bb6d698 Fix unused_unsafe with compiler-generated unsafe 2021-06-21 17:25:45 -05:00
Michael Woerister
c3c4ab5ed2 Encode SourceFile source crate as StableCrateId in incr. comp. OnDiskCache. 2021-06-21 15:30:16 +02:00
Camille GILLOT
cbdfbdd40b Implement the query in cstore_impl. 2021-06-20 11:58:46 +02:00
Camille GILLOT
ed9ee25108 256th query. 2021-06-20 11:53:59 +02:00
Camille GILLOT
6a371d2c89 Make allocator_kind a query. 2021-06-20 11:52:51 +02:00
bors
29cd70d407 Auto merge of #86437 - nikomatsakis:tait-docs, r=oli-obk
add various coments to explain how the TAIT code works

r? `@oli-obk`
2021-06-19 12:41:10 +00:00
bors
9839f9c7ff Auto merge of #86456 - JohnTitor:rollup-jjzupny, r=JohnTitor
Rollup of 9 pull requests

Successful merges:

 - #86136 (Stabilize span_open() and span_close().)
 - #86359 (Use as_secs_f64 in JunitFormatter)
 - #86370 (Fix rustdoc stabilized versions layout)
 - #86397 (Alter std::cell::Cell::get_mut documentation)
 - #86407 (Use `map_or` instead of open-coding it)
 - #86425 (Update rustversion to 1.0.5)
 - #86440 (Update library tracking issue for libs-api rename.)
 - #86444 (Fix ICE with `#[repr(simd)]` on enum)
 - #86453 (stdlib: Fix typo in internal RefCell docs )

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-19 01:57:14 +00:00
bors
ec57c60c50 Auto merge of #86194 - RalfJung:const-ub-hard-error, r=oli-obk
make UB during CTFE a hard error

This is a next step for https://github.com/rust-lang/rust/issues/71800. `const_err` has been a future-incompatibility lint for 4 months now since https://github.com/rust-lang/rust/pull/80394 (and err-by-default for many years before that), so I think we could try making it a proper hard error at least in some situations.

I didn't yet adjust the tests, since I first want to gauge the fall-out via crater.
Cc `@rust-lang/wg-const-eval`
2021-06-18 23:17:40 +00:00
Fabian Wolff
e7a1186c6d Fix ICE with #[repr(simd)] on enum 2021-06-18 21:39:53 +02:00
Niko Matsakis
f6adaedd9b add various coments to explain how the code works 2021-06-18 11:44:56 -04:00
bors
312b894cc1 Auto merge of #85421 - Smittyvb:rm_pushpop_unsafe, r=matthewjasper
Remove some last remants of {push,pop}_unsafe!

These macros have already been removed, but there was still some code handling these macros. That code is now removed.
2021-06-18 14:17:53 +00:00
Ralf Jung
3c08cf8e5e make UB during CTFE a hard error 2021-06-18 16:00:04 +02:00
Yuki Okushi
c062f3dddd
Rollup merge of #86340 - Smittyvb:ctfe-hard-error-message, r=RalfJung
Use better error message for hard errors in CTFE

I noticed this while working on #86255: currently the same message is used for hard errors and soft errors in CTFE. This changes the error messages to make hard errors use a message that indicates the reality of the situation correctly, since usage of the constant is never allowed when there was a hard error evaluating it. This doesn't affect the behaviour of these error messages, only the content.

This changes the error logic to check if the error should be hard or soft where it is generated, instead of where it is emitted, to allow this distinction in error messages.
2021-06-17 21:56:43 +09:00
bors
b17d9c1332 Auto merge of #85834 - cjgillot:save-sbi, r=michaelwoerister
Encode CrateNum using the StableCrateId for incr. comp.
2021-06-17 09:03:58 +00:00
bors
444a85ac38 Auto merge of #86379 - JohnTitor:rollup-mkz9x36, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #85870 (Allow whitespace in dump_mir filter)
 - #86104 (Fix span calculation in format strings)
 - #86140 (Mention the `Borrow` guarantee on the `Hash` implementations for Arrays and `Vec`)
 - #86141 (Link reference in `dyn` keyword documentation)
 - #86260 (Open trait implementations' toggles by default.)
 - #86339 (Mention #79078 on compatibility notes of 1.52)
 - #86341 (Stop returning a value from `report_assert_as_lint`)
 - #86353 (Remove `projection_ty_from_predicates`)
 - #86361 (Add missing backslashes to prevent unwanted newlines in rustdoc HTML)
 - #86372 (Typo correction: s/is/its)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-16 22:48:31 +00:00
Smitty
044b3620e7 Move some hard error logic to InterpError 2021-06-16 18:23:34 -04:00
Yuki Okushi
05ba958fe8
Rollup merge of #86353 - JohnTitor:remove-projection_ty_from_predicates, r=oli-obk
Remove `projection_ty_from_predicates`

Fixes #86350
r? ``@oli-obk``
2021-06-17 05:54:59 +09:00
bors
a85f584aeb Auto merge of #86266 - LeSeulArtichaut:box-thir-adt, r=davidtwco
Box `thir::ExprKind::Adt` for performance

`Adt` is the biggest variant in the enum and probably isn't used very often compared to the other expr kinds, so boxing it should be beneficial for performance. We need a perf test to be sure.
2021-06-16 20:00:17 +00:00
Yuki Okushi
280d19395d
Remove projection_ty_from_predicates 2021-06-16 16:33:03 +09:00
bors
2336406b38 Auto merge of #86291 - crlf0710:trait_vtbl_refactor, r=bjorn3
Refactor vtable codegen

This refactor the codegen of vtables of miri interpreter, llvm, cranelift codegen backends.

This is preparation for the implementation of trait upcasting feature. cc #65991

Note that aside from code reorganization, there's an internal behavior change here that now InstanceDef::Virtual's index now include the three metadata slots, and now the first method is with index 3.

cc  `@RalfJung` `@bjorn3`
2021-06-16 07:20:27 +00:00
Charles Lew
a86d3a7e45 Refactor to make interpreter and codegen backend neutral to vtable internal representation. 2021-06-15 01:59:00 +08:00
Rémy Rakic
19fddc019f Improve documentation on UndefinedBehaviorInfo::ValidationFailure 2021-06-14 18:57:06 +02:00
Ethan Brierley
b59f7d9662 stabilize int_error_matching 2021-06-14 09:58:32 +01:00
Rémy Rakic
87ecf84c36 Improve CTFE validation error message 2021-06-13 22:40:42 +02:00
LeSeulArtichaut
5e802e5e97 Box ExprKind::Adt 2021-06-13 17:03:11 +02:00
bors
fb3ea63d9b Auto merge of #86245 - lqd:const-ub-align, r=RalfJung
Fix ICEs on invalid vtable size/alignment const UB errors

The invalid vtable size/alignment errors from `InterpCx::read_size_and_align_from_vtable` were "freeform const UB errors", causing ICEs when reaching validation. This PR turns them into const UB hard errors to catch them during validation and avoid that.

Fixes #86193

r? `@RalfJung`

(It seemed cleaner to have 2 variants but they can be merged into one variant with a message payload if you prefer that ?)
2021-06-13 12:08:59 +00:00
Rémy Rakic
cae1918b29 Turn incorrect vtable size/alignment errors into hard const-UB errors
They were "freeform const UB" error message, but could reach validation
and trigger ICEs there. We now catch them during validation to avoid
that.
2021-06-13 13:11:07 +02:00
Tomasz Miąsko
06ca736e14 Pretty print generator witness only in -Zverbose mode
In release build of deeply-nested-async benchmark the size of
`no-opt.bc` file is reduced from 46MB to 62kB.
2021-06-12 18:28:17 +02:00
bors
d59b80d588 Auto merge of #86130 - BoxyUwU:abstract_const_as_cast, r=oli-obk
const_eval_checked: Support as casts in abstract consts
2021-06-12 08:50:22 +00:00
bors
0f6ba39fd8 Auto merge of #86180 - cjgillot:defmv, r=petrochenkov
Hash DefId in rustc_span.

This is mostly just moving code around. Changes are simplifications of unneeded callbacks from rustc_span to rustc_middle.

r? `@petrochenkov`
2021-06-12 06:09:20 +00:00
Yuki Okushi
5b78e6de18
Rollup merge of #86189 - JohnTitor:relate-fn-pub, r=Aaron1011
Make `relate_type_and_mut` public

#85343 improved diagnostics around `Relate` impls but made `relate_type_and_mut` private, which was accessible as `relate` previously. This makes it public so that we can use it on rust-semverver.

r? ```@Aaron1011```
2021-06-12 01:16:01 +09:00
Yuki Okushi
3b47d337e0
Rollup merge of #85800 - BoxyUwU:const-param-default-diagnostics, r=oli-obk
Fix some diagnostic issues with const_generics_defaults feature gate

This PR makes a few changes:
- print out const param defaults in "lifetime ordering" errors rather than discarding them
- update `is_simple_text` to account for const params when checking if a type has no generics, this was causing a note to be failed to add to an error message
- fixes some diagnostic wording that incorrectly said there was ordering restrictions between type/const params despite the `const_generics_defaults` feature gate is active
2021-06-12 01:15:56 +09:00
Camille GILLOT
a7a50b0c0a Hash DefId in rustc_span. 2021-06-11 12:25:02 +02:00
Yuki Okushi
3607857756 Make relate_type_and_mut public 2021-06-10 11:48:51 +09:00