about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-12-29Mark drop calls in landing pads cold instead of noinlineErik Desjardins-9/+42
Now that deferred inlining has been disabled in LLVM, this shouldn't cause catastrophic size blowup.
2021-12-28Auto merge of #92269 - vacuus:clean-generics-print, r=camelidbors-5/+6
rustdoc: Remove `collect` call in `clean::Generics::print`
2021-12-28Auto merge of #92352 - matthiaskrgr:rollup-19fbq7u, r=matthiaskrgrbors-26/+1008
Rollup of 7 pull requests Successful merges: - #92076 (Ignore other `PredicateKind`s in rustdoc auto trait finder) - #92219 (Remove VCVARS_BAT) - #92238 (Add a test suite for stringify macro) - #92330 (Add myself to .mailmap) - #92333 (Tighten span when suggesting lifetime on path) - #92335 (Document units for `std::column`) - #92344 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-28Auto merge of #92153 - petrochenkov:foreignchild, r=cjgillotbors-44/+20
rustc_metadata: Merge items from `extern` blocks into their parent modules during metadata encoding rather than during metadata decoding
2021-12-28Rollup merge of #92344 - lnicola:rust-analyzer-2021-12-28, r=lnicolaMatthias Krüger-16/+16
:arrow_up: rust-analyzer r? ``@ghost``
2021-12-28Rollup merge of #92335 - ecstatic-morse:std-column-unicode, r=ManishearthMatthias Krüger-0/+12
Document units for `std::column` Fixes #92301. r? ``@Manishearth`` (for the terminology and the Chinese)
2021-12-28Rollup merge of #92333 - compiler-errors:elided-lifetime-spans, r=cjgillotMatthias Krüger-7/+89
Tighten span when suggesting lifetime on path This is kind of a hack. Really the issue here is that we want to suggest the segment's span if the path resolves to something defined outside of the macro, and the macro's span if it resolves to something defined within.. I'll look into seeing if we can do something like that. Fixes #92324 r? `@cjgillot`
2021-12-28Rollup merge of #92330 - wesleywiser:mailmap, r=Mark-SimulacrumMatthias Krüger-0/+1
Add myself to .mailmap
2021-12-28Rollup merge of #92238 - dtolnay:stringifytest, r=Mark-SimulacrumMatthias Krüger-0/+879
Add a test suite for stringify macro This attempts to cover the behavior of `stringify!` on various interpolated syntax tree nodes. The pretty printer has a history of unsightly whitespace (double spaces, missing spaces, spaces where there shouldn't be spaces) — #91437, #91562, #91568. There are several such issues left; the test cases that I consider to be currently behaving incorrectly are marked with `// FIXME` in the PR.
2021-12-28Rollup merge of #92219 - ehuss:remove-vcvars, r=Mark-SimulacrumMatthias Krüger-2/+0
Remove VCVARS_BAT This environment variable is no longer used. It was used in the original Azure Pipelines configuration (#60777). When GitHub Actions were added (#70190), it was no longer used, and I suspect it was just an oversight while transitioning the configuration.
2021-12-28Rollup merge of #92076 - Aaron1011:rustdoc-auto-trait-ignore, r=cjgillotMatthias Krüger-1/+11
Ignore other `PredicateKind`s in rustdoc auto trait finder Fixes #92073 There's not really anything we can do with them, and they're causing ICEs. I'm not using a wildcard match, as we should check that any new `PredicateKind`s are handled properly by rustdoc.
2021-12-28:arrow_up: rust-analyzerLaurențiu Nicola-16/+16
2021-12-27Tighten span when suggesting lifetime on pathMichael Goulet-7/+89
2021-12-28Auto merge of #92159 - petrochenkov:decoditer, r=cjgillotbors-99/+70
rustc_metadata: Switch crate data iteration from a callback to iterator The iteration looks more conventional this way, and some allocations are avoided.
2021-12-28rustc_metadata: Merge items from `extern` blocks into their parent modulesVadim Petrochenkov-44/+20
during metadata encoding rather than during metadata decoding
2021-12-28Auto merge of #92088 - camelid:intra-doc-cleanup, r=Manishearthbors-79/+114
intra-doc: Use an enum to represent URL fragments This is a step in the direction of computing the links more lazily, which I think will simplify the implementation of intra-doc links. This will also make it easier to eventually use the actual `Res` for associated items, enum variants, and fields, rather than their HTML page's `Res`. r? `@jyn514`
2021-12-27intra-doc: Use an enum to represent URL fragmentsNoah Lev-78/+113
This is a step in the direction of computing the links more lazily, which I think will simplify the implementation of intra-doc links. This will also make it easier to eventually use the actual `Res` for associated items, enum variants, and fields, rather than their HTML page's `Res`.
2021-12-27Remove needless `return`Noah Lev-1/+1
2021-12-28Auto merge of #92130 - Kobzol:stable-hash-str, r=cjgillotbors-3/+2
Use hash_stable for hashing str This seemed like an oversight. With this change the hash can go through the `HashStable` machinery directly.
2021-12-27Document units for `std::column`Dylan MacKenzie-0/+12
2021-12-27Auto merge of #92329 - matthiaskrgr:rollup-l3b4fl1, r=matthiaskrgrbors-118/+437
Rollup of 7 pull requests Successful merges: - #90586 (Relax priv-in-pub lint on generic bounds and where clauses of trait impls.) - #92112 (Fix the error of checking `base_expr` twice in type_changing_struct_update) - #92147 (rustc_builtin_macros: make asm mod public for rustfmt) - #92161 (resolve: Minor miscellaneous cleanups from #89059) - #92264 (Remove `maybe_uninit_extra` feature from Vec docs) - #92303 (Add test cases for issue #26186) - #92307 (Fix minor typos) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-27Rollup merge of #92307 - hiroshi-maybe:fix-minor-typos, r=camelidMatthias Krüger-4/+4
Fix minor typos
2021-12-27Rollup merge of #92303 - Patrick-Poitras:issue-26186, r=jackh726Matthias Krüger-0/+62
Add test cases for issue #26186 Closes #26186 It seems that issue #26186 has been solved at some point since the issue has been last updated. I've merged together the examples that were supplied by `@Osspial,` `@Mark-Simulacrum,` `@Diggsey,` `@eefriedman` and `@shepmaster,` so that we can add this to the testing suite and prevent these issues from re-occurring.
2021-12-27Rollup merge of #92264 - Shadlock0133:patch-1, r=the8472Matthias Krüger-2/+2
Remove `maybe_uninit_extra` feature from Vec docs In `Vec`, two doc tests are using `MaybeUninit::write` , stabilized in 1.55. This makes docs' usage of `maybe_uninit_extra` feature unnecessary.
2021-12-27Rollup merge of #92161 - petrochenkov:misclean, r=cjgillotMatthias Krüger-26/+16
resolve: Minor miscellaneous cleanups from #89059 `@bors` rollup=always
2021-12-27Rollup merge of #92147 - calebcartwright:publicize-builtin_macro-asm, r=cjgillotMatthias Krüger-3/+3
rustc_builtin_macros: make asm mod public for rustfmt Follow up to #92016, as I'd completely missed that the mod we needed was internal
2021-12-27Rollup merge of #92112 - SparrowLii:issue92010, r=cjgillotMatthias Krüger-1/+25
Fix the error of checking `base_expr` twice in type_changing_struct_update Fixes #92010
2021-12-27Rollup merge of #90586 - jswrenn:relax-privacy-lints, r=petrochenkovMatthias Krüger-82/+325
Relax priv-in-pub lint on generic bounds and where clauses of trait impls. The priv-in-pub lint is a legacy mechanism of the compiler, supplanted by a reachability-based [type privacy](https://github.com/rust-lang/rfcs/blob/master/text/2145-type-privacy.md) analysis. This PR does **not** relax type privacy; it only relaxes the lint (as proposed by the type privacy RFC) in the case of trait impls. ## Current Behavior On public trait impls, it's currently an **error** to have a `where` bound constraining a private type with a trait: ```rust pub trait Trait {} pub struct Type {} struct Priv {} impl Trait for Priv {} impl Trait for Type where Priv: Trait // ERROR {} ``` ...and it's a **warning** to have have a public type constrained by a private trait: ```rust pub trait Trait {} pub struct Type {} pub struct Pub {} trait Priv {} impl Priv for Pub {} impl Trait for Type where Pub: Priv // WARNING {} ``` This lint applies to `where` clauses in other contexts, too; e.g. on free functions: ```rust struct Priv<T>(T); pub trait Pub {} impl<T: Pub> Pub for Priv<T> {} pub fn function<T>() where Priv<T>: Pub // WARNING {} ``` **These constraints could be relaxed without issue.** ## New Behavior This lint is relaxed for `where` clauses on trait impls, such that it's okay to have a `where` bound constraining a private type with a trait: ```rust pub trait Trait {} pub struct Type {} struct Priv {} impl Trait for Priv {} impl Trait for Type where Priv: Trait // OK {} ``` ...and it's okay to have a public type constrained by a private trait: ```rust pub trait Trait {} pub struct Type {} pub struct Pub {} trait Priv {} impl Priv for Pub {} impl Trait for Type where Pub: Priv // OK {} ``` ## Rationale While the priv-in-pub lint is not essential for soundness, it *can* help programmers avoid pitfalls that would make their libraries difficult to use by others. For instance, such a lint *is* useful for free functions; e.g. if a downstream crate tries to call the `function` in the previous snippet in a generic context: ```rust fn callsite<T>() where Priv<T>: Pub // ERROR: omitting this bound is a compile error, but including it is too { function::<T>() } ``` ...it cannot do so without repeating `function`'s `where` bound, which we cannot do because `Priv` is out-of-scope. A lint for this case is arguably helpful. However, this same reasoning **doesn't** hold for trait impls. To call an unconstrained method on a public trait impl with private bounds, you don't need to forward those private bounds, you can forward the public trait: ```rust mod upstream { pub trait Trait { fn method(&self) {} } pub struct Type<T>(T); pub struct Pub<T>(T); trait Priv {} impl<T: Priv> Priv for Pub<T> {} impl<T> Trait for Type<T> where Pub<T>: Priv // WARNING {} } mod downstream { use super::upstream::*; fn function<T>(value: Type<T>) where Type<T>: Trait // <- no private deets! { value.method(); } } ``` **This PR only eliminates the lint on trait impls.** It leaves it intact for all other contexts, including trait definitions, inherent impls, and function definitions. It doesn't need to exist in those cases either, but I figured I'd first target a case where it's mostly pointless. ## Other Notes - See discussion [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/relax.20priv-in-pub.20lint.20for.20trait.20impl.20.60where.60.20bounds/near/222458397). - This PR effectively reverts #79291.
2021-12-27Add myself to .mailmapWesley Wiser-0/+1
2021-12-26fix typo: intialized -> initializedHiroshi Kori-3/+3
2021-12-26fix typo: the use f.pad -> then use f.padHiroshi Kori-1/+1
2021-12-27relax priv-in-pub lint on generic bounds and where clauses in trait implsJack Wrenn-82/+325
2021-12-26Add test cases for issue #26186PFPoitras-0/+62
2021-12-26Auto merge of #92257 - fee1-dead:fix_env_further_bounds, r=oli-obkbors-1/+63
normalize env constness for nested obligations Closes #92230.
2021-12-25Remove unneeded call to `collect`Roc Yu-5/+6
2021-12-25Auto merge of #92262 - notriddle:notriddle/unused-hash, r=jyn514bors-11/+2
rustdoc: remove unused Hash impl
2021-12-25Auto merge of #92227 - Kobzol:rustdoc-doc-hidden, r=jyn514bors-16/+7
Rustdoc: use `is_doc_hidden` method on more places While profiling `rustdoc`, I noticed that finding out if some item is marked with `#[doc(hidden)]` is relatively hot, so I tried to optimize it. I noticed that there is already a method called `is_doc_hidden` on `TyCtxt`, but it wasn't used much, so I replaced the manual calls to `attrs(...).has_word(...)` with this method. Just by doing that, perf. was improved locally, although I'm not sure if the semantics of the previous calls and this method are the same? As another step, I tried to querify `is_doc_hidden`, but I didn't include that here until we see the perf. results from the first commit and until I find whether this change is OK at all :) Can I ask for a perf. run? Thanks. r? `@jyn514`
2021-12-25Auto merge of #92247 - lnicola:rust-analyzer-2021-12-24, r=lnicolabors-21/+16
:arrow_up: rust-analyzer r? `@ghost`
2021-12-24Auto merge of #92229 - fee1-dead:fix-rustdoc-const-drop, r=dtolnaybors-20/+35
Do not display `~const Drop` in rustdoc Although `T: ~const Drop` is still at an experimental stage, we have already begun inserting these bounds in libstd. This change hides them from rustdoc because 1. `~const` should not be documented in general as it is not yet official syntax; 2. users are not expected to know what `~const Drop` means yet.
2021-12-24Remove `maybe_uninit_extra` feature from Vec docsShadlock0133-2/+2
In `Vec`, two doc tests are using `MaybeUninit::write` , stabilized in 1.55. This makes docs' usage of `maybe_uninit_extra` feature unnecessary.
2021-12-24rustdoc: remove unused Hash implMichael Howell-11/+2
2021-12-24Auto merge of #92135 - AngelicosPhosphoros:typeid_inline_74362, r=dtolnaybors-0/+1
Add `#[inline]` modifier to `TypeId::of` It was already inlined but it happened only in 4th InlinerPass on my testcase. With `#[inline]` modifier it happens on 2nd pass. Closes #74362
2021-12-25bless ui testDeadbeef-1/+16
2021-12-24Auto merge of #92156 - petrochenkov:ctorkind, r=davidtwcobors-28/+21
rustc_metadata: Merge `get_ctor_def_id` and `get_ctor_kind` Also avoid decoding the whole `ty::AssocItem` to get a `has_self` flag. A small optimization and cleanup extracted from https://github.com/rust-lang/rust/pull/89059.
2021-12-25normalize env constness for nested obligationsDeadbeef-0/+47
2021-12-24Auto merge of #92253 - RalfJung:miri, r=RalfJungbors-7/+9
update Miri Fixes https://github.com/rust-lang/rust/issues/92246 r? `@ghost`
2021-12-24update MiriRalf Jung-7/+9
2021-12-24Auto merge of #92226 - woppopo:const_black_box, r=joshtriplettbors-1/+23
Constify `core::intrinsics::black_box` and `core::hint::black_box`. `core::intrinsics::black_box` is already constified, but it wasn't marked as const (see: https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/interpret/intrinsics.rs#L471). Tracking issue: None
2021-12-24:arrow_up: rust-analyzerLaurențiu Nicola-21/+16
2021-12-24Auto merge of #91342 - RalfJung:fn-abi, r=eddyb,oli-obkbors-147/+238
CTFE eval_fn_call: use FnAbi to determine argument skipping and compatibility This makes use of the `FnAbi` type in CTFE/Miri, which `@eddyb` has been saying for years is what we should do.^^ `FnAbi` is used to - determine which arguments to skip (rather than the previous heuristic of skipping ZST arguments with the Rust ABI) - impose further restrictions on whether caller and callee are consistent in how a given argument is passed I was hoping it would also simplify the code, but that is not the case -- the previous type compatibility checks are still required (AFAIK), only the ZST skipping is gone and that took barely any code. We also need some hacks because `FnAbi` assumes a certain way of implementing `caller_location` (by passing extra arguments), but Miri can just read the caller location from the call stack so it doesn't need those arguments. (The fact that every backend has to separately implement support for these arguments seems suboptimal -- looks like this might have been better implemented on the MIR level.) To avoid having to implement those unnecessary arguments in Miri, we just compute *whether* the argument is present on the caller/callee side, but don't actually pass that argument around. I have no idea if this looks the way `@eddyb` thinks it should look... but it makes Miri's test suite pass. ;) One of rustc's tests fails unfortunately (`ui/const-generics/issues/issue-67739.rs`), some const generic code that is evaluated too early -- I think that should raise `TooGeneric` but instead it ICEs. My assumption is this is some FnAbi code that has not been properly tested on polymorphic code, but it might also be me calling that FnAbi code the wrong way. r? `@oli-obk` `@eddyb` Fixes https://github.com/rust-lang/rust/issues/56166 Miri PR at https://github.com/rust-lang/miri/pull/1928