about summary refs log tree commit diff
path: root/tests/ui/static
AgeCommit message (Collapse)AuthorLines
2025-07-10Make `Diag::multipart_suggestions` always verboseEsteban Küber-3/+6
2025-07-07Add `ty_span` queryOli Scherer-2/+2
2025-06-30Don't look at static items' HIR for wfcheckOli Scherer-4/+4
2025-06-13Update tests.Mara Bos-29/+7
2025-06-05Use non-2015 edition paths in tests that do not test for their resolutionLukas Wirth-7/+7
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-1/+1
2025-03-03Tweak error code for sized checks of const/staticMichael Goulet-0/+1
2025-02-24tests: use minicore moreDavid Wood-3/+4
minicore makes it much easier to add new language items to all of the existing `no_core` tests.
2025-02-15fix: Alloc new errorcode E0803 for E0495xizheyin-2/+2
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-2/+3
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2025-02-03Check Sizedness of return type in WFMichael Goulet-16/+1
2024-12-23Note def descr in NonConstFunctionCallMichael Goulet-3/+3
2024-12-12Tweak multispan renderingEsteban Küber-8/+2
Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments.
2024-11-26tests: remove `//@ pretty-expanded` usages许杰友 Jieyou Xu (Joe)-1/+0
Done with ```bash sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs ``` and ``` sd '//@pretty-expanded.*\n' '' tests/ui/**/*.rs ```
2024-10-06Don't emit null pointer lint for raw ref of null derefMichael Goulet-15/+8
2024-10-06A raw ref of a deref is always safeMichael Goulet-2/+1
2024-09-26Stabilize `const_refs_to_static`Ding Xiang Fei-21/+0
update tests fix bitwidth-sensitive stderr output use build-fail for asm tests
2024-09-20Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errorsbors-416/+3
Disallow hidden references to mutable static Closes #123060 Tracking: - https://github.com/rust-lang/rust/issues/123758
2024-09-15stabilize const_mut_refsRalf Jung-5/+2
2024-09-13Update tests for hidden references to mutable staticObei Sideg-416/+3
2024-09-04propagate `tainted_by_errors` in `MirBorrowckCtxt::emit_errors`Folkert de Vries-0/+13
2024-08-18stabilize raw_ref_opRalf Jung-2/+0
2024-08-05Enforce supertrait outlives obligations hold when confirming implMichael Goulet-2/+29
2024-07-23Rollup merge of #125834 - ↵Matthias Krüger-0/+97
workingjubilee:weaken-thir-unsafeck-for-addr-of-static-mut, r=compiler-errors treat `&raw (const|mut) UNSAFE_STATIC` implied deref as safe Fixes rust-lang/rust#125833 As reported in that and related issues, `static mut STATIC_MUT: T` is very often used in embedded code, and is in many ways equivalent to `static STATIC_CELL: SyncUnsafeCell<T>`. The Rust expression of `&raw mut STATIC_MUT` and `SyncUnsafeCell::get(&STATIC_CELL)` are approximately equal, and both evaluate to `*mut T`. The library function is safe because it has *declared itself* to be safe. However, the raw ref operator is unsafe because all uses of `static mut` are considered unsafe, even though the static's value is not used by this expression (unlike, for example, `&STATIC_MUT`). We can fix this unnatural difference by simply adding the proper exclusion for the safety check inside the THIR unsafeck, so that we do not declare it unsafe if it is not. While the primary concern here is `static mut`, this change is made for all instances of an "unsafe static", which includes a static declared inside `extern "abi" {}`. Hypothetically, we could go as far as generalizing this to all instances of `&raw (const|mut) *ptr`, but today we do not, as we have not actually considered the range of possible expressions that use a similar encoding. We do not even extend this to thread-local equivalents, because they have less clear semantics.
2024-07-22compiler: treat `&raw (const|mut) UNSAFE_STATIC` implied deref as safeJubilee Young-0/+97
The implied deref to statics introduced by HIR->THIR lowering is only used to create place expressions, it lacks unsafe semantics. It is also confusing, as there is no visible `*ident` in the source. For both classes of "unsafe static" (extern static and static mut) allow this operation. We lack a clear story around `thread_local! { static mut }`, which is actually its own category of item that reuses the static syntax but has its own rules. It's possible they should be similarly included, but in the absence of a good reason one way or another, we do not bless it.
2024-07-18Use more accurate span for `addr_of!` suggestionEsteban Küber-22/+22
Use a multipart suggestion instead of a single whole-span replacement: ``` error[E0796]: creating a shared reference to a mutable static --> $DIR/reference-to-mut-static-unsafe-fn.rs:10:18 | LL | let _y = &X; | ^^ shared reference to mutable static | = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior help: use `addr_of!` instead to create a raw pointer | LL | let _y = addr_of!(X); | ~~~~~~~~~ + ```
2024-06-26Automatically taint InferCtxt when errors are emittedOli Scherer-363/+57
2024-06-05check_expr_struct_fields: taint context with errors if struct definition is ↵Olaf Siwiński-0/+75
malformed
2024-02-20Stabilize `LazyCell` and `LazyLock` (`lazy_cell`)Peter Jaszkowiak-2/+2
2024-03-31Move some testsCaio-0/+8
2024-03-03Move testsCaio-0/+62
2024-02-19Always evaluate free constants and statics, even if previous errors occurredOli Scherer-16/+16
2024-02-18Improve wording of static_mut_refObei Sideg-160/+492
Rename `static_mut_ref` lint to `static_mut_refs`.
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-19/+19
2024-02-10rebless after rebaseRalf Jung-0/+1
2024-02-10unstably allow constants to refer to statics and read from immutable staticsRalf Jung-4/+7
2024-02-08Taint borrowck results without running any borrowck if the MIR body was ↵Oli Scherer-32/+9
already tainted
2024-01-07Update test for `E0796` and `static_mut_ref` lintObei Sideg-5/+36
2024-01-06Add test for `E0796` and `static_mut_ref` lintObei Sideg-0/+356
2024-01-05Stabilize THIR unsafeckMatthew Jasper-12/+12
2024-01-05Remove revisions for THIR unsafeckMatthew Jasper-148/+14
This is to make the diff when stabilizing it easier to review.
2023-12-07recurse into refs when comparing tys for diagnosticsjyn-2/+2
2023-11-24Show number in error message even for one errorNilstrieb-13/+13
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-08-30Test and note unsafe ctor to fn ptr coercionMichael Goulet-1/+0
Also remove a note that I don't consider to be very useful in context.
2023-04-19Extend and use `hir::Node::body_id`Maybe Waffle-0/+2
2023-03-12Remove uses of `box_syntax` in rustc and toolsclubby789-9/+10
2023-02-22Convert a hard-warning about named static lifetimes into lint "unused_lifetimes"Zhi Qi-10/+2
Define the `named_static_lifetimes` lint This lint will replace the existing hard-warning. Replace the named static lifetime hard-warning with the new lint Update the UI tests for the `named_static_lifetimes` lint Remove the direct dependency on `rustc_lint_defs` fix build Signed-off-by: Zhi Qi <qizhi@pingcap.com> use "UNUSED_LIFETIMES" instead Signed-off-by: Zhi Qi <qizhi@pingcap.com> update 1 test and fix typo Signed-off-by: Zhi Qi <qizhi@pingcap.com> update tests Signed-off-by: Zhi Qi <qizhi@pingcap.com> fix tests: add extra blank line Signed-off-by: Zhi Qi <qizhi@pingcap.com>
2023-01-30Make structured suggestion for fn casting verboseEsteban Küber-4/+5
2023-01-30Mention fn coercion rules (needs to be expanded)Esteban Küber-0/+1
2023-01-30Modify primary span label for E0308Esteban Küber-5/+5
The previous output was unintuitive to users.