about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2022-06-03Rollup merge of #97415 - cjgillot:is-late-bound-solo, r=estebankDylan DPC-266/+205
Compute `is_late_bound_map` query separately from lifetime resolution This query is actually very simple, and is only useful for functions and method. It can be computed directly by fetching the HIR, with no need to embed it within the lifetime resolution visitor. Based on https://github.com/rust-lang/rust/pull/96296
2022-06-03Compute `is_late_bound` in a separate query.Camille GILLOT-99/+47
The computation is actually much simpler, and can be done by directly fetching the HIR for the `FnDecl` and its generics.
2022-06-03Manipulate lifetimes by LocalDefId for region resolution.Camille GILLOT-170/+161
2022-06-03Auto merge of #97679 - Dylan-DPC:rollup-nswmgmx, r=Dylan-DPCbors-87/+370
Rollup of 5 pull requests Successful merges: - #97366 (Stabilize `{slice,array}::from_ref`) - #97653 (add cast kind of from_exposed_addr (int-to-ptr casts)) - #97663 (take back half-baked noaliasing check in Assignment) - #97664 (On E0204 suggest missing type param bounds) - #97668 (rustdoc: clean up primitive.slice.html links) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-03Rollup merge of #97668 - notriddle:notriddle/slice-link, r=jshaDylan DPC-22/+50
rustdoc: clean up primitive.slice.html links Before: <a href="https://doc.rust-lang.org/stable/std/boxed/struct.Box.html">Box</a>&lt;<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">[</a>T<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">]</a>&gt; After: <a href="https://doc.rust-lang.org/stable/std/boxed/struct.Box.html">Box</a>&lt;<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">[T]</a>&gt;
2022-06-03Rollup merge of #97664 - estebank:suggest-bound-derive-copy, r=compiler-errorsDylan DPC-21/+219
On E0204 suggest missing type param bounds ``` error[E0204]: the trait `Copy` may not be implemented for this type --> f42.rs:9:17 | 9 | #[derive(Debug, Copy, Clone)] | ^^^^ 10 | pub struct AABB<K>{ 11 | pub loc: Vector2<K>, | ------------------- this field does not implement `Copy` 12 | pub size: Vector2<K> | -------------------- this field does not implement `Copy` | note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:11:5 | 11 | pub loc: Vector2<K>, | ^^^^^^^^^^^^^^^^^^^ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:12:5 | 12 | pub size: Vector2<K> | ^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `K` | 10 | pub struct AABB<K: Debug>{ | +++++++ ``` Fix #89137.
2022-06-03Rollup merge of #97663 - RalfJung:keine-halben-sachen, r=oli-obkDylan DPC-3/+3
take back half-baked noaliasing check in Assignment Doing an aliasing check in `copy_op` does not make a ton of sense. We have to eventually do something in the `Assignment` statement handling instead.
2022-06-03Rollup merge of #97653 - RalfJung:int-to-ptr, r=oli-obkDylan DPC-39/+96
add cast kind of from_exposed_addr (int-to-ptr casts) This is basically the dual to https://github.com/rust-lang/rust/pull/97582, for int2ptr casts. Cc `@tmiasko` https://github.com/rust-lang/rust/issues/97649
2022-06-03Rollup merge of #97366 - WaffleLapkin:stabilize_array_slice_from_ref, r=dtolnayDylan DPC-2/+2
Stabilize `{slice,array}::from_ref` This PR stabilizes the following APIs as `const` functions in Rust `1.63`: ```rust // core::array pub const fn from_ref<T>(s: &T) -> &[T; 1]; // core::slice pub const fn from_ref<T>(s: &T) -> &[T]; ``` Note that the `mut` versions are not stabilized as unique references (`&mut _`) are [unstable in const context]. FCP: https://github.com/rust-lang/rust/issues/90206#issuecomment-1134586665 r? rust-lang/libs-api `@rustbot` label +T-libs-api -T-libs [unstable in const context]: https://github.com/rust-lang/rust/issues/57349
2022-06-03Auto merge of #96296 - cjgillot:remove-label-lt-shadow, r=petrochenkovbors-1751/+223
Remove label/lifetime shadowing warnings This PR removes some pre-1.0 shadowing warnings for labels and lifetimes. The current behaviour of the compiler is to warn * labels that shadow unrelated labels in the same function --> removed ```rust 'a: loop {} 'a: loop {} // STOP WARNING ``` * labels that shadow enclosing labels --> kept, but only if shadowing is hygienic ```rust 'a: loop { 'a: loop {} // KEEP WARNING } ``` * labels that shadow lifetime --> removed ```rust fn foo<'a>() { 'a: loop {} // STOP WARNING } ``` * lifetimes that shadow labels --> removed ```rust 'a: loop { let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>; // STOP WARNING } ``` * lifetimes that shadow lifetimes --> kept ```rust fn foo<'a>() { let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>; // KEEP WARNING } ``` Closes https://github.com/rust-lang/rust/issues/31745. ----- From `@petrochenkov` in https://github.com/rust-lang/rust/pull/95781#issuecomment-1105199014 > I think we should remove these silly checks entirely. > They were introduced long time ago in case some new language features appear and require this space. > Now we have another mechanism for such language changes - editions, and if "lifetimes in expressions" or something like that needs to be introduced it could be introduced as an edition change. > However, there was no plans to introduce anything like for years, so it's unlikely that even the edition mechanism will be necessary. r? rust-lang/lang
2022-06-03Use the same message as type & const generics.Camille GILLOT-71/+50
2022-06-03Reuse resolve_label to check lifetime shadowing.Camille GILLOT-40/+29
2022-06-03Do not lower generic lifetime params when AST resolution emitted an error.Camille GILLOT-24/+18
2022-06-03Auto merge of #97497 - c410-f3r:z-errors, r=petrochenkovbors-2/+2
Move some tests to more reasonable places r? `@petrochenkov`
2022-06-03Auto merge of #97667 - matthiaskrgr:rollup-5cfxc85, r=matthiaskrgrbors-51/+126
Rollup of 5 pull requests Successful merges: - #97502 (rustdoc: Add more test coverage) - #97627 (update explicit impls error msg) - #97640 (Fix wrong suggestion for adding where clauses) - #97645 (don't use a `span_note` for ignored impls) - #97655 (Improve documentation for constructors of pinned `Box`es) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-02Tweak outputEsteban Küber-14/+14
2022-06-02rustdoc: add channel normalization to htmldocck.pyMichael Howell-0/+2
2022-06-02rustdoc: clean up primitive.slice.html linksMichael Howell-22/+48
2022-06-02Rollup merge of #97655 - steffahn:better-pin-box-construction-docs, r=thomccMatthias Krüger-4/+28
Improve documentation for constructors of pinned `Box`es Adds a cross-references between `Box::pin` and `Box::into_pin` (and other related methods, i.e. the equivalent `From` implementation, and the unstable `pin_in` method), in particular now that `into_pin` [was stabilized](https://github.com/rust-lang/rust/pull/97397). The main goal is to further improve visibility of the fact that `Box<T> -> Pin<Box<T>>` conversion exits in the first place, and that `Box::pin(x)` is – essentially – just a convenience function for `Box::into_pin(Box::new(x))` The motivating context why I think this is important is even experienced Rust users overlooking the existence this kind of conversion, [e.g. in this thread on IRLO](https://internals.rust-lang.org/t/pre-rfc-function-variants/16732/7?u=steffahn); and also the fact that that discussion brought up that there would be a bunch of Box-construction methods "missing" such as e.g. methods with fallible allocation a la "`Box::try_pin`", and similar; while those are in fact *not* necessary, because you can use `Box::into_pin(Box::try_new(x)?)` instead. I have *not* included explicit mention of methods (e.g. `try_new`) in the docs of stable methods (e.g. `into_pin`). (Referring to unstable API in stable API docs would be bad style IMO.) Stable examples I have in mind with the statement "constructing a (pinned) Box in a different way than with `Box::new`" are things like cloning a `Box`, or `Box::from_raw`. If/when `try_new` would get stabilized, it would become a very good concrete example use-case of `Box::into_pin` IMO.
2022-06-02Rollup merge of #97645 - lcnr:derived-impl-debug, r=cjgillotMatthias Krüger-35/+6
don't use a `span_note` for ignored impls Searching for the `derive` isn't too difficult as it's right above the field definition. By using a span these errors are a lot more verbose than they should be, which is especially annoying as one can end up with a lot of `dead_code` warnings.
2022-06-02Rollup merge of #97640 - ↵Matthias Krüger-2/+40
TaKO8Ki:fix-wrong-suggestion-for-adding-where-clauses, r=lcnr Fix wrong suggestion for adding where clauses closes #97576
2022-06-02Rollup merge of #97627 - lcnr:comment-tick, r=Dylan-DPCMatthias Krüger-10/+10
update explicit impls error msg
2022-06-02Rollup merge of #97502 - onlineSoftwareDevOK:rustdocTests, r=GuillaumeGomezMatthias Krüger-0/+42
rustdoc: Add more test coverage Related issue https://github.com/rust-lang/rust/issues/91113
2022-06-02Auto merge of #97598 - spastorino:simplify-universal-impl-trait-lowering, ↵bors-267/+194
r=cjgillot Simplify universal impl trait lowering Closes #96644 r? `@cjgillot`
2022-06-02On E0204 suggest missing type param boundsEsteban Küber-13/+211
``` error[E0204]: the trait `Copy` may not be implemented for this type --> f42.rs:9:17 | 9 | #[derive(Debug, Copy, Clone)] | ^^^^ 10 | pub struct AABB<K>{ 11 | pub loc: Vector2<K>, | ------------------- this field does not implement `Copy` 12 | pub size: Vector2<K> | -------------------- this field does not implement `Copy` | note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:11:5 | 11 | pub loc: Vector2<K>, | ^^^^^^^^^^^^^^^^^^^ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:12:5 | 12 | pub size: Vector2<K> | ^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `K` | 10 | pub struct AABB<K: Debug>{ | +++++++ ``` Fix #89137.
2022-06-02take back half-baked noaliasing check in AssignmentRalf Jung-3/+3
2022-06-02Auto merge of #97575 - nnethercote:lazify-SourceFile-lines, r=Mark-Simulacrumbors-123/+239
Lazify `SourceFile::lines`. `SourceFile::lines` is a big part of metadata. It's stored in a compressed form (a difference list) to save disk space. Decoding it is a big fraction of compile time for very small crates/programs. This commit introduces a new type `SourceFileLines` which has a `Lines` form and a `Diffs` form. The latter is used when the metadata is first read, and it is only decoded into the `Lines` form when line data is actually needed. This avoids the decoding cost for many files, especially in `std`. It's a performance win of up to 15% for tiny crates/programs where metadata decoding is a high part of compilation costs. A `RefCell` is needed because the methods that access lines data (which can trigger decoding) take `&self` rather than `&mut self`. To allow for this, `SourceFile::lines` now takes a `FnMut` that operates on the lines slice rather than returning the lines slice. r? `@Mark-Simulacrum`
2022-06-02Rebase fallout.Camille GILLOT-95/+7
2022-06-02Stop warning against unrelated labels.Camille GILLOT-428/+42
2022-06-02Bless tests.Camille GILLOT-267/+0
2022-06-02Do not report mixed label/lifetime shadowing.Camille GILLOT-111/+45
2022-06-02Bless tests.Camille GILLOT-774/+207
2022-06-02Diagnose shadowing on AST.Camille GILLOT-325/+209
2022-06-02Auto merge of #97654 - Dylan-DPC:rollup-w6zrzxf, r=Dylan-DPCbors-208/+336
Rollup of 5 pull requests Successful merges: - #97420 (Be a little nicer with casts when formatting `fn` pointers) - #97450 ([RFC 2011] Basic compiler infrastructure) - #97599 (Fix JSON reexport ICE) - #97617 (Rustdoc anonymous reexports) - #97636 (Revert #96682.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-02commentRalf Jung-1/+4
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2022-06-02rustdoc: Add more test coverageonlinesoftwaredevok@protonmail.com-0/+42
2022-06-02add cast kind of from_exposed_addr (int-to-ptr casts)Ralf Jung-39/+93
2022-06-02Improve documentation for constructors of pinned `Box`esFrank Steffahn-4/+28
2022-06-02Rollup merge of #97636 - nnethercote:revert-96682, r=dtolnayDylan DPC-110/+68
Revert #96682. The change was "Show invisible delimiters (within comments) when pretty printing". It's useful to show these delimiters, but is a breaking change for some proc macros. Fixes #97608. r? ``@petrochenkov``
2022-06-02Rollup merge of #97617 - GuillaumeGomez:rustdoc-anonymous-reexports, r=Nemo157Dylan DPC-2/+24
Rustdoc anonymous reexports Fixes #97615. r? `@Nemo157`
2022-06-02Rollup merge of #97599 - GuillaumeGomez:reexport-json, r=CraftSpiderDylan DPC-35/+83
Fix JSON reexport ICE Fixes https://github.com/rust-lang/rust/issues/97432. The problem was that the ID was conflicting because the reexports have the same one. To fix it, I "extended" it by adding the `Symbol` into it as well. r? `@notriddle`
2022-06-02Rollup merge of #97450 - c410-f3r:assert-compiler, r=oli-obkDylan DPC-25/+129
[RFC 2011] Basic compiler infrastructure Splitting https://github.com/rust-lang/rust/pull/96496 into smaller pieces as was done in https://github.com/rust-lang/rust/pull/97233. Hope review will be easier. This PR practically contains no logic and only serves as a building ground for the actual code that will be placed in a posterior step. * Adds `context.rs` to place the new `assert!` logic. Has a lot of unused elements but all of them are used by the implementation. * Creates an unstable flag because the feature is not yet complete and also to allow external feedback. * Creates the necessary `sym` identifiers that are mostly based on the library elements -> https://github.com/rust-lang/rust/blob/master/library/core/src/asserting.rs * Modifies `assert.rs` to branch to `context.rs` if the unstable flag is enabled. * Adds a test to satisfy tidy but the test does nothing in reality.
2022-06-02Rollup merge of #97420 - WaffleLapkin:no_oxford_casts_qqq, r=Mark-SimulacrumDylan DPC-36/+32
Be a little nicer with casts when formatting `fn` pointers This removes a `fn(...) -> ...` -> `usize` -> `*const ()` -> `usize` cast. cc #95489.
2022-06-02Auto merge of #97293 - est31:remove_box, r=oli-obkbors-11/+80
Add #[rustc_box] and use it inside alloc This commit adds an alternative content boxing syntax, and uses it inside alloc. ```Rust #![feature(box_syntax)] fn foo() { let foo = box bar; } ``` is equivalent to ```Rust #![feature(rustc_attrs)] fn foo() { let foo = #[rustc_box] Box::new(bar); } ``` The usage inside the very performance relevant code in liballoc is the only remaining relevant usage of box syntax in the compiler (outside of tests, which are comparatively easy to port). box syntax was originally designed to be used by all Rust developers. This introduces a replacement syntax more tailored to only being used inside the Rust compiler, and with it, lays the groundwork for eventually removing box syntax. [Earlier work](https://github.com/rust-lang/rust/pull/87781#issuecomment-894714878) by `@nbdd0121` to lower `Box::new` to `box` during THIR -> MIR building ran into borrow checker problems, requiring the lowering to be adjusted in a way that led to [performance regressions](https://github.com/rust-lang/rust/pull/87781#issuecomment-894872367). The proposed change in this PR lowers `#[rustc_box] Box::new` -> `box` in the AST -> HIR lowering step, which is way earlier in the compiler, and thus should cause less issues both performance wise as well as regarding type inference/borrow checking/etc. Hopefully, future work can move the lowering further back in the compiler, as long as there are no performance regressions.
2022-06-02Basic compiler infraCaio-25/+129
2022-06-02fix wrong suggestion for adding where clausesTakayuki Maeda-2/+40
2022-06-02Auto merge of #97644 - Dylan-DPC:rollup-xaeio91, r=Dylan-DPCbors-246/+746
Rollup of 6 pull requests Successful merges: - #96894 (Apply track_caller to closure on `expect_non_local()`) - #97023 (Diagnose anonymous lifetimes errors more uniformly between async and regular fns) - #97397 (Stabilize `box_into_pin`) - #97587 (Migrate more diagnostics to use the `#[derive(SessionDiagnostic)]`) - #97603 (Arc make_mut doc comment spelling correction.) - #97635 (Fix file metadata documentation for Windows) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-02Add regression test for json reexport bugGuillaume Gomez-0/+17
2022-06-02Add Symbol into rustdoc JSON ID to prevent conflicts between reexportsGuillaume Gomez-35/+66
2022-06-02don't use a `span_note` for ignored implslcnr-35/+6