| Age | Commit message (Collapse) | Author | Lines |
|
polymorphize: unevaluated constants
This PR makes polymorphization visit the promoted MIR of unevaluated constants with available promoted MIR instead of visiting the substitutions of that constant - which will mark all of the generic parameters as used; in addition polymorphization will now visit non-promoted unevaluated constants rather than visit their substs.
r? @lcnr
|
|
Implement the `min_const_generics` feature gate
Implements both https://github.com/rust-lang/lang-team/issues/37 and https://github.com/rust-lang/compiler-team/issues/332.
Adds the new feature gate `#![feature(min_const_generics)]`.
This feature gate adds the following limitations to using const generics:
- generic parameters must only be used in types if they are trivial. (either `N` or `{ N }`)
- generic parameters must be either integers, `bool` or `char`.
We do allow arbitrary expressions in associated consts though, meaning that the following is allowed,
even if `<[u8; 0] as Foo>::ASSOC` is not const evaluatable.
```rust
trait Foo {
const ASSOC: usize;
}
impl<const N: usize> Foo for [u8; N] {
const ASSOC: usize = 64 / N;
}
```
r? @varkor cc @eddyb @withoutboats
|
|
r=Mark-Simulacrum
Prevent `__rust_begin_short_backtrace` frames from being tail-call optimised away
I've stumbled across some situations where there (unexpectedly) was no `__rust_begin_short_backtrace` frame on the stack during unwinding.
On closer examination, it appeared that the calls to that function had been tail-call optimised away.
This PR follows [@bjorn3's suggestion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Disabling.20tail.20call.20optimisation.3F/near/205699133), by adding calls to `black_box` that hint to rustc not to perform TCO.
Fixes #47429
|
|
away
|
|
davidtwco:polymorphisation-symbol-mangling-v0-upvar-closures, r=lcnr
instance: polymorphize upvar closures/generators
This PR modifies how instances are polymorphized so that closures and generators have any closures or generators captured within their upvars also polymorphized.
With the new symbol mangling, a fully polymorphised closure will produce the same symbol regardless of what it was instantiated with. However, when that polymorphised closure captures another closure as an upvar, then the type of that other closure in the upvar substitution wouldn't have been polymorphised. The other closure will still refer to the initial substitutions. Therefore, the polymorphised closure will end up hashing differently but producing the same symbol - triggering `assert_symbols_are_distinct` in MIR partitioning. The old mangling scheme had a hash at the end that meant this didn't happen (this would still have been an issue, we just didn't have a way to notice).
See [this Zulip discussion for further elaboration](https://rust-lang.zulipchat.com/#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/symbol.20mangling.20v0.20.E2.9C.95.20polymorphisation/near/206152008).
r? @eddyb
cc @lcnr
|
|
This commit modifies how instances are polymorphized so that closures
and generators have any closures or generators captured within their
upvars also polymorphized - this avoids symbol clashes with the new
symbol mangling scheme.
Signed-off-by: David Wood <david@davidtw.co>
|
|
This commit makes polymorphization visit non-promoted unevaluated
constants rather than visit their substs directly.
Signed-off-by: David Wood <david@davidtw.co>
|
|
Check whether locals are too large instead of whether accesses into them are too large
Essentially this stops const prop from attempting to optimize
```rust
let mut x = [0_u8; 5000];
x[42] = 3;
```
I don't expect this to be a perf improvement without #73656 (which is also where the lack of this PR will be a perf regression).
r? @wesleywiser
|
|
This commit makes polymorphization visited the MIR of unevaluated
constants with available promoted MIR instead of visiting the
substitutions of that constant - which will mark all of the generic
parameters as used.
Signed-off-by: David Wood <david@davidtw.co>
|
|
rustc_ast: Stop using "string typing" for doc comment tokens
Explicitly store their kind and style retrieved during lexing in the `token::DocComment`.
Also don't "beautify" doc comments before converting them to `#[doc]` attributes when passing them to macros (both declarative and procedural).
The trimming of empty lines, lines containing only `*`s, etc is purely a rustdoc's job as a part of its presentation of doc strings to users, rustc must not do this and must pass tokens as precisely as possible internally.
|
|
Fix ICE when using asm! on an unsupported architecture
Fixes #75220
|
|
Make `IntoIterator` lifetime bounds of `&BTreeMap` match with `&HashMap`
This is a pretty small change on the lifetime bounds of `IntoIterator` implementations of both `&BTreeMap` and `&mut BTreeMap`. This is loosening the lifetime bounds, so more code should be accepted with this PR. This is lifetime bounds will still be implicit since we have `type Item = (&'a K, &'a V);` in the implementation. This change will make the HashMap and BTreeMap share the same signature, so we can share the same function/trait with both HashMap and BTreeMap in the code.
Fixes #74034.
r? @dtolnay hey, I was touching this file on my previous PR and wanted to fix this on the way. Would you mind taking a look at this, or redirecting it if you are busy?
|
|
|
|
Handle fieldless tuple structs in diagnostic code
Fixes #75062
|
|
compiletest: ignore-endian-big, fixes #74829, fixes #74885
See discussion on #74829
I tested it on a Debian s390x machine, works well.
|
|
|
|
|
|
Fixes #75220
|
|
Add HRTB-related regression test
Closes #59311 and cc #71546
This closes the former but the test is taken from https://github.com/rust-lang/rust/issues/71546#issuecomment-620638437 since it seems they have the same cause and it's simplified.
|
|
|
|
|
|
Add regression test for #64494
Add regression test to indicate if this compilation ever succeeds.
Fixes #64494
r? @lcnr
|
|
|
|
|
|
|
|
Show backtrace numbers in backtrace whenever more than one is involved
Previously, we only displayed 'frame' numbers in a macro backtrace when more
than two frames were involved. This commit should help make backtrace
more readable, since these kinds of messages can quickly get confusing.
|
|
Previously, we only displayed 'frame' numbers in a macro backtrace when more
than two frames were involved. This commit should help make backtrace
more readable, since these kinds of messages can quickly get confusing.
|
|
Add regression test for #72787
Add regression test for Issue #72787
Fixes #72787
~~Still waiting on running tests locally to bless the error output~~
r? @lcnr
|
|
Fixes #75062
|
|
Rollup of 5 pull requests
Successful merges:
- #75139 (Remove log alias from librustdoc)
- #75140 (Clean up E0745)
- #75149 (Correct a typo in interpret/memory.rs)
- #75152 (Replace `Memoryblock` with `NonNull<[u8]>`)
- #75168 (Update books)
Failed merges:
r? @ghost
|
|
Replace `Memoryblock` with `NonNull<[u8]>`
Closes rust-lang/wg-allocators#61
r? @Amanieu
|
|
forbid `#[track_caller]` on main
fixes #75125
cc @anp
|
|
|
|
As well as matching error outputs
|
|
Forbid non-derefable types explicitly in unsizing casts
Fixes #75118
r? @oli-obk
|
|
|
|
|
|
Remove in-place allocation and revert to separate methods for zeroed allocations
closes rust-lang/wg-allocators#58
|
|
|
|
|
|
Stabilize Ident::new_raw
Tracking issue: #54723
This is a continuation of PR #59002
|
|
Do not trigger `unused_braces` for `while let`
Follow-up for #75031
r? @lcnr
|
|
Lint path statements to suggest using drop when the type needs drop
Fixes #48852. With this change the current lint description doesn't really fit entirely anymore I think.
|
|
Add track_caller to RefCell::{borrow, borrow_mut}
So panic messages point at the offending borrow.
Fixes #74472
|
|
Tracking issue: #54723
This is a continuation of PR #59002
|
|
Fix change detection in CfgSimplifier::collapse_goto_chain
Check that the old target is different from the new collapsed one, before concluding that anything changed.
Fixes #75074
Fixes #75051
|
|
|
|
|
|
Stabilize `Result::as_deref` and `as_deref_mut`
FCP completed in https://github.com/rust-lang/rust/issues/50264#issuecomment-645681400.
This PR stabilizes two new APIs for `std::result::Result`:
```rust
fn as_deref(&self) -> Result<&T::Target, &E> where T: Deref;
fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E> where T: DerefMut;
```
This PR also removes two rarely used unstable APIs from `Result`:
```rust
fn as_deref_err(&self) -> Result<&T, &E::Target> where E: Deref;
fn as_deref_mut_err(&mut self) -> Result<&mut T, &mut E::Target> where E: DerefMut;
```
Closes #50264
|
|
Check that the old target is different from the new collapsed one,
before concluding that anything changed.
|