1"use strict";(globalThis.webpackChunkdocs=globalThis.webpackChunkdocs||[]).push([[124],{71595(e,t,i){i.r(t),i.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>p,frontMatter:()=>s,metadata:()=>o,toc:()=>d});const o=JSON.parse('{"id":"libraries/standard_library/meta/location","title":"Location","description":"A source location at compile time, used to attach diagnostics (errors and warnings) to specific items or expressions.","source":"@site/versioned_docs/version-v1.0.0-rc.2/libraries/standard_library/meta/location.md","sourceDirName":"libraries/standard_library/meta","slug":"/libraries/standard_library/meta/location","permalink":"/docs/libraries/standard_library/meta/location","draft":false,"unlisted":false,"editUrl":"https://github.com/noir-lang/noir/edit/master/docs/versioned_docs/version-v1.0.0-rc.2/libraries/standard_library/meta/location.md","tags":[],"version":"v1.0.0-rc.2","frontMatter":{"title":"Location","description":"A source location at compile time, used to attach diagnostics (errors and warnings) to specific items or expressions."},"sidebar":"sidebar","previous":{"title":"ItemVisibility","permalink":"/docs/libraries/standard_library/meta/item_visibility"},"next":{"title":"Module","permalink":"/docs/libraries/standard_library/meta/module"}}');var n=i(74848),r=i(28453);const s={title:"Location",description:"A source location at compile time, used to attach diagnostics (errors and warnings) to specific items or expressions."},a=void 0,c={},d=[{value:"Trait Implementations",id:"trait-implementations",level:2}];function l(e){const t={code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"std::meta::location"})," contains the built-in ",(0,n.jsx)(t.code,{children:"Location"})," type which represents a source location\nin a Noir program. ",(0,n.jsx)(t.code,{children:"Location"})," values are produced by other comptime types (",(0,n.jsx)(t.code,{children:"FunctionDefinition"}),",\n",(0,n.jsx)(t.code,{children:"Module"}),", ",(0,n.jsx)(t.code,{children:"TraitDefinition"}),", ",(0,n.jsx)(t.code,{children:"TypeDefinition"}),", and ",(0,n.jsx)(t.code,{children:"TypedExpr"})," all expose a ",(0,n.jsx)(t.code,{children:"location"})," method)\nand are typically passed to ",(0,n.jsx)(t.code,{children:"std::meta::error"})," and ",(0,n.jsx)(t.code,{children:"std::meta::warn"})," to attach a diagnostic to\na specific item or expression in the source program."]}),"\n",(0,n.jsx)(t.h2,{id:"trait-implementations",children:"Trait Implementations"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-rust",children:"impl Eq for Location\nimpl Hash for Location\n"})}),"\n",(0,n.jsxs)(t.p,{children:["Two ",(0,n.jsx)(t.code,{children:"Location"})," values compare equal if and only if they refer to the same source span."]})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}},28453(e,t,i){i.d(t,{R:()=>s,x:()=>a});var o=i(96540);const n={},r=o.createContext(n);function s(e){const t=o.useContext(r);return o.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:s(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.